diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 00000000..0eb818ea --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,32 @@ +name: Publish package to the Maven Central Repository +on: + push: + branches: [master] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Get changes in pom.xml + id: changed-pom + uses: tj-actions/changed-files@v34 + with: + files: | + pom.xml + - name: Set up Maven Central Repository + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-passphrase: MAVEN_GPG_PASSPHRASE + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + - name: Publish package + if: steps.changed-pom.outputs.any_changed == 'true' + run: mvn --batch-mode clean deploy + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} diff --git a/LICENSE b/LICENSE index 3eeb9992..fe736a4c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright © 2022 Twilio, Inc. +Copyright © 2024 Twilio, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 3159e646..216a1a61 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,16 @@ -# segment-publicapi +# Segment Public API Java SDK -Segment Public API -- API version: 32.0.2 +:warning: This SDK is currently released as [Public Beta](https://segment.com/legal/first-access-beta-preview/). Its use in critical systems is discouraged, but [feedback is welcome](#contributing). -The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. +## Overview -All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. +The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. The full documentation is available at [https://docs.segmentapis.com](https://docs.segmentapis.com). -See the next sections for more information on how to use the Segment Public API. +All endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. +See the next sections for more information on how to use the Segment Public API Java SDK. - For more information, please visit [https://docs.segmentapis.com](https://docs.segmentapis.com) - -*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* - +Latest API and SDK version: 58.13.0 ## Requirements @@ -23,29 +20,15 @@ Building the API client library requires: ## Installation -To install the API client library to your local Maven repository, simply execute: - -```shell -mvn clean install -``` - -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: - -```shell -mvn clean deploy -``` - -Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. - ### Maven users Add this dependency to your project's POM: ```xml - com.segment + com.segment.publicapi segment-publicapi - 32.0.2 + 58.13.0 compile ``` @@ -61,7 +44,7 @@ Add this dependency to your project's build file: } dependencies { - implementation "com.segment:segment-publicapi:32.0.2" + implementation "com.segment.publicapi:segment-publicapi:58.13.0" } ``` @@ -75,22 +58,23 @@ mvn clean package Then manually install the following JARs: -* `target/segment-publicapi-32.0.2.jar` +* `target/segment-publicapi-58.13.0.jar` * `target/lib/*.jar` -## Getting Started +You are now ready to start making calls to Public API! -Please follow the [installation](#installation) instruction and execute the following Java code: +## Example ```java -// Import classes: import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.Configuration; import com.segment.publicapi.auth.*; import com.segment.publicapi.models.*; -import com.segment.publicapi.api.ApiCallsApi; +import com.segment.publicapi.api.SourcesApi; +import com.segment.publicapi.api.WorkspacesApi; +import java.math.BigDecimal; public class Example { public static void main(String[] args) { @@ -99,20 +83,43 @@ public class Example { // Configure HTTP bearer authorization: token HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); - token.setBearerToken("BEARER TOKEN"); + token.setBearerToken(""); + + ActivationsApi apiInstance = new ActivationsApi(defaultClient); + String spaceId = "spa_9aQ1Lj62S4bomZKLF4DPqW"; // String | + String audienceId = "aud_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + String connectionId = "ii_123456789"; // String | + AddActivationToAudienceAlphaInput addActivationToAudienceAlphaInput = new AddActivationToAudienceAlphaInput(); // AddActivationToAudienceAlphaInput | + + // Make an API call without Pagination + try { + WorkspacesApi apiInstance = new WorkspacesApi(defaultClient); + GetWorkspace200Response workspaceResponse = apiInstance.getWorkspace(); + } catch (ApiException e) { + System.err.println("Exception when calling WorkspacesApi#getWorkspace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } - ApiCallsApi apiInstance = new ApiCallsApi(defaultClient); - String period = "period_example"; // String | The start of the usage month in the ISO-8601 format. This parameter exists in alpha. - PaginationInput pagination = new HashMap(); // PaginationInput | Pagination input for per Source API calls counts. This parameter exists in alpha. + // Make an API call with Pagination try { - GetDailyPerSourceAPICallsUsage200Response result = apiInstance.getDailyPerSourceAPICallsUsage(period, pagination); - System.out.println(result); + SourcesApi sourceApiInstance = new SourcesApi(defaultClient); + PaginationInput paginationInput = new PaginationInput(); + paginationInput.count(BigDecimal.valueOf(20)); + String current = null; + do { + paginationInput.setCursor(current); + ListSources200Response sourcesResponse = sourceApiInstance.listSources(paginationInput); + current = sourcesResponse.getData().getPagination().getNext(); + } while(current != null); } catch (ApiException e) { - System.err.println("Exception when calling ApiCallsApi#getDailyPerSourceAPICallsUsage"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); + System.err.println("Exception when calling SourcesApi#sourceApiInstance"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -123,7 +130,6 @@ public class Example { It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. -## Author - -friends@segment.com +## Contributing +The contents of this repository are automatically generated, so we can't take contributions from external developers. If you have any issues with this SDK, please raise an issue or reach out to friends@segment.com instead of opening a pull request. Pull requests will not be reviewed. diff --git a/api/openapi.yaml b/api/openapi.yaml deleted file mode 100644 index 4fd71354..00000000 --- a/api/openapi.yaml +++ /dev/null @@ -1,33314 +0,0 @@ -openapi: 3.0.3 -info: - contact: - email: friends@segment.com - name: Segment - url: https://docs.segmentapis.com - description: "The Segment Public API helps you manage your Segment Workspaces and\ - \ its resources. You can use the API to perform CRUD (create, read, update, delete)\ - \ operations at no extra charge. This includes working with resources such as\ - \ Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations\ - \ and Sources Catalogs.\n\nAll CRUD endpoints in the API follow REST conventions\ - \ and use standard HTTP methods. Different URL endpoints represent different resources\ - \ in a Workspace.\n\nSee the next sections for more information on how to use\ - \ the Segment Public API.\n" - title: Segment Public API - version: 32.0.2 - x-logo: - url: https://brand.segment.com/site-assets/images/brand-guidelines/content/twilio/twilio-segment-logo.png - backgroundColor: '#ebf4ff' - altText: Twilio Segment logo -servers: -- description: Production - url: https://api.segmentapis.com -- description: Staging - url: https://api.segmentapis.build -security: -- token: [] -tags: -- description: Operations related to Warehouses - name: Warehouses -- description: Operations related to Sources - name: Sources -- description: Operations related to IAM Users - name: IAM Users -- description: Operations related to IAM Groups - name: IAM Groups -- description: Operations related to Tracking Plans - name: Tracking Plans -- description: Operations related to Spaces - name: Spaces -- description: Operations related to Deletion and Suppression - name: Deletion and Suppression -- description: Operations related to Destinations - name: Destinations -- description: Operations related to Edge Functions - name: Edge Functions -- description: Operations related to Destination Filters - name: Destination Filters -- description: Operations related to Functions - name: Functions -- description: Operations related to Labels - name: Labels -- description: Operations related to Transformations - name: Transformations -- description: Operations related to Testing - name: Testing -- description: Operations related to Selective Sync - name: Selective Sync -- description: Operations related to API Calls - name: API Calls -- description: Operations related to Monthly Tracked Users - name: Monthly Tracked Users -- description: Operations related to Catalog - name: Catalog -- description: Operations related to Events - name: Events -- description: Operations related to Workspaces - name: Workspaces -- description: Operations related to Audit Trail - name: Audit Trail -- description: Operations related to IAM Roles - name: IAM Roles -paths: - /warehouses/{warehouseId}/connected-sources/{sourceId}: - delete: - deprecated: false - description: Disconnects a Source from a Warehouse. - operationId: removeSourceConnectionFromWarehouse - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeSourceConnectionFromWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeSourceConnectionFromWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeSourceConnectionFromWarehouse_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeSourceConnectionFromWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Remove Source Connection from Warehouse - tags: - - Warehouses - x-domain-hierarchy: - - Connections - - Warehouses - x-accepts: application/json - post: - deprecated: false - description: "Connects a Source to a Warehouse.\n\n\n\nWhen called, this endpoint\ - \ may generate the `Storage Destination Modified` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n " - operationId: addConnectionFromSourceToWarehouse - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: CONNECTED - schema: - $ref: '#/components/schemas/addConnectionFromSourceToWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: CONNECTED - schema: - $ref: '#/components/schemas/addConnectionFromSourceToWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - status: CONNECTED - schema: - $ref: '#/components/schemas/addConnectionFromSourceToWarehouse_200_response' - application/json: - example: - data: - status: CONNECTED - schema: - $ref: '#/components/schemas/addConnectionFromSourceToWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Add Connection from Source to Warehouse - tags: - - Warehouses - x-domain-hierarchy: - - Connections - - Warehouses - x-accepts: application/json - /sources/{sourceId}/labels: - post: - deprecated: false - description: "Adds an existing label to a Source.\n\n\n\nWhen called, this endpoint\ - \ may generate the `Source Modified` [Audit Trail](/tag/Audit-Trail) event.\n\ - \ " - operationId: addLabelsToSource - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - sourceId: rh5BDZp6QDHvXFCkibm1pR - labels: - - key: type - value: web - schema: - $ref: '#/components/schemas/AddLabelsToSourceAlphaInput' - application/vnd.segment.v1beta+json: - example: - sourceId: rh5BDZp6QDHvXFCkibm1pR - labels: - - key: type - value: web - schema: - $ref: '#/components/schemas/AddLabelsToSourceV1Input' - application/vnd.segment.v1+json: - example: - sourceId: rh5BDZp6QDHvXFCkibm1pR - labels: - - key: type - value: web - schema: - $ref: '#/components/schemas/AddLabelsToSourceV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - labels: - - key: type - value: web - schema: - $ref: '#/components/schemas/addLabelsToSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - labels: - - key: type - value: web - - key: environment - value: prod - schema: - $ref: '#/components/schemas/addLabelsToSource_200_response_1' - application/vnd.segment.v1+json: - example: - data: - labels: - - key: type - value: web - - key: environment - value: prod - schema: - $ref: '#/components/schemas/addLabelsToSource_200_response_1' - application/json: - example: - data: - labels: - - key: type - value: web - - key: environment - value: prod - schema: - $ref: '#/components/schemas/addLabelsToSource_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Add Labels to Source - tags: - - Sources - x-domain-hierarchy: - - Connections - - Sources - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - put: - deprecated: false - description: Replaces all labels in a Source. - operationId: replaceLabelsInSource - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - sourceId: rh5BDZp6QDHvXFCkibm1pR - labels: - - key: environment - value: prod - schema: - $ref: '#/components/schemas/ReplaceLabelsInSourceAlphaInput' - application/vnd.segment.v1beta+json: - example: - sourceId: rh5BDZp6QDHvXFCkibm1pR - labels: - - key: environment - value: prod - schema: - $ref: '#/components/schemas/ReplaceLabelsInSourceV1Input' - application/vnd.segment.v1+json: - example: - sourceId: rh5BDZp6QDHvXFCkibm1pR - labels: - - key: environment - value: prod - schema: - $ref: '#/components/schemas/ReplaceLabelsInSourceV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - labels: - - key: environment - value: prod - schema: - $ref: '#/components/schemas/replaceLabelsInSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - labels: - - key: environment - value: prod - schema: - $ref: '#/components/schemas/replaceLabelsInSource_200_response_1' - application/vnd.segment.v1+json: - example: - data: - labels: - - key: environment - value: prod - schema: - $ref: '#/components/schemas/replaceLabelsInSource_200_response_1' - application/json: - example: - data: - labels: - - key: environment - value: prod - schema: - $ref: '#/components/schemas/replaceLabelsInSource_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Replace Labels in Source - tags: - - Sources - x-domain-hierarchy: - - Connections - - Sources - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /users/{userId}/permissions: - post: - deprecated: false - description: "Adds a list of access permissions to a user.\n\nWhen called, this\ - \ endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail)\ - \ events:\n* Policy Created\n* User Policy Updated\n \n\n\nThe rate limit\ - \ for this endpoint is 60 requests per minute, which is lower than the default\ - \ due to access pattern restrictions. Once reached, this endpoint will respond\ - \ with the 429 HTTP status code with headers indicating the limit parameters.\ - \ See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: addPermissionsToUser - parameters: - - explode: false - in: path - name: userId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - userId: sgJDWk3K21k6LE3tLU9nRK - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/AddPermissionsToUserV1Input' - application/vnd.segment.v1beta+json: - example: - userId: sgJDWk3K21k6LE3tLU9nRK - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/AddPermissionsToUserV1Input' - application/vnd.segment.v1+json: - example: - userId: sgJDWk3K21k6LE3tLU9nRK - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/AddPermissionsToUserV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - permissions: - - policyId: 2Qyqtmy96fq1iV81Ax6W9f - roleName: Workspace Owner - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - subjectId: sgJDWk3K21k6LE3tLU9nRK - subjectType: user - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/addPermissionsToUser_200_response' - application/vnd.segment.v1beta+json: - example: - data: - permissions: - - policyId: 2DrXoOPQa1eaYu1fjfmYT2A3n1g - roleName: Workspace Owner - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - subjectId: sgJDWk3K21k6LE3tLU9nRK - subjectType: user - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/addPermissionsToUser_200_response' - application/vnd.segment.v1+json: - example: - data: - permissions: - - policyId: 2DrXp6Tx3Lcba6CvSqnwyiX5SDH - roleName: Workspace Owner - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - subjectId: sgJDWk3K21k6LE3tLU9nRK - subjectType: user - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/addPermissionsToUser_200_response' - application/json: - example: - data: - permissions: - - policyId: 2DrXp6Tx3Lcba6CvSqnwyiX5SDH - roleName: Workspace Owner - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - subjectId: sgJDWk3K21k6LE3tLU9nRK - subjectType: user - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/addPermissionsToUser_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Add Permissions to User - tags: - - IAM Users - x-domain-hierarchy: - - Admin - - IAM Users - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - put: - deprecated: false - description: "Updates the list of access permissions for a user.\n\n\n\nWhen\ - \ called, this endpoint may generate the `Policy Deleted` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n \n\n\nThe rate limit for this endpoint is 60 requests per\ - \ minute, which is lower than the default due to access pattern restrictions.\ - \ Once reached, this endpoint will respond with the 429 HTTP status code with\ - \ headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits)\ - \ for more information." - operationId: replacePermissionsForUser - parameters: - - explode: false - in: path - name: userId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - userId: sgJDWk3K21k6LE3tLU9nRK - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/ReplacePermissionsForUserV1Input' - application/vnd.segment.v1beta+json: - example: - userId: sgJDWk3K21k6LE3tLU9nRK - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/ReplacePermissionsForUserV1Input' - application/vnd.segment.v1+json: - example: - userId: sgJDWk3K21k6LE3tLU9nRK - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/ReplacePermissionsForUserV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/replacePermissionsForUser_200_response' - application/vnd.segment.v1beta+json: - example: - data: - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/replacePermissionsForUser_200_response' - application/vnd.segment.v1+json: - example: - data: - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/replacePermissionsForUser_200_response' - application/json: - example: - data: - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/replacePermissionsForUser_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Replace Permissions for User - tags: - - IAM Users - x-domain-hierarchy: - - Admin - - IAM Users - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /groups/{userGroupId}/permissions: - post: - deprecated: false - description: "Adds a list of access permissions to a user group.\n\nWhen called,\ - \ this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail)\ - \ events:\n* Policy Created\n* User Group Policy Updated\n \n\n\nThe\ - \ rate limit for this endpoint is 60 requests per minute, which is lower than\ - \ the default due to access pattern restrictions. Once reached, this endpoint\ - \ will respond with the 429 HTTP status code with headers indicating the limit\ - \ parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: addPermissionsToUserGroup - parameters: - - explode: false - in: path - name: userGroupId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - userGroupId: bBABwqbaDf2QdwTbW8bNEm - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/AddPermissionsToUserGroupV1Input' - application/vnd.segment.v1beta+json: - example: - userGroupId: bBABwqbaDf2QdwTbW8bNEm - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/AddPermissionsToUserGroupV1Input' - application/vnd.segment.v1+json: - example: - userGroupId: bBABwqbaDf2QdwTbW8bNEm - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/AddPermissionsToUserGroupV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - permissions: - - policyId: 2DrXoTM7Kxb1rCTZhRko40oN8e0 - roleName: Workspace Owner - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - subjectId: bBABwqbaDf2QdwTbW8bNEm - subjectType: group - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/addPermissionsToUserGroup_200_response' - application/vnd.segment.v1beta+json: - example: - data: - permissions: - - policyId: 2DrXpCP88iCLEsmGa9SSrei1C6o - roleName: Workspace Owner - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - subjectId: bBABwqbaDf2QdwTbW8bNEm - subjectType: group - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/addPermissionsToUserGroup_200_response' - application/vnd.segment.v1+json: - example: - data: - permissions: - - policyId: 2DrXqK6YSJGtQs9PJHcMSneAWIZ - roleName: Workspace Owner - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - subjectId: bBABwqbaDf2QdwTbW8bNEm - subjectType: group - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/addPermissionsToUserGroup_200_response' - application/json: - example: - data: - permissions: - - policyId: 2DrXqK6YSJGtQs9PJHcMSneAWIZ - roleName: Workspace Owner - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - subjectId: bBABwqbaDf2QdwTbW8bNEm - subjectType: group - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/addPermissionsToUserGroup_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Add Permissions to User Group - tags: - - IAM Groups - x-domain-hierarchy: - - Admin - - IAM Groups - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - put: - deprecated: false - description: "Updates the list of access permissions for a user group.\n\n\n\ - \nWhen called, this endpoint may generate the `Policy Deleted` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n \n\n\nThe rate limit for this endpoint is 60 requests per\ - \ minute, which is lower than the default due to access pattern restrictions.\ - \ Once reached, this endpoint will respond with the 429 HTTP status code with\ - \ headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits)\ - \ for more information." - operationId: replacePermissionsForUserGroup - parameters: - - explode: false - in: path - name: userGroupId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - userGroupId: bBABwqbaDf2QdwTbW8bNEm - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/ReplacePermissionsForUserGroupV1Input' - application/vnd.segment.v1beta+json: - example: - userGroupId: bBABwqbaDf2QdwTbW8bNEm - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/ReplacePermissionsForUserGroupV1Input' - application/vnd.segment.v1+json: - example: - userGroupId: bBABwqbaDf2QdwTbW8bNEm - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/ReplacePermissionsForUserGroupV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/replacePermissionsForUserGroup_200_response' - application/vnd.segment.v1beta+json: - example: - data: - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/replacePermissionsForUserGroup_200_response' - application/vnd.segment.v1+json: - example: - data: - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/replacePermissionsForUserGroup_200_response' - application/json: - example: - data: - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/replacePermissionsForUserGroup_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Replace Permissions for User Group - tags: - - IAM Groups - x-domain-hierarchy: - - Admin - - IAM Groups - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /tracking-plans/{trackingPlanId}/sources: - delete: - deprecated: false - description: "Disconnects a Source from a Tracking Plan.\n\n\n\nWhen called,\ - \ this endpoint may generate the `Source Modified` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n**Note**: In order to successfully call this endpoint, the specified\ - \ Workspace needs to have the Protocols feature enabled. Please reach out\ - \ to your customer success manager for more information." - operationId: removeSourceFromTrackingPlan - parameters: - - explode: false - in: path - name: trackingPlanId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: "The id of the Source associated with the Tracking Plan.\n\n\ - Config API note: analogous to `sourceName`.\n\nThis parameter exists in\ - \ alpha." - explode: false - in: query - name: sourceId - required: true - schema: - description: "The id of the Source associated with the Tracking Plan.\n\n\ - Config API note: analogous to `sourceName`." - title: sourceId - type: string - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeSourceFromTrackingPlan_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeSourceFromTrackingPlan_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeSourceFromTrackingPlan_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeSourceFromTrackingPlan_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Remove Source from Tracking Plan - tags: - - Tracking Plans - x-domain-hierarchy: - - Protocols - - Tracking Plans - x-accepts: application/json - get: - deprecated: false - description: "Lists Sources connected to a Tracking Plan.\n\n**Note**: In order\ - \ to successfully call this endpoint, the specified Workspace needs to have\ - \ the Protocols feature enabled. Please reach out to your customer success\ - \ manager for more information.\n\n\nThis endpoint requires the user to have\ - \ at least the following permission(s): \n * Source Read-only\n * Tracking\ - \ Plan Read-only" - operationId: listSourcesFromTrackingPlan - parameters: - - explode: false - in: path - name: trackingPlanId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Pagination options. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - sources: - - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listSourcesFromTrackingPlan_200_response' - application/vnd.segment.v1beta+json: - example: - data: - sources: - - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listSourcesFromTrackingPlan_200_response' - application/vnd.segment.v1+json: - example: - data: - sources: - - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listSourcesFromTrackingPlan_200_response' - application/json: - example: - data: - sources: - - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listSourcesFromTrackingPlan_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Sources from Tracking Plan - tags: - - Tracking Plans - x-domain-hierarchy: - - Protocols - - Tracking Plans - x-accepts: application/json - post: - deprecated: false - description: "Connects a Source to a Tracking Plan.\n\n\n\nWhen called, this\ - \ endpoint may generate the `Source Modified` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n**Note**: In order to successfully call this endpoint, the specified\ - \ Workspace needs to have the Protocols feature enabled. Please reach out\ - \ to your customer success manager for more information." - operationId: addSourceToTrackingPlan - parameters: - - explode: false - in: path - name: trackingPlanId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - trackingPlanId: tp_sprout_rVGCC6WdrNxjCf6JpCHP - sourceId: qQEHquLrjRDN9j1ByrChyn - schema: - $ref: '#/components/schemas/AddSourceToTrackingPlanV1Input' - application/vnd.segment.v1beta+json: - example: - trackingPlanId: tp_sprout_rVGCC6WdrNxjCf6JpCHP - sourceId: qQEHquLrjRDN9j1ByrChyn - schema: - $ref: '#/components/schemas/AddSourceToTrackingPlanV1Input' - application/vnd.segment.v1+json: - example: - trackingPlanId: tp_sprout_rVGCC6WdrNxjCf6JpCHP - sourceId: qQEHquLrjRDN9j1ByrChyn - schema: - $ref: '#/components/schemas/AddSourceToTrackingPlanV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/addSourceToTrackingPlan_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/addSourceToTrackingPlan_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/addSourceToTrackingPlan_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/addSourceToTrackingPlan_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Add Source to Tracking Plan - tags: - - Tracking Plans - x-domain-hierarchy: - - Protocols - - Tracking Plans - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /groups/{userGroupId}/users: - get: - deprecated: false - description: Returns users belonging to a user group. - operationId: listUsersFromUserGroup - parameters: - - explode: false - in: path - name: userGroupId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Pagination for members of a group. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - users: - - id: sgJDWk3K21k6LE3tLU9nRK - email: papi@segment.com - name: "" - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listUsersFromUserGroup_200_response' - application/vnd.segment.v1beta+json: - example: - data: - users: [] - pagination: - current: MA== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listUsersFromUserGroup_200_response' - application/vnd.segment.v1+json: - example: - data: - users: [] - pagination: - current: MA== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listUsersFromUserGroup_200_response' - application/json: - example: - data: - users: [] - pagination: - current: MA== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listUsersFromUserGroup_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Users from User Group - tags: - - IAM Groups - x-domain-hierarchy: - - Admin - - IAM Groups - x-accepts: application/json - post: - deprecated: false - description: "Adds a list of users or invites to a user group.\n\nWhen called,\ - \ this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail)\ - \ events:\n* Subjects Added to Group\n* User Added To User Group\n \n\ - \n\nThe rate limit for this endpoint is 60 requests per minute, which is lower\ - \ than the default due to access pattern restrictions. Once reached, this\ - \ endpoint will respond with the 429 HTTP status code with headers indicating\ - \ the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: addUsersToUserGroup - parameters: - - explode: false - in: path - name: userGroupId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - userGroupId: bBABwqbaDf2QdwTbW8bNEm - emails: - - foo@example.com - schema: - $ref: '#/components/schemas/AddUsersToUserGroupV1Input' - application/vnd.segment.v1beta+json: - example: - userGroupId: bBABwqbaDf2QdwTbW8bNEm - emails: - - foo@example.com - schema: - $ref: '#/components/schemas/AddUsersToUserGroupV1Input' - application/vnd.segment.v1+json: - example: - userGroupId: bBABwqbaDf2QdwTbW8bNEm - emails: - - foo@example.com - schema: - $ref: '#/components/schemas/AddUsersToUserGroupV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 2 - schema: - $ref: '#/components/schemas/addUsersToUserGroup_200_response' - application/vnd.segment.v1beta+json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 1 - schema: - $ref: '#/components/schemas/addUsersToUserGroup_200_response' - application/vnd.segment.v1+json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 1 - schema: - $ref: '#/components/schemas/addUsersToUserGroup_200_response' - application/json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 1 - schema: - $ref: '#/components/schemas/addUsersToUserGroup_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Add Users to User Group - tags: - - IAM Groups - x-domain-hierarchy: - - Admin - - IAM Groups - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /spaces/{spaceId}/messaging-subscriptions/batch: - post: - deprecated: false - description: Get Messaging Subscriptions for space. - operationId: batchQueryMessagingSubscriptionsForSpace - parameters: - - explode: false - in: path - name: spaceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - spaceId: 9aQ1Lj62S4bomZKLF4DPqW - subscriptions: - - key: test@email.com - type: EMAIL - - key: pgibbonsexample.com - type: EMAIL - - key: +12162226233 - type: SMS - - key: "11" - type: SMS - schema: - $ref: '#/components/schemas/BatchQueryMessagingSubscriptionsForSpaceAlphaInput' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - successes: - - key: jacob@exmple.com - type: EMAIL - status: SUBSCRIBED - - key: "2162226233" - type: SMS - status: DID_NOT_SUBSCRIBE - failures: - - key: pgibbonsexample.com - type: EMAIL - errors: - - code: INVALID_EMAIL - message: Email is not valid - schema: - $ref: '#/components/schemas/batchQueryMessagingSubscriptionsForSpace_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Batch Query Messaging Subscriptions for Space - tags: - - Spaces - x-domain-hierarchy: - - Engage - - Spaces - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /regulations/cloudsources/{sourceId}: - post: - deprecated: false - description: "Creates a Source-scoped regulation.\n\n Config API omitted\ - \ fields:\n- `attributes`,\n- `userAgent`\n " - operationId: createCloudSourceRegulation - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - regulationType: SUPPRESS_ONLY - subjectType: OBJECT_ID - subjectIds: - - test_object_id - sourceId: qQEHquLrjRDN9j1ByrChyn - collection: some-app-collection - schema: - $ref: '#/components/schemas/CreateCloudSourceRegulationV1Input' - application/vnd.segment.v1beta+json: - example: - regulationType: SUPPRESS_ONLY - subjectType: OBJECT_ID - subjectIds: - - test_object_id - sourceId: qQEHquLrjRDN9j1ByrChyn - collection: some-app-collection - schema: - $ref: '#/components/schemas/CreateCloudSourceRegulationV1Input' - application/vnd.segment.v1+json: - example: - regulationType: SUPPRESS_ONLY - subjectType: OBJECT_ID - subjectIds: - - test_object_id - sourceId: qQEHquLrjRDN9j1ByrChyn - collection: some-app-collection - schema: - $ref: '#/components/schemas/CreateCloudSourceRegulationV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - regulateId: 1qJkfE1tpwvQcklImGksLN629wn - schema: - $ref: '#/components/schemas/createCloudSourceRegulation_200_response' - application/vnd.segment.v1beta+json: - example: - data: - regulateId: 1qJkfE1tpwvQcklImGksLN629wn - schema: - $ref: '#/components/schemas/createCloudSourceRegulation_200_response' - application/vnd.segment.v1+json: - example: - data: - regulateId: 1qJkfE1tpwvQcklImGksLN629wn - schema: - $ref: '#/components/schemas/createCloudSourceRegulation_200_response' - application/json: - example: - data: - regulateId: 1qJkfE1tpwvQcklImGksLN629wn - schema: - $ref: '#/components/schemas/createCloudSourceRegulation_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Cloud Source Regulation - tags: - - Deletion and Suppression - x-domain-hierarchy: - - Connections - - Deletion and Suppression - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /destinations: - get: - deprecated: false - description: Returns a list of Destinations. - operationId: listDestinations - parameters: - - description: |- - Required pagination params for the request. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - destinations: - - id: 5GFhvtz8fha42Cm4B9E6L8 - enabled: true - name: "" - settings: - region: us-west - roleAddress: arn::... - secretId: secrettt - stream: bla - metadata: - id: 57da359580412f644ff33fb9 - name: Amazon Kinesis - description: "Amazon Kinesis Streams enables you to build custom\ - \ applications that process or analyze streaming data for\ - \ specialized needs. Amazon Kinesis Streams can continuously\ - \ capture and store terabytes of data per hour from hundreds\ - \ of thousands of sources such as website clickstreams, financial\ - \ transactions, social media feeds, IT logs, and location-tracking\ - \ events." - slug: amazon-kinesis - logos: - default: https://cdn.filepicker.io/api/file/qr7D6jkLQvd1KAJlY8Zp - mark: https://cdn.filepicker.io/api/file/zLZbfcBeSZTfX4CsgBvA - options: - - name: region - type: string - defaultValue: us-west-2 - description: The Kinesis Stream's AWS region key - required: true - label: AWS Kinesis Stream Region - - name: roleAddress - type: string - defaultValue: "" - description: "The address of the AWS role that will be writing\ - \ to Kinesis (ex: arn:aws:iam::874699288871:role/example-role)" - required: true - label: Role Address - - name: secretId - type: string - defaultValue: '#SEGMENT_WORKSPACE_ID' - description: The External ID to your IAM role. This value - is read-only. Reach out to support if you wish to change - it. This value is also a secret and should be treated as - a password. - required: true - label: Secret ID (Read-Only) - - name: stream - type: string - defaultValue: "" - description: The Kinesis Stream Name - required: true - label: AWS Kinesis Stream Name - - name: useMessageId - type: boolean - defaultValue: false - description: "You can enable this option if you want to use\ - \ the Segment generated `messageId` for the **Partition\ - \ Key**. If you have issues with too many `provisionedthroughputexceededexceptions`\ - \ errors, this means that your Segment events are not being\ - \ evenly distributed across your buckets as you do not have\ - \ even user event distribution (*default partition key is\ - \ `userId` or `anonymousId`*). This option should provide\ - \ much more stable and even distribution." - required: false - label: Use Segment Message ID - status: PUBLIC - categories: - - Analytics - - Raw Data - website: https://aws.amazon.com/kinesis/streams/ - components: - - code: https://github.com/segmentio/integrations/tree/master/integrations/amazon-kinesis - type: SERVER - previousNames: - - Amazon Kinesis - supportedMethods: - track: true - pageview: true - identify: true - group: true - alias: true - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: true - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - pagination: - current: MA== - next: MQ== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listDestinations_200_response' - application/vnd.segment.v1beta+json: - example: - data: - destinations: - - id: 5GFhvtz8fha42Cm4B9E6L8 - enabled: true - name: "" - settings: - region: us-west - roleAddress: arn::... - secretId: secrettt - stream: bla - metadata: - id: 57da359580412f644ff33fb9 - name: Amazon Kinesis - description: "Amazon Kinesis Streams enables you to build custom\ - \ applications that process or analyze streaming data for\ - \ specialized needs. Amazon Kinesis Streams can continuously\ - \ capture and store terabytes of data per hour from hundreds\ - \ of thousands of sources such as website clickstreams, financial\ - \ transactions, social media feeds, IT logs, and location-tracking\ - \ events." - slug: amazon-kinesis - logos: - default: https://cdn.filepicker.io/api/file/qr7D6jkLQvd1KAJlY8Zp - mark: https://cdn.filepicker.io/api/file/zLZbfcBeSZTfX4CsgBvA - options: - - name: region - type: string - defaultValue: us-west-2 - description: The Kinesis Stream's AWS region key - required: true - label: AWS Kinesis Stream Region - - name: roleAddress - type: string - defaultValue: "" - description: "The address of the AWS role that will be writing\ - \ to Kinesis (ex: arn:aws:iam::874699288871:role/example-role)" - required: true - label: Role Address - - name: secretId - type: string - defaultValue: '#SEGMENT_WORKSPACE_ID' - description: The External ID to your IAM role. This value - is read-only. Reach out to support if you wish to change - it. This value is also a secret and should be treated as - a password. - required: true - label: Secret ID (Read-Only) - - name: stream - type: string - defaultValue: "" - description: The Kinesis Stream Name - required: true - label: AWS Kinesis Stream Name - - name: useMessageId - type: boolean - defaultValue: false - description: "You can enable this option if you want to use\ - \ the Segment generated `messageId` for the **Partition\ - \ Key**. If you have issues with too many `provisionedthroughputexceededexceptions`\ - \ errors, this means that your Segment events are not being\ - \ evenly distributed across your buckets as you do not have\ - \ even user event distribution (*default partition key is\ - \ `userId` or `anonymousId`*). This option should provide\ - \ much more stable and even distribution." - required: false - label: Use Segment Message ID - status: PUBLIC - categories: - - Analytics - - Raw Data - website: https://aws.amazon.com/kinesis/streams/ - components: - - code: https://github.com/segmentio/integrations/tree/master/integrations/amazon-kinesis - type: SERVER - previousNames: - - Amazon Kinesis - supportedMethods: - track: true - pageview: true - identify: true - group: true - alias: true - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: true - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - pagination: - current: MA== - next: MQ== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listDestinations_200_response' - application/vnd.segment.v1+json: - example: - data: - destinations: - - id: 5GFhvtz8fha42Cm4B9E6L8 - enabled: true - name: "" - settings: - region: us-west - roleAddress: arn::... - secretId: secrettt - stream: bla - metadata: - id: 57da359580412f644ff33fb9 - name: Amazon Kinesis - description: "Amazon Kinesis Streams enables you to build custom\ - \ applications that process or analyze streaming data for\ - \ specialized needs. Amazon Kinesis Streams can continuously\ - \ capture and store terabytes of data per hour from hundreds\ - \ of thousands of sources such as website clickstreams, financial\ - \ transactions, social media feeds, IT logs, and location-tracking\ - \ events." - slug: amazon-kinesis - logos: - default: https://cdn.filepicker.io/api/file/qr7D6jkLQvd1KAJlY8Zp - mark: https://cdn.filepicker.io/api/file/zLZbfcBeSZTfX4CsgBvA - options: - - name: region - type: string - defaultValue: us-west-2 - description: The Kinesis Stream's AWS region key - required: true - label: AWS Kinesis Stream Region - - name: roleAddress - type: string - defaultValue: "" - description: "The address of the AWS role that will be writing\ - \ to Kinesis (ex: arn:aws:iam::874699288871:role/example-role)" - required: true - label: Role Address - - name: secretId - type: string - defaultValue: '#SEGMENT_WORKSPACE_ID' - description: The External ID to your IAM role. This value - is read-only. Reach out to support if you wish to change - it. This value is also a secret and should be treated as - a password. - required: true - label: Secret ID (Read-Only) - - name: stream - type: string - defaultValue: "" - description: The Kinesis Stream Name - required: true - label: AWS Kinesis Stream Name - - name: useMessageId - type: boolean - defaultValue: false - description: "You can enable this option if you want to use\ - \ the Segment generated `messageId` for the **Partition\ - \ Key**. If you have issues with too many `provisionedthroughputexceededexceptions`\ - \ errors, this means that your Segment events are not being\ - \ evenly distributed across your buckets as you do not have\ - \ even user event distribution (*default partition key is\ - \ `userId` or `anonymousId`*). This option should provide\ - \ much more stable and even distribution." - required: false - label: Use Segment Message ID - status: PUBLIC - categories: - - Analytics - - Raw Data - website: https://aws.amazon.com/kinesis/streams/ - components: - - code: https://github.com/segmentio/integrations/tree/master/integrations/amazon-kinesis - type: SERVER - previousNames: - - Amazon Kinesis - supportedMethods: - track: true - pageview: true - identify: true - group: true - alias: true - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: true - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - pagination: - current: MA== - next: MQ== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listDestinations_200_response' - application/json: - example: - data: - destinations: - - id: 5GFhvtz8fha42Cm4B9E6L8 - enabled: true - name: "" - settings: - region: us-west - roleAddress: arn::... - secretId: secrettt - stream: bla - metadata: - id: 57da359580412f644ff33fb9 - name: Amazon Kinesis - description: "Amazon Kinesis Streams enables you to build custom\ - \ applications that process or analyze streaming data for\ - \ specialized needs. Amazon Kinesis Streams can continuously\ - \ capture and store terabytes of data per hour from hundreds\ - \ of thousands of sources such as website clickstreams, financial\ - \ transactions, social media feeds, IT logs, and location-tracking\ - \ events." - slug: amazon-kinesis - logos: - default: https://cdn.filepicker.io/api/file/qr7D6jkLQvd1KAJlY8Zp - mark: https://cdn.filepicker.io/api/file/zLZbfcBeSZTfX4CsgBvA - options: - - name: region - type: string - defaultValue: us-west-2 - description: The Kinesis Stream's AWS region key - required: true - label: AWS Kinesis Stream Region - - name: roleAddress - type: string - defaultValue: "" - description: "The address of the AWS role that will be writing\ - \ to Kinesis (ex: arn:aws:iam::874699288871:role/example-role)" - required: true - label: Role Address - - name: secretId - type: string - defaultValue: '#SEGMENT_WORKSPACE_ID' - description: The External ID to your IAM role. This value - is read-only. Reach out to support if you wish to change - it. This value is also a secret and should be treated as - a password. - required: true - label: Secret ID (Read-Only) - - name: stream - type: string - defaultValue: "" - description: The Kinesis Stream Name - required: true - label: AWS Kinesis Stream Name - - name: useMessageId - type: boolean - defaultValue: false - description: "You can enable this option if you want to use\ - \ the Segment generated `messageId` for the **Partition\ - \ Key**. If you have issues with too many `provisionedthroughputexceededexceptions`\ - \ errors, this means that your Segment events are not being\ - \ evenly distributed across your buckets as you do not have\ - \ even user event distribution (*default partition key is\ - \ `userId` or `anonymousId`*). This option should provide\ - \ much more stable and even distribution." - required: false - label: Use Segment Message ID - status: PUBLIC - categories: - - Analytics - - Raw Data - website: https://aws.amazon.com/kinesis/streams/ - components: - - code: https://github.com/segmentio/integrations/tree/master/integrations/amazon-kinesis - type: SERVER - previousNames: - - Amazon Kinesis - supportedMethods: - track: true - pageview: true - identify: true - group: true - alias: true - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: true - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - pagination: - current: MA== - next: MQ== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listDestinations_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Destinations - tags: - - Destinations - x-domain-hierarchy: - - Connections - - Destinations - x-accepts: application/json - post: - deprecated: false - description: "Creates a new Destination.\n\n\n\nWhen called, this endpoint may\ - \ generate the `Integration Created` [Audit Trail](/tag/Audit-Trail) event.\n\ - \ " - operationId: createDestination - parameters: [] - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - sourceId: rh5BDZp6QDHvXFCkibm1pR - metadataId: 547610a5db31d978f14a5c4e - name: Example destination - settings: - apiKey: XYZ - retarget: true - schema: - $ref: '#/components/schemas/CreateDestinationV1Input' - application/vnd.segment.v1beta+json: - example: - sourceId: rh5BDZp6QDHvXFCkibm1pR - metadataId: 547610a5db31d978f14a5c4e - name: my destination beta - settings: - apiKey: XYZ - retarget: true - schema: - $ref: '#/components/schemas/CreateDestinationV1Input' - application/vnd.segment.v1+json: - example: - sourceId: rh5BDZp6QDHvXFCkibm1pR - metadataId: 547610a5db31d978f14a5c4e - name: my destination v1 - settings: - apiKey: XYZ - retarget: true - schema: - $ref: '#/components/schemas/CreateDestinationV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - destination: - id: 6307d783e53cc188ebad0d02 - enabled: true - name: Example destination - settings: - apiKey: •••••••••• - retarget: true - metadata: - id: 547610a5db31d978f14a5c4e - name: Blueshift - description: "Blueshift's predictive marketing automates behavioral\ - \ messaging on email, push notifications, display, Facebook\ - \ and more" - slug: blueshift - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/Blueshift-default.svg - mark: https://cdn.filepicker.io/api/file/Fqsz0q3QPujUyMACLPLr - options: - - name: apiKey - type: string - defaultValue: "" - description: Your API key can be found in Account Profile - > API Keys - required: true - label: API Key - - name: retarget - type: boolean - defaultValue: false - description: This will retarget page calls on the client-side - required: true - label: Retarget - status: PUBLIC - categories: - - SMS & Push Notifications - - Advertising - - Email Marketing - website: http://getblueshift.com/ - components: - - code: https://github.com/segment-integrations/analytics.js-integration-blueshift - type: BROWSER - - code: https://github.com/segmentio/integrations/tree/master/integrations/blueshift - type: SERVER - previousNames: - - Blueshift - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: true - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/createDestination_200_response' - application/vnd.segment.v1beta+json: - example: - data: - destination: - id: 6307d786e53cc10ae7ad0d04 - enabled: true - name: my destination beta - settings: - apiKey: •••••••••• - retarget: true - metadata: - id: 547610a5db31d978f14a5c4e - name: Blueshift - description: "Blueshift's predictive marketing automates behavioral\ - \ messaging on email, push notifications, display, Facebook\ - \ and more" - slug: blueshift - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/Blueshift-default.svg - mark: https://cdn.filepicker.io/api/file/Fqsz0q3QPujUyMACLPLr - options: - - name: apiKey - type: string - defaultValue: "" - description: Your API key can be found in Account Profile - > API Keys - required: true - label: API Key - - name: retarget - type: boolean - defaultValue: false - description: This will retarget page calls on the client-side - required: true - label: Retarget - status: PUBLIC - categories: - - SMS & Push Notifications - - Advertising - - Email Marketing - website: http://getblueshift.com/ - components: - - code: https://github.com/segment-integrations/analytics.js-integration-blueshift - type: BROWSER - - code: https://github.com/segmentio/integrations/tree/master/integrations/blueshift - type: SERVER - previousNames: - - Blueshift - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: true - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/createDestination_200_response' - application/vnd.segment.v1+json: - example: - data: - destination: - id: 6307d789e53cc13be4ad0d06 - enabled: true - name: my destination v1 - settings: - apiKey: •••••••••• - retarget: true - metadata: - id: 547610a5db31d978f14a5c4e - name: Blueshift - description: "Blueshift's predictive marketing automates behavioral\ - \ messaging on email, push notifications, display, Facebook\ - \ and more" - slug: blueshift - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/Blueshift-default.svg - mark: https://cdn.filepicker.io/api/file/Fqsz0q3QPujUyMACLPLr - options: - - name: apiKey - type: string - defaultValue: "" - description: Your API key can be found in Account Profile - > API Keys - required: true - label: API Key - - name: retarget - type: boolean - defaultValue: false - description: This will retarget page calls on the client-side - required: true - label: Retarget - status: PUBLIC - categories: - - SMS & Push Notifications - - Advertising - - Email Marketing - website: http://getblueshift.com/ - components: - - code: https://github.com/segment-integrations/analytics.js-integration-blueshift - type: BROWSER - - code: https://github.com/segmentio/integrations/tree/master/integrations/blueshift - type: SERVER - previousNames: - - Blueshift - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: true - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/createDestination_200_response' - application/json: - example: - data: - destination: - id: 6307d789e53cc13be4ad0d06 - enabled: true - name: my destination v1 - settings: - apiKey: •••••••••• - retarget: true - metadata: - id: 547610a5db31d978f14a5c4e - name: Blueshift - description: "Blueshift's predictive marketing automates behavioral\ - \ messaging on email, push notifications, display, Facebook\ - \ and more" - slug: blueshift - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/Blueshift-default.svg - mark: https://cdn.filepicker.io/api/file/Fqsz0q3QPujUyMACLPLr - options: - - name: apiKey - type: string - defaultValue: "" - description: Your API key can be found in Account Profile - > API Keys - required: true - label: API Key - - name: retarget - type: boolean - defaultValue: false - description: This will retarget page calls on the client-side - required: true - label: Retarget - status: PUBLIC - categories: - - SMS & Push Notifications - - Advertising - - Email Marketing - website: http://getblueshift.com/ - components: - - code: https://github.com/segment-integrations/analytics.js-integration-blueshift - type: BROWSER - - code: https://github.com/segmentio/integrations/tree/master/integrations/blueshift - type: SERVER - previousNames: - - Blueshift - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: true - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/createDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Destination - tags: - - Destinations - x-domain-hierarchy: - - Connections - - Destinations - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /destinations/{destinationId}/subscriptions: - get: - deprecated: false - description: Lists subscriptions for a Destination. - operationId: listSubscriptionsFromDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Pagination options. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - subscriptions: - - id: eoeXaMeAYcB2XvEApJDrQs - name: Test Subscription - actionId: uD9jEQ4DxJZzhzVqppM7UD - actionSlug: Public API Slug - destinationId: fP7qoQw2HTWt9WdMr718gn - trigger: type = "track" - enabled: true - settings: {} - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listSubscriptionsFromDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Subscriptions from Destination - tags: - - Destinations - x-domain-hierarchy: - - Connections - - Destinations - x-accepts: application/json - post: - deprecated: false - description: Creates a new Destination subscription. - operationId: createDestinationSubscription - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - destinationId: fP7qoQw2HTWt9WdMr718gn - name: Example Subscription - actionId: jiMz7MfHNeHmUckzRnUGkU - trigger: type = "track" - enabled: false - schema: - $ref: '#/components/schemas/CreateDestinationSubscriptionAlphaInput' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - destinationSubscription: - id: ccyWFBVjSkeVKsyc6YrN8U - name: Example Subscription - actionId: jiMz7MfHNeHmUckzRnUGkU - actionSlug: someActionSlug - destinationId: fP7qoQw2HTWt9WdMr718gn - trigger: type = "track" - enabled: false - settings: {} - schema: - $ref: '#/components/schemas/createDestinationSubscription_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Destination Subscription - tags: - - Destinations - x-domain-hierarchy: - - Connections - - Destinations - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /sources/{sourceId}/edge-functions: - post: - deprecated: false - description: "Create EdgeFunctions for your Source, given a valid upload URL\ - \ for an Edge Functions bundle.\n\n**Note**: In order to successfully call\ - \ this endpoint, the specified Workspace needs to have the Edge Functions\ - \ feature enabled. Please reach out to your customer success manager for more\ - \ information.\n " - operationId: createEdgeFunctions - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - sourceId: qQEHquLrjRDN9j1ByrChyn - uploadURL: - schema: - $ref: '#/components/schemas/CreateEdgeFunctionsAlphaInput' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - edgeFunctions: - id: 3b48bd4c-7c2c-4dec-813f-905718290a4c - sourceId: qQEHquLrjRDN9j1ByrChyn - downloadURL: https://cdn.edgefn.segment.build/qQEHquLrjRDN9j1ByrChyn/3b48bd4c-7c2c-4dec-813f-905718290a4c.js - createdBy: sgJDWk3K21k6LE3tLU9nRK - createdAt: 2006-01-02T15:04:05.000Z - version: 1 - schema: - $ref: '#/components/schemas/createEdgeFunctions_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Edge Functions - tags: - - Edge Functions - x-domain-hierarchy: - - Connections - - Edge Functions - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /destination/{destinationId}/filters: - get: - deprecated: false - description: Lists filters for a Destination. - operationId: listFiltersFromDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Pagination options. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - filters: - - id: xx6AySGeFExzdv2Gw2EuhV - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: event = "Order Completed" - actions: - - type: DROP_PROPERTIES - fields: - properties: - - userId - - secretValue - title: Order Completed - description: This filter probably does nothing - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listFiltersFromDestination_200_response' - application/vnd.segment.v1beta+json: - example: - data: - filters: - - id: xx6AySGeFExzdv2Gw2EuhV - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listFiltersFromDestination_200_response' - application/vnd.segment.v1+json: - example: - data: - filters: - - id: xx6AySGeFExzdv2Gw2EuhV - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listFiltersFromDestination_200_response' - application/json: - example: - data: - filters: - - id: xx6AySGeFExzdv2Gw2EuhV - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listFiltersFromDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Filters from Destination - tags: - - Destination Filters - x-domain-hierarchy: - - Connections - - Destination Filters - x-accepts: application/json - post: - deprecated: false - description: "Creates a filter in a Destination.\n\n\n\nWhen called, this endpoint\ - \ may generate the `Destination Filter Created` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n " - operationId: createFilterForDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - title: Filter "Identify" events - description: Drop Identify tracking from this destination - if: type = "identify" - actions: - - type: DROP - enabled: true - schema: - $ref: '#/components/schemas/CreateFilterForDestinationV1Input' - application/vnd.segment.v1beta+json: - example: - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - title: Filter "Identify" events - description: Drop Identify tracking from this destination - if: type = "identify" - actions: - - type: DROP - enabled: true - schema: - $ref: '#/components/schemas/CreateFilterForDestinationV1Input' - application/vnd.segment.v1+json: - example: - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - title: Filter "Identify" events - description: Drop Identify tracking from this destination - if: type = "identify" - actions: - - type: DROP - enabled: true - schema: - $ref: '#/components/schemas/CreateFilterForDestinationV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - filter: - id: 2DrXhZUwilV5MHOwaOTg9NEhGNl - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: type = "identify" - actions: - - type: DROP - title: Filter "Identify" events - description: Drop Identify tracking from this destination - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/createFilterForDestination_200_response' - application/vnd.segment.v1beta+json: - example: - data: - filter: - id: 2DrXi853HCPQrDXWdqxfi5tS1GX - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: type = "identify" - actions: - - type: DROP - title: Filter "Identify" events - description: Drop Identify tracking from this destination - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/createFilterForDestination_200_response' - application/vnd.segment.v1+json: - example: - data: - filter: - id: 2DrXiU3g89bTXEKys3dhDAYAlIk - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: type = "identify" - actions: - - type: DROP - title: Filter "Identify" events - description: Drop Identify tracking from this destination - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/createFilterForDestination_200_response' - application/json: - example: - data: - filter: - id: 2DrXiU3g89bTXEKys3dhDAYAlIk - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: type = "identify" - actions: - - type: DROP - title: Filter "Identify" events - description: Drop Identify tracking from this destination - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/createFilterForDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Filter for Destination - tags: - - Destination Filters - x-domain-hierarchy: - - Connections - - Destination Filters - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /functions: - get: - deprecated: false - description: "Lists all Functions in a Workspace.\n\n**Note**: In order to successfully\ - \ call this endpoint, the specified Workspace needs to have the Functions\ - \ feature enabled. Please reach out to your customer success manager for more\ - \ information." - operationId: listFunctions - parameters: - - description: |- - Pagination parameters. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - - description: "The Function type.\n\nConfig API note: equal to `type`.\n\n\ - This parameter exists in alpha." - explode: false - in: query - name: resourceType - required: true - schema: - description: "The Function type.\n\nConfig API note: equal to `type`." - enum: - - DESTINATION - - SOURCE - title: resourceType - type: string - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - functions: - - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - catalogId: wXzcDGFR3KmjLDrtSawNHf - resourceType: SOURCE - pagination: - current: MQ== - schema: - $ref: '#/components/schemas/listFunctions_200_response' - application/vnd.segment.v1beta+json: - example: - data: - functions: - - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - catalogId: wXzcDGFR3KmjLDrtSawNHf - resourceType: SOURCE - pagination: - current: MQ== - schema: - $ref: '#/components/schemas/listFunctions_200_response' - application/vnd.segment.v1+json: - example: - data: - functions: - - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - catalogId: wXzcDGFR3KmjLDrtSawNHf - resourceType: SOURCE - pagination: - current: MQ== - schema: - $ref: '#/components/schemas/listFunctions_200_response' - application/json: - example: - data: - functions: - - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - catalogId: wXzcDGFR3KmjLDrtSawNHf - resourceType: SOURCE - pagination: - current: MQ== - schema: - $ref: '#/components/schemas/listFunctions_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Functions - tags: - - Functions - x-domain-hierarchy: - - Connections - - Functions - x-accepts: application/json - post: - deprecated: false - description: "Creates a Function.\n\n**Note**: In order to successfully call\ - \ this endpoint, the specified Workspace needs to have the Functions feature\ - \ enabled. Please reach out to your customer success manager for more information." - operationId: createFunction - parameters: [] - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - settings: - - name: apiKey - label: api key - type: STRING - description: api key - required: false - sensitive: false - - name: mySecret - label: my secret key - type: STRING - description: secret key - required: false - sensitive: true - displayName: PAPI Source Function - resourceType: SOURCE - logoUrl: https://placekitten.com/200/139 - description: My source function - schema: - $ref: '#/components/schemas/CreateFunctionV1Input' - application/vnd.segment.v1beta+json: - example: - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - settings: - - name: apiKey - label: api key - type: STRING - description: api key - required: false - sensitive: false - - name: mySecret - label: my secret key - type: STRING - description: secret key - required: false - sensitive: true - displayName: PAPI Source Function - resourceType: SOURCE - logoUrl: https://placekitten.com/200/139 - description: My source function - schema: - $ref: '#/components/schemas/CreateFunctionV1Input' - application/vnd.segment.v1+json: - example: - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - settings: - - name: apiKey - label: api key - type: STRING - description: api key - required: false - sensitive: false - - name: mySecret - label: my secret key - type: STRING - description: secret key - required: false - sensitive: true - displayName: PAPI Source Function - resourceType: SOURCE - logoUrl: https://placekitten.com/200/139 - description: My source function - schema: - $ref: '#/components/schemas/CreateFunctionV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - function: - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - previewWebhookUrl: "" - settings: - - name: apiKey - label: api key - description: api key - type: STRING - required: false - sensitive: false - - name: mySecret - label: my secret key - description: secret key - type: STRING - required: false - sensitive: true - buildpack: "" - catalogId: wXzcDGFR3KmjLDrtSawNHf - batchMaxCount: 0 - resourceType: SOURCE - schema: - $ref: '#/components/schemas/createFunction_200_response' - application/vnd.segment.v1beta+json: - example: - data: - function: - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - previewWebhookUrl: "" - settings: - - name: apiKey - label: api key - description: api key - type: STRING - required: false - sensitive: false - - name: mySecret - label: my secret key - description: secret key - type: STRING - required: false - sensitive: true - buildpack: "" - catalogId: wXzcDGFR3KmjLDrtSawNHf - batchMaxCount: 0 - resourceType: SOURCE - schema: - $ref: '#/components/schemas/createFunction_200_response' - application/vnd.segment.v1+json: - example: - data: - function: - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - previewWebhookUrl: "" - settings: - - name: apiKey - label: api key - description: api key - type: STRING - required: false - sensitive: false - - name: mySecret - label: my secret key - description: secret key - type: STRING - required: false - sensitive: true - buildpack: "" - catalogId: wXzcDGFR3KmjLDrtSawNHf - batchMaxCount: 0 - resourceType: SOURCE - schema: - $ref: '#/components/schemas/createFunction_200_response' - application/json: - example: - data: - function: - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - previewWebhookUrl: "" - settings: - - name: apiKey - label: api key - description: api key - type: STRING - required: false - sensitive: false - - name: mySecret - label: my secret key - description: secret key - type: STRING - required: false - sensitive: true - buildpack: "" - catalogId: wXzcDGFR3KmjLDrtSawNHf - batchMaxCount: 0 - resourceType: SOURCE - schema: - $ref: '#/components/schemas/createFunction_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Function - tags: - - Functions - x-domain-hierarchy: - - Connections - - Functions - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /functions/{functionId}/deploy: - post: - deprecated: false - description: "Deploys a Function. Only applicable to Source Function instances.\n\ - \n**Note**: In order to successfully call this endpoint, the specified Workspace\ - \ needs to have the Functions feature enabled. Please reach out to your customer\ - \ success manager for more information." - operationId: createFunctionDeployment - parameters: - - explode: false - in: path - name: functionId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - functionDeployment: - status: SUCCESS - schema: - $ref: '#/components/schemas/createFunctionDeployment_200_response' - application/vnd.segment.v1beta+json: - example: - data: - functionDeployment: - status: SUCCESS - schema: - $ref: '#/components/schemas/createFunctionDeployment_200_response' - application/vnd.segment.v1+json: - example: - data: - functionDeployment: - status: SUCCESS - schema: - $ref: '#/components/schemas/createFunctionDeployment_200_response' - application/json: - example: - data: - functionDeployment: - status: SUCCESS - schema: - $ref: '#/components/schemas/createFunctionDeployment_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Function Deployment - tags: - - Functions - x-domain-hierarchy: - - Connections - - Functions - x-accepts: application/json - /invites: - delete: - deprecated: false - description: "Removes a list of invitations to join a Workspace.\n\nWhen called,\ - \ this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail)\ - \ events:\n* Invite Deleted\n* Group Memberships Deleted\n \n\n\nThe\ - \ rate limit for this endpoint is 60 requests per minute, which is lower than\ - \ the default due to access pattern restrictions. Once reached, this endpoint\ - \ will respond with the 429 HTTP status code with headers indicating the limit\ - \ parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: deleteInvites - parameters: - - description: |- - The list of emails to delete invites for. - - This parameter exists in alpha. - explode: false - in: query - name: emails - required: true - schema: - description: The list of emails to delete invites for. - items: - type: string - title: emails - type: array - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteInvites_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteInvites_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteInvites_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteInvites_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Delete Invites - tags: - - IAM Users - x-domain-hierarchy: - - Admin - - IAM Users - x-accepts: application/json - get: - deprecated: false - description: | - Returns a list of invitations to join a Workspace. - - Config API omitted fields: - - `parent` - operationId: listInvites - parameters: - - description: |- - Defines the pagination parameters. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - pagination: - current: MA== - totalEntries: 0 - invites: [] - schema: - $ref: '#/components/schemas/listInvites_200_response' - application/vnd.segment.v1beta+json: - example: - data: - pagination: - current: MA== - totalEntries: 1 - invites: - - foo@example.com - schema: - $ref: '#/components/schemas/listInvites_200_response' - application/vnd.segment.v1+json: - example: - data: - pagination: - current: MA== - totalEntries: 1 - invites: - - foo@example.com - schema: - $ref: '#/components/schemas/listInvites_200_response' - application/json: - example: - data: - pagination: - current: MA== - totalEntries: 1 - invites: - - foo@example.com - schema: - $ref: '#/components/schemas/listInvites_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Invites - tags: - - IAM Users - x-domain-hierarchy: - - Admin - - IAM Users - x-accepts: application/json - post: - deprecated: false - description: "Invites a list of users to join a Workspace.\n\nWhen called, this\ - \ endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail)\ - \ events:\n* Non-Segment User Invited to Workspace\n* Policy Created\n* New\ - \ Segment User Invited to Workspace\n\nConfig API omitted fields:\n- `parent`\n\ - \ \n\n\nThe rate limit for this endpoint is 60 requests per minute, which\ - \ is lower than the default due to access pattern restrictions. Once reached,\ - \ this endpoint will respond with the 429 HTTP status code with headers indicating\ - \ the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: createInvites - parameters: [] - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - invites: - - email: foo@example.com - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/CreateInvitesV1Input' - application/vnd.segment.v1beta+json: - example: - invites: - - email: foo@example.com - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/CreateInvitesV1Input' - application/vnd.segment.v1+json: - example: - invites: - - email: foo@example.com - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - schema: - $ref: '#/components/schemas/CreateInvitesV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - emails: - - foo@example.com - schema: - $ref: '#/components/schemas/createInvites_200_response' - application/vnd.segment.v1beta+json: - example: - data: - emails: - - foo@example.com - schema: - $ref: '#/components/schemas/createInvites_200_response' - application/vnd.segment.v1+json: - example: - data: - emails: - - foo@example.com - schema: - $ref: '#/components/schemas/createInvites_200_response' - application/json: - example: - data: - emails: - - foo@example.com - schema: - $ref: '#/components/schemas/createInvites_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Invites - tags: - - IAM Users - x-domain-hierarchy: - - Admin - - IAM Users - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /labels: - get: - deprecated: false - description: Returns a list of all available labels. - operationId: listLabels - parameters: [] - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - labels: - - key: environment - value: dev - description: "" - - key: environment - value: prod - description: "" - schema: - $ref: '#/components/schemas/listLabels_200_response' - application/vnd.segment.v1beta+json: - example: - data: - labels: - - key: environment - value: dev - description: "" - - key: environment - value: prod - description: "" - - key: type - value: web - description: labels source as web - schema: - $ref: '#/components/schemas/listLabels_200_response_1' - application/vnd.segment.v1+json: - example: - data: - labels: - - key: environment - value: dev - description: "" - - key: environment - value: prod - description: "" - - key: type - value: web - description: labels source as web - schema: - $ref: '#/components/schemas/listLabels_200_response_1' - application/json: - example: - data: - labels: - - key: environment - value: dev - description: "" - - key: environment - value: prod - description: "" - - key: type - value: web - description: labels source as web - schema: - $ref: '#/components/schemas/listLabels_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Labels - tags: - - Labels - x-domain-hierarchy: - - Admin - - Labels - x-accepts: application/json - post: - deprecated: false - description: "Creates a new label.\n\n\n\nWhen called, this endpoint may generate\ - \ the `Label Created` [Audit Trail](/tag/Audit-Trail) event.\n \n\n\n\ - The rate limit for this endpoint is 60 requests per minute, which is lower\ - \ than the default due to access pattern restrictions. Once reached, this\ - \ endpoint will respond with the 429 HTTP status code with headers indicating\ - \ the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: createLabel - parameters: [] - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - label: - key: environment - value: yolo - description: an environment for courageous devs - schema: - $ref: '#/components/schemas/CreateLabelAlphaInput' - application/vnd.segment.v1beta+json: - example: - label: - key: environment - value: yolo - description: an environment for courageous devs - schema: - $ref: '#/components/schemas/CreateLabelV1Input' - application/vnd.segment.v1+json: - example: - label: - key: environment - value: yolo - description: an environment for courageous devs - schema: - $ref: '#/components/schemas/CreateLabelV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - labels: - - key: environment - value: dev - description: "" - - key: environment - value: prod - description: "" - - key: environment - value: yolo - description: an environment for courageous devs - schema: - $ref: '#/components/schemas/createLabel_200_response' - application/vnd.segment.v1beta+json: - example: - data: - label: - key: environment - value: yolo - description: an environment for courageous devs - schema: - $ref: '#/components/schemas/createLabel_200_response_1' - application/vnd.segment.v1+json: - example: - data: - label: - key: environment - value: yolo - description: an environment for courageous devs - schema: - $ref: '#/components/schemas/createLabel_200_response_1' - application/json: - example: - data: - label: - key: environment - value: yolo - description: an environment for courageous devs - schema: - $ref: '#/components/schemas/createLabel_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Label - tags: - - Labels - x-domain-hierarchy: - - Admin - - Labels - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /sources: - get: - deprecated: false - description: Returns a list of Sources. - operationId: listSources - parameters: - - description: |- - Defines the pagination parameters. - - This parameter exists in beta. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - sources: - - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - - id: rh5BDZp6QDHvXFCkibm1pR - slug: web - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - dfL8upyPumumx23SjgwHjs - metadata: - id: IqDTy1TpoU - slug: javascript - name: Javascript - categories: - - Website - description: "This is our most flexible and powerful tracking\ - \ system, using analytics.js. Track and analyze information\ - \ about your visitors and customers, and every action that\ - \ they take, in any of our 140 integrations, business intelligence\ - \ tools, or directly with SQL tools." - logos: - default: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - alt: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - mark: https://cdn.filepicker.io/api/file/kBpmEoSSaakidAvoFmzd - options: [] - isCloudEventSource: false - settings: {} - labels: [] - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listSources_200_response' - application/vnd.segment.v1beta+json: - example: - data: - sources: - - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - - id: rh5BDZp6QDHvXFCkibm1pR - slug: web - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - dfL8upyPumumx23SjgwHjs - metadata: - id: IqDTy1TpoU - slug: javascript - name: Javascript - categories: - - Website - description: "This is our most flexible and powerful tracking\ - \ system, using analytics.js. Track and analyze information\ - \ about your visitors and customers, and every action that\ - \ they take, in any of our 140 integrations, business intelligence\ - \ tools, or directly with SQL tools." - logos: - default: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - alt: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - mark: https://cdn.filepicker.io/api/file/kBpmEoSSaakidAvoFmzd - options: [] - isCloudEventSource: false - settings: {} - labels: [] - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listSources_200_response_1' - application/vnd.segment.v1+json: - example: - data: - sources: - - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - - id: rh5BDZp6QDHvXFCkibm1pR - slug: web - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - dfL8upyPumumx23SjgwHjs - metadata: - id: IqDTy1TpoU - slug: javascript - name: Javascript - categories: - - Website - description: "This is our most flexible and powerful tracking\ - \ system, using analytics.js. Track and analyze information\ - \ about your visitors and customers, and every action that\ - \ they take, in any of our 140 integrations, business intelligence\ - \ tools, or directly with SQL tools." - logos: - default: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - alt: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - mark: https://cdn.filepicker.io/api/file/kBpmEoSSaakidAvoFmzd - options: [] - isCloudEventSource: false - settings: {} - labels: [] - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listSources_200_response_1' - application/json: - example: - data: - sources: - - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - - id: rh5BDZp6QDHvXFCkibm1pR - slug: web - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - dfL8upyPumumx23SjgwHjs - metadata: - id: IqDTy1TpoU - slug: javascript - name: Javascript - categories: - - Website - description: "This is our most flexible and powerful tracking\ - \ system, using analytics.js. Track and analyze information\ - \ about your visitors and customers, and every action that\ - \ they take, in any of our 140 integrations, business intelligence\ - \ tools, or directly with SQL tools." - logos: - default: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - alt: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - mark: https://cdn.filepicker.io/api/file/kBpmEoSSaakidAvoFmzd - options: [] - isCloudEventSource: false - settings: {} - labels: [] - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listSources_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Sources - tags: - - Sources - x-domain-hierarchy: - - Connections - - Sources - x-accepts: application/json - post: - deprecated: false - description: "Creates a new Source.\n\n\n\nWhen called, this endpoint may generate\ - \ the `Source Created` [Audit Trail](/tag/Audit-Trail) event.\n " - operationId: createSource - parameters: [] - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - slug: my-test-source-r-dsv2 - name: My Source - enabled: true - metadataId: IqDTy1TpoU - settings: {} - schema: - $ref: '#/components/schemas/CreateSourceAlphaInput' - application/vnd.segment.v1beta+json: - example: - slug: my-test-source-0opjqz - enabled: true - metadataId: IqDTy1TpoU - settings: {} - schema: - $ref: '#/components/schemas/CreateSourceV1Input' - application/vnd.segment.v1+json: - example: - slug: my-test-source-mc1fgb - enabled: true - metadataId: IqDTy1TpoU - settings: {} - schema: - $ref: '#/components/schemas/CreateSourceV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - source: - id: 3aJbFPLDssh5dtKjy3Drnh - slug: my-test-source-r-dsv2 - name: My Source - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - wS1qvVNUj2TaBZFR52sT5GS7jxdDSUM8 - metadata: - id: IqDTy1TpoU - slug: javascript - name: Javascript - categories: - - Website - description: "This is our most flexible and powerful tracking\ - \ system, using analytics.js. Track and analyze information\ - \ about your visitors and customers, and every action that\ - \ they take, in any of our 140 integrations, business intelligence\ - \ tools, or directly with SQL tools." - logos: - default: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - alt: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - mark: https://cdn.filepicker.io/api/file/kBpmEoSSaakidAvoFmzd - options: [] - isCloudEventSource: false - settings: {} - labels: [] - schema: - $ref: '#/components/schemas/createSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - source: - id: rDZmA3w42mgu11iknATJPu - slug: my-test-source-0opjqz - name: my-test-source-0opjqz - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - fUFKUhoKPWKcXDIUfV7zvikbWwLbDYTL - metadata: - id: IqDTy1TpoU - slug: javascript - name: Javascript - categories: - - Website - description: "This is our most flexible and powerful tracking\ - \ system, using analytics.js. Track and analyze information\ - \ about your visitors and customers, and every action that\ - \ they take, in any of our 140 integrations, business intelligence\ - \ tools, or directly with SQL tools." - logos: - default: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - alt: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - mark: https://cdn.filepicker.io/api/file/kBpmEoSSaakidAvoFmzd - options: [] - isCloudEventSource: false - settings: {} - labels: [] - schema: - $ref: '#/components/schemas/createSource_200_response_1' - application/vnd.segment.v1+json: - example: - data: - source: - id: b3nk6CisJ6zQVKb9KjbFjV - slug: my-test-source-mc1fgb - name: my-test-source-mc1fgb - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - IGA8Ur1riMfSQeAbHNKua70oMagjBuu8 - metadata: - id: IqDTy1TpoU - slug: javascript - name: Javascript - categories: - - Website - description: "This is our most flexible and powerful tracking\ - \ system, using analytics.js. Track and analyze information\ - \ about your visitors and customers, and every action that\ - \ they take, in any of our 140 integrations, business intelligence\ - \ tools, or directly with SQL tools." - logos: - default: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - alt: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - mark: https://cdn.filepicker.io/api/file/kBpmEoSSaakidAvoFmzd - options: [] - isCloudEventSource: false - settings: {} - labels: [] - schema: - $ref: '#/components/schemas/createSource_200_response_1' - application/json: - example: - data: - source: - id: b3nk6CisJ6zQVKb9KjbFjV - slug: my-test-source-mc1fgb - name: my-test-source-mc1fgb - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - IGA8Ur1riMfSQeAbHNKua70oMagjBuu8 - metadata: - id: IqDTy1TpoU - slug: javascript - name: Javascript - categories: - - Website - description: "This is our most flexible and powerful tracking\ - \ system, using analytics.js. Track and analyze information\ - \ about your visitors and customers, and every action that\ - \ they take, in any of our 140 integrations, business intelligence\ - \ tools, or directly with SQL tools." - logos: - default: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - alt: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - mark: https://cdn.filepicker.io/api/file/kBpmEoSSaakidAvoFmzd - options: [] - isCloudEventSource: false - settings: {} - labels: [] - schema: - $ref: '#/components/schemas/createSource_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Source - tags: - - Sources - x-domain-hierarchy: - - Connections - - Sources - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /regulations/sources/{sourceId}: - get: - deprecated: false - description: Lists all Source-scoped regulations. - operationId: listRegulationsFromSource - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - The status on which to filter returned regulations. - - This parameter exists in alpha. - explode: false - in: query - name: status - required: false - schema: - description: The status on which to filter returned regulations. - enum: - - FAILED - - FINISHED - - INITIALIZED - - INVALID - - NOT_SUPPORTED - - PARTIAL_SUCCESS - - RUNNING - title: status - type: string - style: deepObject - - description: |- - The regulation types on which to filter returned regulations. - - This parameter exists in alpha. - explode: false - in: query - name: regulationTypes - required: false - schema: - description: The regulation types on which to filter returned regulations. - items: - enum: - - BULK_DELETE_ONLY - - DELETE_INTERNAL - - DELETE_ONLY - - SUPPRESS_ONLY - - SUPPRESS_WITH_DELETE - - UNSUPPRESS - type: string - title: regulationTypes - type: array - style: deepObject - - description: |- - Pagination parameters. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - regulations: - - id: 1qJkfE1tpwvQcklImGksLN629wn - subjectType: OBJECT_ID - subjects: - - test_user_id_1 - status: FINISHED - createdAt: 2022-03-08T00:39:36.546951Z - pagination: - current: MQ== - schema: - $ref: '#/components/schemas/listRegulationsFromSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - regulations: - - id: 1qJkfE1tpwvQcklImGksLN629wn - subjectType: OBJECT_ID - subjects: - - test_user_id_1 - status: FINISHED - createdAt: 2022-03-08T00:39:36.546951Z - pagination: - current: MQ== - schema: - $ref: '#/components/schemas/listRegulationsFromSource_200_response' - application/vnd.segment.v1+json: - example: - data: - regulations: - - id: 1qJkfE1tpwvQcklImGksLN629wn - subjectType: OBJECT_ID - subjects: - - test_user_id_1 - status: FINISHED - createdAt: 2022-03-08T00:39:36.546951Z - pagination: - current: MQ== - schema: - $ref: '#/components/schemas/listRegulationsFromSource_200_response' - application/json: - example: - data: - regulations: - - id: 1qJkfE1tpwvQcklImGksLN629wn - subjectType: OBJECT_ID - subjects: - - test_user_id_1 - status: FINISHED - createdAt: 2022-03-08T00:39:36.546951Z - pagination: - current: MQ== - schema: - $ref: '#/components/schemas/listRegulationsFromSource_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Regulations from Source - tags: - - Deletion and Suppression - x-domain-hierarchy: - - Connections - - Deletion and Suppression - x-accepts: application/json - post: - deprecated: false - description: "Creates a Source-scoped regulation.\n\n\n\nWhen called, this endpoint\ - \ may generate the `Source Regulation Created` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n\nConfig API omitted fields:\n- `attributes`,\n- `userAgent`\n \ - \ " - operationId: createSourceRegulation - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - regulationType: SUPPRESS_ONLY - subjectType: USER_ID - subjectIds: - - test_user_id_1 - sourceId: qQEHquLrjRDN9j1ByrChyn - schema: - $ref: '#/components/schemas/CreateSourceRegulationV1Input' - application/vnd.segment.v1beta+json: - example: - regulationType: SUPPRESS_ONLY - subjectType: USER_ID - subjectIds: - - test_user_id_1 - sourceId: qQEHquLrjRDN9j1ByrChyn - schema: - $ref: '#/components/schemas/CreateSourceRegulationV1Input' - application/vnd.segment.v1+json: - example: - regulationType: SUPPRESS_ONLY - subjectType: USER_ID - subjectIds: - - test_user_id_1 - sourceId: qQEHquLrjRDN9j1ByrChyn - schema: - $ref: '#/components/schemas/CreateSourceRegulationV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - regulateId: 1qJkfE1tpwvQcklImGksLN629wn - schema: - $ref: '#/components/schemas/createSourceRegulation_200_response' - application/vnd.segment.v1beta+json: - example: - data: - regulateId: 1qJkfE1tpwvQcklImGksLN629wn - schema: - $ref: '#/components/schemas/createSourceRegulation_200_response' - application/vnd.segment.v1+json: - example: - data: - regulateId: 1qJkfE1tpwvQcklImGksLN629wn - schema: - $ref: '#/components/schemas/createSourceRegulation_200_response' - application/json: - example: - data: - regulateId: 1qJkfE1tpwvQcklImGksLN629wn - schema: - $ref: '#/components/schemas/createSourceRegulation_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Source Regulation - tags: - - Deletion and Suppression - x-domain-hierarchy: - - Connections - - Deletion and Suppression - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /tracking-plans: - get: - deprecated: false - description: "Returns a list of Tracking Plans.\n\n**Note**: In order to successfully\ - \ call this endpoint, the specified Workspace needs to have the Protocols\ - \ feature enabled. Please reach out to your customer success manager for more\ - \ information." - operationId: listTrackingPlans - parameters: - - description: "Requests Tracking Plans of a certain type. If omitted, lists\ - \ all types.\n\nThis parameter exists in alpha." - explode: false - in: query - name: type - required: false - schema: - description: "Requests Tracking Plans of a certain type. If omitted, lists\ - \ all types." - enum: - - LIVE - - PROPERTY_LIBRARY - - RULE_LIBRARY - - TEMPLATE - title: type - type: string - style: deepObject - - description: |- - Pagination options. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - trackingPlans: - - id: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: New TP - resourceSchemaId: rs_1yVwS3zy60dONy9UhCyDqMmVvAE - slug: "" - description: "" - type: LIVE - updatedAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - schema: - $ref: '#/components/schemas/listTrackingPlans_200_response' - application/vnd.segment.v1beta+json: - example: - data: - trackingPlans: - - id: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: New TP - resourceSchemaId: rs_1yVwS3zy60dONy9UhCyDqMmVvAE - slug: "" - description: "" - type: LIVE - updatedAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - schema: - $ref: '#/components/schemas/listTrackingPlans_200_response' - application/vnd.segment.v1+json: - example: - data: - trackingPlans: - - id: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: New TP - resourceSchemaId: rs_1yVwS3zy60dONy9UhCyDqMmVvAE - slug: "" - description: "" - type: LIVE - updatedAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - schema: - $ref: '#/components/schemas/listTrackingPlans_200_response' - application/json: - example: - data: - trackingPlans: - - id: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: New TP - resourceSchemaId: rs_1yVwS3zy60dONy9UhCyDqMmVvAE - slug: "" - description: "" - type: LIVE - updatedAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - schema: - $ref: '#/components/schemas/listTrackingPlans_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Tracking Plans - tags: - - Tracking Plans - x-domain-hierarchy: - - Protocols - - Tracking Plans - x-accepts: application/json - post: - deprecated: false - description: "Creates a Tracking Plan.\n\n**Note**: In order to successfully\ - \ call this endpoint, the specified Workspace needs to have the Protocols\ - \ feature enabled. Please reach out to your customer success manager for more\ - \ information." - operationId: createTrackingPlan - parameters: [] - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - name: New TP - type: LIVE - schema: - $ref: '#/components/schemas/CreateTrackingPlanV1Input' - application/vnd.segment.v1beta+json: - example: - name: New TP - type: LIVE - schema: - $ref: '#/components/schemas/CreateTrackingPlanV1Input' - application/vnd.segment.v1+json: - example: - name: New TP - type: LIVE - schema: - $ref: '#/components/schemas/CreateTrackingPlanV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - trackingPlan: - id: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: New TP - resourceSchemaId: rs_1yVwS3zy60dONy9UhCyDqMmVvAE - slug: "" - description: "" - type: LIVE - updatedAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/createTrackingPlan_200_response' - application/vnd.segment.v1beta+json: - example: - data: - trackingPlan: - id: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: New TP - resourceSchemaId: rs_1yVwS3zy60dONy9UhCyDqMmVvAE - slug: "" - description: "" - type: LIVE - updatedAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/createTrackingPlan_200_response' - application/vnd.segment.v1+json: - example: - data: - trackingPlan: - id: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: New TP - resourceSchemaId: rs_1yVwS3zy60dONy9UhCyDqMmVvAE - slug: "" - description: "" - type: LIVE - updatedAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/createTrackingPlan_200_response' - application/json: - example: - data: - trackingPlan: - id: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: New TP - resourceSchemaId: rs_1yVwS3zy60dONy9UhCyDqMmVvAE - slug: "" - description: "" - type: LIVE - updatedAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/createTrackingPlan_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Tracking Plan - tags: - - Tracking Plans - x-domain-hierarchy: - - Protocols - - Tracking Plans - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /transformations: - get: - deprecated: false - description: "Lists all Transformations in the Workspace.\n\n**Note**: In order\ - \ to successfully call this endpoint, the specified Workspace needs to have\ - \ the Protocols feature enabled. Please reach out to your customer success\ - \ manager for more information." - operationId: listTransformations - parameters: - - description: |- - Pagination options. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - transformations: - - id: c5EmPMhTGmgwoas8YCKXgs - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: Order cancelled event rename in destination - enabled: true - sourceId: qQEHquLrjRDN9j1ByrChyn - destinationMetadataId: 54521fd725e721e32a72eebb - if: event = 'Order Cancelled' - newEventName: order_cancelled - propertyRenames: [] - - id: ks7SJDAn4XvW4VykJSQVz7 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: User clicked event rename - enabled: true - sourceId: qQEHquLrjRDN9j1ByrChyn - if: event = 'User Clicked' - newEventName: user_clicked - propertyRenames: [] - - id: pHrD51Ds35Zjfka84yXQE6 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: User clicked edit track event - enabled: true - sourceId: qQEHquLrjRDN9j1ByrChyn - if: event = 'User Clicked' - propertyRenames: - - oldName: Category - newName: category - - id: rBoBnPKiAek36M192XJsYQ - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: User clicked edit identify event - enabled: true - sourceId: qQEHquLrjRDN9j1ByrChyn - if: type = 'identify' - propertyRenames: - - oldName: Group - newName: group - pagination: - current: MA== - totalEntries: 4 - schema: - $ref: '#/components/schemas/listTransformations_200_response' - application/vnd.segment.v1beta+json: - example: - data: - transformations: - - id: 2DrXmjwFYTgYxxJdCmvz8O0Zu7F - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: Name of the new transformation - enabled: true - sourceId: qQEHquLrjRDN9j1ByrChyn - if: event = 'Example Event Alpha' - newEventName: new-event-name - propertyRenames: - - oldName: old-name - newName: new-name - - oldName: another-name-old - newName: another-name-new - - id: c5EmPMhTGmgwoas8YCKXgs - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: Order cancelled event rename in destination - enabled: true - sourceId: qQEHquLrjRDN9j1ByrChyn - destinationMetadataId: 54521fd725e721e32a72eebb - if: event = 'Order Cancelled' - newEventName: order_cancelled - propertyRenames: [] - - id: ks7SJDAn4XvW4VykJSQVz7 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: User clicked event rename - enabled: true - sourceId: qQEHquLrjRDN9j1ByrChyn - if: event = 'User Clicked' - newEventName: user_clicked - propertyRenames: [] - - id: pHrD51Ds35Zjfka84yXQE6 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: updated-name - enabled: true - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationMetadataId: 547610a5db31d978f14a5c4e - if: event="my-event" - newEventName: my-updated-event - propertyRenames: - - oldName: old-property - newName: new-property - - id: rBoBnPKiAek36M192XJsYQ - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: User clicked edit identify event - enabled: true - sourceId: qQEHquLrjRDN9j1ByrChyn - if: type = 'identify' - propertyRenames: - - oldName: Group - newName: group - pagination: - current: MA== - totalEntries: 5 - schema: - $ref: '#/components/schemas/listTransformations_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Transformations - tags: - - Transformations - x-domain-hierarchy: - - Protocols - - Transformations - x-accepts: application/json - post: - deprecated: false - description: "Creates a new Transformation.\n\n\n\nWhen called, this endpoint\ - \ may generate the `Transformation Created` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n**Note**: In order to successfully call this endpoint, the specified\ - \ Workspace needs to have the Protocols feature enabled. Please reach out\ - \ to your customer success manager for more information." - operationId: createTransformation - parameters: [] - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - name: Name of the new transformation - sourceId: qQEHquLrjRDN9j1ByrChyn - enabled: true - newEventName: new-event-name - propertyRenames: - - oldName: old-name - newName: new-name - - oldName: another-name-old - newName: another-name-new - if: event = 'Example Event Alpha' - schema: - $ref: '#/components/schemas/CreateTransformationBetaInput' - application/vnd.segment.v1beta+json: - example: - name: Name of the new transformation - sourceId: qQEHquLrjRDN9j1ByrChyn - enabled: true - newEventName: new-event-name - propertyRenames: - - oldName: old-name - newName: new-name - - oldName: another-name-old - newName: another-name-new - if: event = 'Example Event Beta' - schema: - $ref: '#/components/schemas/CreateTransformationBetaInput' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - transformation: - id: 2DrXmjwFYTgYxxJdCmvz8O0Zu7F - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: Name of the new transformation - enabled: true - sourceId: qQEHquLrjRDN9j1ByrChyn - if: event = 'Example Event Alpha' - newEventName: new-event-name - propertyRenames: - - oldName: old-name - newName: new-name - - oldName: another-name-old - newName: another-name-new - schema: - $ref: '#/components/schemas/createTransformation_200_response' - application/vnd.segment.v1beta+json: - example: - data: - transformation: - id: 2DrXmmo9lVoky2aObFR0XIh23Px - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: Name of the new transformation - enabled: true - sourceId: qQEHquLrjRDN9j1ByrChyn - if: event = 'Example Event Beta' - newEventName: new-event-name - propertyRenames: - - oldName: old-name - newName: new-name - - oldName: another-name-old - newName: another-name-new - schema: - $ref: '#/components/schemas/createTransformation_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Transformation - tags: - - Transformations - x-domain-hierarchy: - - Protocols - - Transformations - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /groups: - get: - deprecated: false - description: Returns all user groups. - operationId: listUserGroups - parameters: - - description: |- - Pagination for user groups. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - userGroups: - - id: bBABwqbaDf2QdwTbW8bNEm - name: Public API Group - memberCount: 1 - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - pagination: - current: MA== - schema: - $ref: '#/components/schemas/listUserGroups_200_response' - application/vnd.segment.v1beta+json: - example: - data: - userGroups: - - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 0 - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - pagination: - current: MA== - schema: - $ref: '#/components/schemas/listUserGroups_200_response' - application/vnd.segment.v1+json: - example: - data: - userGroups: - - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 0 - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - pagination: - current: MA== - schema: - $ref: '#/components/schemas/listUserGroups_200_response' - application/json: - example: - data: - userGroups: - - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 0 - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - pagination: - current: MA== - schema: - $ref: '#/components/schemas/listUserGroups_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List User Groups - tags: - - IAM Groups - x-domain-hierarchy: - - Admin - - IAM Groups - x-accepts: application/json - post: - deprecated: false - description: "Creates a user group.\n\nWhen called, this endpoint may generate\ - \ one or more of the following [Audit Trail](/tag/Audit-Trail) events:\n*\ - \ User Group Created\n* Policy Created\n \n\n\nThe rate limit for this\ - \ endpoint is 60 requests per minute, which is lower than the default due\ - \ to access pattern restrictions. Once reached, this endpoint will respond\ - \ with the 429 HTTP status code with headers indicating the limit parameters.\ - \ See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: createUserGroup - parameters: [] - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - name: New User Group 8mo8ghLQxS - schema: - $ref: '#/components/schemas/CreateUserGroupV1Input' - application/vnd.segment.v1beta+json: - example: - name: New User Group R18j9ZA9TR - schema: - $ref: '#/components/schemas/CreateUserGroupV1Input' - application/vnd.segment.v1+json: - example: - name: New User Group fkHWOE-a_p - schema: - $ref: '#/components/schemas/CreateUserGroupV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - userGroup: - id: 2DrXo6GpGW9LpRTp1naKkZcV4bP - name: New User Group 8mo8ghLQxS - memberCount: 0 - schema: - $ref: '#/components/schemas/createUserGroup_200_response' - application/vnd.segment.v1beta+json: - example: - data: - userGroup: - id: 2DrXoyNnhFM85FbcRqzACdhP6t7 - name: New User Group R18j9ZA9TR - memberCount: 0 - schema: - $ref: '#/components/schemas/createUserGroup_200_response' - application/vnd.segment.v1+json: - example: - data: - userGroup: - id: 2DrXpkze3NH3ySNB6tUUs1TbJbo - name: New User Group fkHWOE-a_p - memberCount: 0 - schema: - $ref: '#/components/schemas/createUserGroup_200_response' - application/json: - example: - data: - userGroup: - id: 2DrXpkze3NH3ySNB6tUUs1TbJbo - name: New User Group fkHWOE-a_p - memberCount: 0 - schema: - $ref: '#/components/schemas/createUserGroup_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create User Group - tags: - - IAM Groups - x-domain-hierarchy: - - Admin - - IAM Groups - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /warehouses/validation: - post: - deprecated: false - description: "Validates input settings against a Warehouse.\n\n\n\nWhen called,\ - \ this endpoint may generate the `Storage Destination Settings Validation`\ - \ [Audit Trail](/tag/Audit-Trail) event.\n " - operationId: createValidationInWarehouse - parameters: [] - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - metadataId: 55d3d3aea3c - settings: - hostname: address.us-west-2.redshift.amazonaws.com - port: "5439" - database: db - username: user - password: test - schema: - $ref: '#/components/schemas/CreateValidationInWarehouseV1Input' - application/vnd.segment.v1beta+json: - example: - metadataId: 55d3d3aea3c - settings: - hostname: address.us-west-2.redshift.amazonaws.com - port: "5439" - database: db - username: user - password: test - schema: - $ref: '#/components/schemas/CreateValidationInWarehouseV1Input' - application/vnd.segment.v1+json: - example: - metadataId: 55d3d3aea3c - settings: - hostname: address.us-west-2.redshift.amazonaws.com - port: "5439" - database: db - username: user - password: test - schema: - $ref: '#/components/schemas/CreateValidationInWarehouseV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: CONNECTED - schema: - $ref: '#/components/schemas/createValidationInWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: CONNECTED - schema: - $ref: '#/components/schemas/createValidationInWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - status: CONNECTED - schema: - $ref: '#/components/schemas/createValidationInWarehouse_200_response' - application/json: - example: - data: - status: CONNECTED - schema: - $ref: '#/components/schemas/createValidationInWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Validation in Warehouse - tags: - - Warehouses - x-domain-hierarchy: - - Connections - - Warehouses - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /warehouses: - get: - deprecated: false - description: Returns a list of Warehouses. - operationId: listWarehouses - parameters: - - description: |- - Defines the pagination parameters. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - warehouses: - - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - - id: v1e6FCE8P9EvQmCLWpKtJ3 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: aea3c55dsz - slug: redshift - name: Redshift - description: Powered by Amazon Web Services - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/redshift-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listWarehouses_200_response' - application/vnd.segment.v1beta+json: - example: - data: - warehouses: - - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - - id: v1e6FCE8P9EvQmCLWpKtJ3 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: aea3c55dsz - slug: redshift - name: Redshift - description: Powered by Amazon Web Services - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/redshift-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listWarehouses_200_response' - application/vnd.segment.v1+json: - example: - data: - warehouses: - - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - - id: v1e6FCE8P9EvQmCLWpKtJ3 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: aea3c55dsz - slug: redshift - name: Redshift - description: Powered by Amazon Web Services - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/redshift-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listWarehouses_200_response' - application/json: - example: - data: - warehouses: - - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - - id: v1e6FCE8P9EvQmCLWpKtJ3 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: aea3c55dsz - slug: redshift - name: Redshift - description: Powered by Amazon Web Services - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/redshift-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listWarehouses_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Warehouses - tags: - - Warehouses - x-domain-hierarchy: - - Connections - - Warehouses - x-accepts: application/json - post: - deprecated: false - description: "Creates a new Warehouse.\n\n\n\nWhen called, this endpoint may\ - \ generate the `Storage Destination Created` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n " - operationId: createWarehouse - parameters: [] - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - metadataId: aea3c55dsz - settings: {} - schema: - $ref: '#/components/schemas/CreateWarehouseV1Input' - application/vnd.segment.v1beta+json: - example: - metadataId: aea3c55dsz - settings: {} - schema: - $ref: '#/components/schemas/CreateWarehouseV1Input' - application/vnd.segment.v1+json: - example: - metadataId: aea3c55dsz - settings: {} - schema: - $ref: '#/components/schemas/CreateWarehouseV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - warehouse: - id: rjZRNacj6LHGbW5pYGePhK - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: aea3c55dsz - slug: redshift - name: Redshift - description: Powered by Amazon Web Services - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/redshift-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: - name: Redshift_2 - schema: - $ref: '#/components/schemas/createWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - warehouse: - id: ekNpN2fHBmJ16nUfsn3B5H - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: aea3c55dsz - slug: redshift - name: Redshift - description: Powered by Amazon Web Services - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/redshift-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: - name: Redshift_2 - schema: - $ref: '#/components/schemas/createWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - warehouse: - id: 6o4HsR4fzmfczk6gQ616B - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: aea3c55dsz - slug: redshift - name: Redshift - description: Powered by Amazon Web Services - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/redshift-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: - name: Redshift_2 - schema: - $ref: '#/components/schemas/createWarehouse_200_response' - application/json: - example: - data: - warehouse: - id: 6o4HsR4fzmfczk6gQ616B - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: aea3c55dsz - slug: redshift - name: Redshift - description: Powered by Amazon Web Services - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/redshift-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: - name: Redshift_2 - schema: - $ref: '#/components/schemas/createWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Warehouse - tags: - - Warehouses - x-domain-hierarchy: - - Connections - - Warehouses - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /regulations: - get: - deprecated: false - description: Lists all Workspace-scoped regulations. - operationId: listWorkspaceRegulations - parameters: - - description: |- - The status on which to filter the returned regulations. - - This parameter exists in alpha. - explode: false - in: query - name: status - required: false - schema: - description: The status on which to filter the returned regulations. - enum: - - FAILED - - FINISHED - - INITIALIZED - - INVALID - - NOT_SUPPORTED - - PARTIAL_SUCCESS - - RUNNING - title: status - type: string - style: deepObject - - description: |- - The regulation types on which to filter returned regulations. - - This parameter exists in alpha. - explode: false - in: query - name: regulationTypes - required: false - schema: - description: The regulation types on which to filter returned regulations. - items: - enum: - - BULK_DELETE_ONLY - - DELETE_INTERNAL - - DELETE_ONLY - - SUPPRESS_ONLY - - SUPPRESS_WITH_DELETE - - UNSUPPRESS - type: string - title: regulationTypes - type: array - style: deepObject - - description: |- - Pagination parameters. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - regulations: - - id: 1qJkfE1tpwvQcklImGksLN629wn - subjectType: OBJECT_ID - subjects: - - test_user_id_1 - status: FINISHED - createdAt: 2022-03-08T00:39:36.546951Z - pagination: - current: MQ== - schema: - $ref: '#/components/schemas/listWorkspaceRegulations_200_response' - application/vnd.segment.v1beta+json: - example: - data: - regulations: - - id: 1qJkfE1tpwvQcklImGksLN629wn - subjectType: OBJECT_ID - subjects: - - test_user_id_1 - status: FINISHED - createdAt: 2022-03-08T00:39:36.546951Z - pagination: - current: MQ== - schema: - $ref: '#/components/schemas/listWorkspaceRegulations_200_response' - application/vnd.segment.v1+json: - example: - data: - regulations: - - id: 1qJkfE1tpwvQcklImGksLN629wn - subjectType: OBJECT_ID - subjects: - - test_user_id_1 - status: FINISHED - createdAt: 2022-03-08T00:39:36.546951Z - pagination: - current: MQ== - schema: - $ref: '#/components/schemas/listWorkspaceRegulations_200_response' - application/json: - example: - data: - regulations: - - id: 1qJkfE1tpwvQcklImGksLN629wn - subjectType: OBJECT_ID - subjects: - - test_user_id_1 - status: FINISHED - createdAt: 2022-03-08T00:39:36.546951Z - pagination: - current: MQ== - schema: - $ref: '#/components/schemas/listWorkspaceRegulations_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Workspace Regulations - tags: - - Deletion and Suppression - x-domain-hierarchy: - - Connections - - Deletion and Suppression - x-accepts: application/json - post: - deprecated: false - description: "Creates a Workspace-scoped regulation.\n\n\n\nWhen called, this\ - \ endpoint may generate the `Workspace Regulation Created` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n\nConfig API omitted fields:\n- `attributes`,\n- `userAgent`\n \ - \ " - operationId: createWorkspaceRegulation - parameters: [] - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - regulationType: SUPPRESS_ONLY - subjectType: USER_ID - subjectIds: - - test_user_id_1 - schema: - $ref: '#/components/schemas/CreateWorkspaceRegulationV1Input' - application/vnd.segment.v1beta+json: - example: - regulationType: SUPPRESS_ONLY - subjectType: USER_ID - subjectIds: - - test_user_id_1 - schema: - $ref: '#/components/schemas/CreateWorkspaceRegulationV1Input' - application/vnd.segment.v1+json: - example: - regulationType: SUPPRESS_ONLY - subjectType: USER_ID - subjectIds: - - test_user_id_1 - schema: - $ref: '#/components/schemas/CreateWorkspaceRegulationV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - regulateId: 1qJkfE1tpwvQcklImGksLN629wn - schema: - $ref: '#/components/schemas/createWorkspaceRegulation_200_response' - application/vnd.segment.v1beta+json: - example: - data: - regulateId: 1qJkfE1tpwvQcklImGksLN629wn - schema: - $ref: '#/components/schemas/createWorkspaceRegulation_200_response' - application/vnd.segment.v1+json: - example: - data: - regulateId: 1qJkfE1tpwvQcklImGksLN629wn - schema: - $ref: '#/components/schemas/createWorkspaceRegulation_200_response' - application/json: - example: - data: - regulateId: 1qJkfE1tpwvQcklImGksLN629wn - schema: - $ref: '#/components/schemas/createWorkspaceRegulation_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Create Workspace Regulation - tags: - - Deletion and Suppression - x-domain-hierarchy: - - Connections - - Deletion and Suppression - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /destinations/{destinationId}: - delete: - deprecated: false - description: "Deletes an existing Destination.\n\n\n\nWhen called, this endpoint\ - \ may generate the `Integration Deleted` [Audit Trail](/tag/Audit-Trail) event.\n\ - \nConfig API omitted fields:\n- `catalogId`\n " - operationId: deleteDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteDestination_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteDestination_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteDestination_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Delete Destination - tags: - - Destinations - x-domain-hierarchy: - - Connections - - Destinations - x-accepts: application/json - get: - deprecated: false - description: | - Returns a Destination by its id. - - Config API omitted fields: - - `catalogId` - operationId: getDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - destination: - id: fP7qoQw2HTWt9WdMr718gn - enabled: true - name: "" - settings: - mobileTrackingId: "123" - serversideTrackingId: "123" - trackingId: "123" - metadata: - id: 54521fd725e721e32a72eebb - name: Google Universal Analytics - description: Google Universal Analytics is the most popular - analytics tool for the web. It’s free and provides a wide - range of features. It’s especially good at measuring traffic - sources and ad campaigns. - slug: google-analytics - logos: - default: https://cdn.filepicker.io/api/file/anFgceQJTGeMxChCgiyU - mark: https://cdn.filepicker.io/api/file/zebLRcY3RtOlynDXTgNk - options: - - name: anonymizeIp - type: boolean - defaultValue: false - description: "For client side libraries. Read more about anonymizing\ - \ IP addresses from the [Google support documentation](https://support.google.com/analytics/answer/2763052?hl=en)." - required: false - label: Anonymize IP Addresses - - name: classic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier ones are Classic. An easy test: if you see\ - \ `_gaq.push` in your code you're using Classic, so enable\ - \ this." - required: false - label: Use Classic Analytics on Your Site - - name: contentGroupings - type: map - defaultValue: {} - description: "Enter a property name on the left. Choose the\ - \ Google Analytics content grouping you want on the right.\ - \ Google Analytics only accepts numbered content groupings\ - \ (e.g. contentGrouping3). When you use `analytics.page(name,\ - \ properties)` with custom properties, we'll use the value\ - \ of the property you designate as the value of the specified\ - \ content grouping." - required: false - label: Content Groupings - - name: dimensions - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom traits or `analytics.track('event',\ - \ properties)` with custom properties, you need to map those\ - \ traits and properties to Google Analytics custom dimensions\ - \ if you want them to be sent to GA. Enter a trait or property\ - \ name on the left. Choose the Google Analytics dimension\ - \ you want on the right. Google Analytics only accepts numbered\ - \ dimensions (e.g. dimension3). We suggest using user-scoped\ - \ dimensions for trait mappings and hit-scoped dimensions\ - \ for properties [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Dimensions - - name: domain - type: string - defaultValue: "" - description: "_Only data sent from visitors on this domain_\ - \ will be recorded. By default Google Analytics automatically\ - \ resolves the domain name, so you should **leave this blank\ - \ unless you know you want otherwise**! This option is useful\ - \ if you need to ignore data from other domains, or explicitly\ - \ set the domain of your Google Analytics cookie. This is\ - \ known as Override Domain Name in [GA Classic](https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite).\ - \ If you are testing locally, you can set the domain to\ - \ `none`. [Read more about this setting in our docs](https://segment.com/docs/connections/destinations/catalog/google-analytics/#cookie-domain-name)." - required: false - label: Cookie Domain Name - - name: doubleClick - type: boolean - defaultValue: false - description: Works with both Universal and Classic tracking - methods. - required: false - label: "Remarketing, Display Ads and Demographic Reports." - - name: enableServerIdentify - type: boolean - defaultValue: false - description: "If you are sending `.identify()` calls from\ - \ your server side libraries or have Segment Cloud Apps\ - \ that send back `.identify()` calls with enriched user\ - \ traits, you can send that data to your GA account via\ - \ custom dimensions and metrics. Unlike the client side\ - \ integration which has the luxury of browsers and the global\ - \ window `ga` tracker, for server side we will check your\ - \ `traits` and your settings for custom dimension/metric\ - \ mappings and send it with an explicit event. " - required: false - label: Enable Server Side Identify - - name: enhancedEcommerce - type: boolean - defaultValue: false - description: "If you want more detailed reports on ecommerce,\ - \ you might want to enable this feature. Read more about\ - \ it [here](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce)." - required: false - label: Enable Enhanced Ecommerce - - name: enhancedLinkAttribution - type: boolean - defaultValue: false - description: "Provides more detailed reports on the links\ - \ clicked on your site. Read more about it in the [Google\ - \ support documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-link-attribution)." - required: false - label: Enable Enhanced Link Attribution - - name: identifyCategory - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify the trait you want to look up for setting\ - \ the event category will be since all custom metrics/dimensions\ - \ for server side `.identify()` calls will be sent via an\ - \ event hit to GA. The default value will be `'All'`. For\ - \ example, if you are sending `traits.category`, you can\ - \ put 'category' in the setting above and we will send the\ - \ value of this trait as the event category." - required: false - label: Server Side Identify Event Category - - name: identifyEventName - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify what the event action will be since all\ - \ custom metrics/dimensions for server side `.identify()`\ - \ calls will be sent via an event hit to GA. The default\ - \ value will be `'User Enriched'`" - required: false - label: Server Side Identify Event Action - - name: ignoredReferrers - type: strings - defaultValue: [] - description: "Add any domains you want to ignore, separated\ - \ by line breaks. You might use this if you want Google\ - \ Analytics to ignore certain referral domains (e.g. to\ - \ prevent your subdomains from showing up as referrers in\ - \ your analytics). _Note: this only works for Classic profiles.\ - \ Universal profiles can_ [edit their ignored referrers](https://support.google.com/analytics/answer/2795830?hl=en&ref_topic=2790009)\ - \ _directly inside Google Analytics._" - required: false - label: Ignored Referrers - - name: includeSearch - type: boolean - defaultValue: false - description: "The querystring doesn't usually affect the content\ - \ of the page in a significant way (like sorting), so we\ - \ disable this by default." - required: false - label: Include the Querystring in Page Views - - name: metrics - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom numerical traits or `analytics.track('event',\ - \ properties)` with custom numerical properties, you need\ - \ to map those traits and properties to Google Analytics\ - \ custom metrics if you want them to be sent to GA. Enter\ - \ a trait or property name on the left. Choose the Google\ - \ Analytics metric you want on the right. Google Analytics\ - \ only accepts numbered metrics (e.g. metric3). We suggest\ - \ using user-scoped metrics for trait mappings and hit-scoped\ - \ metrics for properties. [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Metrics - - name: mobileTrackingId - type: string - defaultValue: "" - description: "Google Analytics tracks mobile apps separately,\ - \ so you'll want to create a separate Google Analytics mobile\ - \ app property. Remember to only add a mobile tracking ID\ - \ if you're tracking from a mobile library. If you're tracking\ - \ from a hybrid app, fill in your website tracking ID instead.\ - \ Leave it blank if you don't have a mobile app property." - required: true - label: Mobile Tracking ID - - name: nameTracker - type: boolean - defaultValue: false - description: "Name the tracker 'segmentGATracker'. Enable\ - \ this if you're working with additional Google Analytics\ - \ trackers and want to ensure that your Segment tracker\ - \ has a distinct name. If this is enabled you must prepend\ - \ this tracker name to any native Google Analytics (except\ - \ for create) that you call, e.g. 'segmentGATracker.require(....)' " - required: false - label: Name Tracker - - name: nonInteraction - type: boolean - defaultValue: false - description: "Adds a _nonInteraction: true_ flag to every\ - \ non-enhanced ecommerce event tracked to Google Analytics.\ - \ If you're seeing unusually low bounce rates this will\ - \ solve that issue." - required: false - label: Add the non-interaction flag to all events - - name: optimize - type: string - defaultValue: "" - description: Integrate with Google Analytics Optimize plugin. - Please enter your Optimize Container ID - required: false - label: Optimize Container ID - - name: preferAnonymousId - type: boolean - defaultValue: false - description: Enable this setting if you want `clientId` to - always be set as a hash of `anonymousId`. If no `anonymousId` - is present we will fallback to set the `clientId` to `userId`. - This setting only applies to server side connections. - required: false - label: Prefer Anonymous ID for Client ID - Server Side Only - - name: protocolMappings - type: map - defaultValue: {} - description: "If you are using the *server side* GA integration,\ - \ you can map your custom traits or properties to known\ - \ [measurement protocol params](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters)." - required: false - label: Map Traits or Properties to Measurement Protocol Params - - name: reportUncaughtExceptions - type: boolean - defaultValue: false - description: This lets you study errors and exceptions in - your iOS and Android apps in Google Analytics. - required: false - label: Send Uncaught Exceptions to GA (Mobile) - - name: resetCustomDimensionsOnPage - type: array - defaultValue: [] - description: "If you have an SPA website, and need to reset\ - \ custom dimensions between page calls, add to this setting\ - \ all the properties (already mapped as custom dimensions)\ - \ that need to be reset for each page call." - required: false - label: Reset dimensions on Page calls - - name: sampleRate - type: number - defaultValue: 100 - description: "Specifies what percentage of users should be\ - \ tracked. This defaults to 100 (no users are sampled out)\ - \ but large sites may need to use a lower sample rate to\ - \ stay within Google Analytics processing limits as [seen\ - \ here](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#sampleRate).\ - \ Currently only available in the browser - mobile coming\ - \ soon." - required: false - label: Sample Rate - - name: sendUserId - type: boolean - defaultValue: false - description: "User-ID enables the analysis of groups of sessions\ - \ across devices, using a unique and persistent ID. This\ - \ only works with Google Analytics Universal. IMPORTANT:\ - \ Sending email or other personally identifiable information\ - \ (PII) violates Google Analytics Terms of Service." - required: false - label: Send User-ID to GA - - name: serversideClassic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier profiles are Classic. An easy test: if you\ - \ see `_gaq.push` in your code you're using Classic, so\ - \ enable this." - required: false - label: Use Classic Analytics for Your Serverside Tracking - - name: serversideTrackingId - type: string - defaultValue: "" - description: "Your Serverside Tracking ID is the UA code for\ - \ the Google Analytics property you want to send server-side\ - \ calls to. Leave it blank if you don't have a server-side\ - \ client library that you want to send data from. Remember\ - \ that data tracked from mobile integrations that are not\ - \ bundled in your app send data to Google Analytics server\ - \ side, since Segment sends data to them via our own servers." - required: true - label: Serverside Tracking ID - - name: setAllMappedProps - type: boolean - defaultValue: true - description: "Google Analytics allows users to either pass\ - \ custom dimensions / metrics as properties of specific\ - \ events or as properties for all events on a given page\ - \ (or the lifetime of the global tracker object). The default\ - \ Segment behavior is the latter. Any metrics / dimensions\ - \ that are mapped to a given property will be set to the\ - \ page and sent as properties of all subsequent events on\ - \ that page. You can disable this functionality with this\ - \ setting. If disabled, Segment will only pass custom dimensions\ - \ / metrics as part of the payload of the event with which\ - \ they are explicitly associated. Please reference the Google\ - \ Analytics [documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets#implementation)\ - \ for more info." - required: false - label: Set Custom Dimensions & Metrics to the Page - - name: siteSpeedSampleRate - type: number - defaultValue: 1 - description: "Defines the sample size for Site Speed data\ - \ collection. If you have a small number of visitors you\ - \ might want to adjust the sampling to a larger rate for\ - \ your [site speed stats](https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration?hl=en#_gat.GA_Tracker_._setSiteSpeedSampleRate)." - required: false - label: Site Speed Sample Rate - - name: topLevelContextMapping - type: boolean - defaultValue: false - description: "By default, Segment allows mappings from custom\ - \ traits and properties to Google Analytics custom dimensions\ - \ and metrics. If you enable this setting, Segment will\ - \ also send top-level and `context` object fields mapped\ - \ in the **Custom Dimensions** and **Custom Metrics** settings.\ - \ When evaluating mappings, Segment will prioritize properties\ - \ and traits before top-level and `context` fields. This\ - \ setting only applies to server side connections." - required: false - label: Enable Mappings from Top-Level or Context Fields - - Server Side Only - - name: trackCategorizedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `category` associated with them. E.g.\ - \ `page('Docs', 'Index')` translates to **Viewed Docs Page**." - required: false - label: Track Categorized Pages - - name: trackNamedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `name` associated with them. E.g. `page('Signup')`\ - \ translates to **Viewed Signup Page**." - required: false - label: Track Named Pages - - name: trackingId - type: string - defaultValue: "" - description: "Your website's Tracking ID is in the **Tracking\ - \ Info** tab on the [Admin Page](https://www.google.com/analytics/web/#management/Property)\ - \ of Google Analytics. Leave it blank if you don't have\ - \ a website property." - required: true - label: Website Tracking ID - - name: typeOverride - type: boolean - defaultValue: false - description: "By default, Segment sends \"Product List Viewed\"\ - \ and \"Product List Filtered\" ecommerce events to GA as\ - \ \"pageview\" hit types. Enable this setting to instead\ - \ map these two specced Segment track events to GA as \"\ - event\" hit types." - required: false - label: Send Segment "Product List" Events to GA as "Event" - Hits - - name: useGoogleAmpClientId - type: boolean - defaultValue: false - description: "Google’s AMP Client ID API lets you uniquely\ - \ identify users who engage with your content on AMP and\ - \ non-AMP pages. If you opt-in, Google Analytics will use\ - \ the user's AMP Client ID to determine that multiple site\ - \ events belong to the same user when those users visit\ - \ AMP pages via a [Google viewer](https://support.google.com/websearch/answer/7220196).\ - \ Associating events and users provides features like user\ - \ counts and session-based metrics. *Enabling this feature\ - \ will affect your reporting.* Please carefully reference\ - \ Google's [documentation](https://support.google.com/analytics/answer/7486764?hl=en&ref_topic=7378717)\ - \ for more info before you enable it." - required: false - label: Use Google AMP Client ID - - name: userDeletion - type: string - defaultValue: "" - description: 'Sign in to Google Analytics oAuth to enable - User Deletion. ' - required: false - label: User Deletion - status: PUBLIC - categories: - - Analytics - website: http://google.com/analytics - components: - - code: https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: BROWSER - - code: https://github.com/segment-integrations/analytics-ios-integration-google-analytics - owner: SEGMENT - type: IOS - - code: https://github.com/segment-integrations/analytics-android-integration-google-analytics - owner: SEGMENT - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: SERVER - previousNames: - - Google Analytics - - Google Universal Analytics - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: false - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: true - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/getDestination_200_response' - application/vnd.segment.v1beta+json: - example: - data: - destination: - id: fP7qoQw2HTWt9WdMr718gn - enabled: false - name: "" - settings: - anonymizeIp: false - classic: false - contentGroupings: {} - dimensions: {} - domain: "" - doubleClick: false - enableServerIdentify: false - enhancedEcommerce: false - enhancedLinkAttribution: false - identifyCategory: "" - identifyEventName: "" - ignoredReferrers: [] - includeSearch: false - metrics: {} - mobileTrackingId: "123" - nameTracker: false - nonInteraction: false - optimize: "" - preferAnonymousId: false - protocolMappings: {} - reportUncaughtExceptions: false - resetCustomDimensionsOnPage: [] - sampleRate: 100 - sendUserId: false - serversideClassic: false - serversideTrackingId: "123" - setAllMappedProps: true - siteSpeedSampleRate: 1 - topLevelContextMapping: false - trackCategorizedPages: true - trackNamedPages: true - trackingId: "123" - typeOverride: false - useGoogleAmpClientId: false - userDeletion: "" - metadata: - id: 54521fd725e721e32a72eebb - name: Google Universal Analytics - description: Google Universal Analytics is the most popular - analytics tool for the web. It’s free and provides a wide - range of features. It’s especially good at measuring traffic - sources and ad campaigns. - slug: google-analytics - logos: - default: https://cdn.filepicker.io/api/file/anFgceQJTGeMxChCgiyU - mark: https://cdn.filepicker.io/api/file/zebLRcY3RtOlynDXTgNk - options: - - name: anonymizeIp - type: boolean - defaultValue: false - description: "For client side libraries. Read more about anonymizing\ - \ IP addresses from the [Google support documentation](https://support.google.com/analytics/answer/2763052?hl=en)." - required: false - label: Anonymize IP Addresses - - name: classic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier ones are Classic. An easy test: if you see\ - \ `_gaq.push` in your code you're using Classic, so enable\ - \ this." - required: false - label: Use Classic Analytics on Your Site - - name: contentGroupings - type: map - defaultValue: {} - description: "Enter a property name on the left. Choose the\ - \ Google Analytics content grouping you want on the right.\ - \ Google Analytics only accepts numbered content groupings\ - \ (e.g. contentGrouping3). When you use `analytics.page(name,\ - \ properties)` with custom properties, we'll use the value\ - \ of the property you designate as the value of the specified\ - \ content grouping." - required: false - label: Content Groupings - - name: dimensions - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom traits or `analytics.track('event',\ - \ properties)` with custom properties, you need to map those\ - \ traits and properties to Google Analytics custom dimensions\ - \ if you want them to be sent to GA. Enter a trait or property\ - \ name on the left. Choose the Google Analytics dimension\ - \ you want on the right. Google Analytics only accepts numbered\ - \ dimensions (e.g. dimension3). We suggest using user-scoped\ - \ dimensions for trait mappings and hit-scoped dimensions\ - \ for properties [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Dimensions - - name: domain - type: string - defaultValue: "" - description: "_Only data sent from visitors on this domain_\ - \ will be recorded. By default Google Analytics automatically\ - \ resolves the domain name, so you should **leave this blank\ - \ unless you know you want otherwise**! This option is useful\ - \ if you need to ignore data from other domains, or explicitly\ - \ set the domain of your Google Analytics cookie. This is\ - \ known as Override Domain Name in [GA Classic](https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite).\ - \ If you are testing locally, you can set the domain to\ - \ `none`. [Read more about this setting in our docs](https://segment.com/docs/connections/destinations/catalog/google-analytics/#cookie-domain-name)." - required: false - label: Cookie Domain Name - - name: doubleClick - type: boolean - defaultValue: false - description: Works with both Universal and Classic tracking - methods. - required: false - label: "Remarketing, Display Ads and Demographic Reports." - - name: enableServerIdentify - type: boolean - defaultValue: false - description: "If you are sending `.identify()` calls from\ - \ your server side libraries or have Segment Cloud Apps\ - \ that send back `.identify()` calls with enriched user\ - \ traits, you can send that data to your GA account via\ - \ custom dimensions and metrics. Unlike the client side\ - \ integration which has the luxury of browsers and the global\ - \ window `ga` tracker, for server side we will check your\ - \ `traits` and your settings for custom dimension/metric\ - \ mappings and send it with an explicit event. " - required: false - label: Enable Server Side Identify - - name: enhancedEcommerce - type: boolean - defaultValue: false - description: "If you want more detailed reports on ecommerce,\ - \ you might want to enable this feature. Read more about\ - \ it [here](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce)." - required: false - label: Enable Enhanced Ecommerce - - name: enhancedLinkAttribution - type: boolean - defaultValue: false - description: "Provides more detailed reports on the links\ - \ clicked on your site. Read more about it in the [Google\ - \ support documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-link-attribution)." - required: false - label: Enable Enhanced Link Attribution - - name: identifyCategory - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify the trait you want to look up for setting\ - \ the event category will be since all custom metrics/dimensions\ - \ for server side `.identify()` calls will be sent via an\ - \ event hit to GA. The default value will be `'All'`. For\ - \ example, if you are sending `traits.category`, you can\ - \ put 'category' in the setting above and we will send the\ - \ value of this trait as the event category." - required: false - label: Server Side Identify Event Category - - name: identifyEventName - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify what the event action will be since all\ - \ custom metrics/dimensions for server side `.identify()`\ - \ calls will be sent via an event hit to GA. The default\ - \ value will be `'User Enriched'`" - required: false - label: Server Side Identify Event Action - - name: ignoredReferrers - type: strings - defaultValue: [] - description: "Add any domains you want to ignore, separated\ - \ by line breaks. You might use this if you want Google\ - \ Analytics to ignore certain referral domains (e.g. to\ - \ prevent your subdomains from showing up as referrers in\ - \ your analytics). _Note: this only works for Classic profiles.\ - \ Universal profiles can_ [edit their ignored referrers](https://support.google.com/analytics/answer/2795830?hl=en&ref_topic=2790009)\ - \ _directly inside Google Analytics._" - required: false - label: Ignored Referrers - - name: includeSearch - type: boolean - defaultValue: false - description: "The querystring doesn't usually affect the content\ - \ of the page in a significant way (like sorting), so we\ - \ disable this by default." - required: false - label: Include the Querystring in Page Views - - name: metrics - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom numerical traits or `analytics.track('event',\ - \ properties)` with custom numerical properties, you need\ - \ to map those traits and properties to Google Analytics\ - \ custom metrics if you want them to be sent to GA. Enter\ - \ a trait or property name on the left. Choose the Google\ - \ Analytics metric you want on the right. Google Analytics\ - \ only accepts numbered metrics (e.g. metric3). We suggest\ - \ using user-scoped metrics for trait mappings and hit-scoped\ - \ metrics for properties. [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Metrics - - name: mobileTrackingId - type: string - defaultValue: "" - description: "Google Analytics tracks mobile apps separately,\ - \ so you'll want to create a separate Google Analytics mobile\ - \ app property. Remember to only add a mobile tracking ID\ - \ if you're tracking from a mobile library. If you're tracking\ - \ from a hybrid app, fill in your website tracking ID instead.\ - \ Leave it blank if you don't have a mobile app property." - required: true - label: Mobile Tracking ID - - name: nameTracker - type: boolean - defaultValue: false - description: "Name the tracker 'segmentGATracker'. Enable\ - \ this if you're working with additional Google Analytics\ - \ trackers and want to ensure that your Segment tracker\ - \ has a distinct name. If this is enabled you must prepend\ - \ this tracker name to any native Google Analytics (except\ - \ for create) that you call, e.g. 'segmentGATracker.require(....)' " - required: false - label: Name Tracker - - name: nonInteraction - type: boolean - defaultValue: false - description: "Adds a _nonInteraction: true_ flag to every\ - \ non-enhanced ecommerce event tracked to Google Analytics.\ - \ If you're seeing unusually low bounce rates this will\ - \ solve that issue." - required: false - label: Add the non-interaction flag to all events - - name: optimize - type: string - defaultValue: "" - description: Integrate with Google Analytics Optimize plugin. - Please enter your Optimize Container ID - required: false - label: Optimize Container ID - - name: preferAnonymousId - type: boolean - defaultValue: false - description: Enable this setting if you want `clientId` to - always be set as a hash of `anonymousId`. If no `anonymousId` - is present we will fallback to set the `clientId` to `userId`. - This setting only applies to server side connections. - required: false - label: Prefer Anonymous ID for Client ID - Server Side Only - - name: protocolMappings - type: map - defaultValue: {} - description: "If you are using the *server side* GA integration,\ - \ you can map your custom traits or properties to known\ - \ [measurement protocol params](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters)." - required: false - label: Map Traits or Properties to Measurement Protocol Params - - name: reportUncaughtExceptions - type: boolean - defaultValue: false - description: This lets you study errors and exceptions in - your iOS and Android apps in Google Analytics. - required: false - label: Send Uncaught Exceptions to GA (Mobile) - - name: resetCustomDimensionsOnPage - type: array - defaultValue: [] - description: "If you have an SPA website, and need to reset\ - \ custom dimensions between page calls, add to this setting\ - \ all the properties (already mapped as custom dimensions)\ - \ that need to be reset for each page call." - required: false - label: Reset dimensions on Page calls - - name: sampleRate - type: number - defaultValue: 100 - description: "Specifies what percentage of users should be\ - \ tracked. This defaults to 100 (no users are sampled out)\ - \ but large sites may need to use a lower sample rate to\ - \ stay within Google Analytics processing limits as [seen\ - \ here](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#sampleRate).\ - \ Currently only available in the browser - mobile coming\ - \ soon." - required: false - label: Sample Rate - - name: sendUserId - type: boolean - defaultValue: false - description: "User-ID enables the analysis of groups of sessions\ - \ across devices, using a unique and persistent ID. This\ - \ only works with Google Analytics Universal. IMPORTANT:\ - \ Sending email or other personally identifiable information\ - \ (PII) violates Google Analytics Terms of Service." - required: false - label: Send User-ID to GA - - name: serversideClassic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier profiles are Classic. An easy test: if you\ - \ see `_gaq.push` in your code you're using Classic, so\ - \ enable this." - required: false - label: Use Classic Analytics for Your Serverside Tracking - - name: serversideTrackingId - type: string - defaultValue: "" - description: "Your Serverside Tracking ID is the UA code for\ - \ the Google Analytics property you want to send server-side\ - \ calls to. Leave it blank if you don't have a server-side\ - \ client library that you want to send data from. Remember\ - \ that data tracked from mobile integrations that are not\ - \ bundled in your app send data to Google Analytics server\ - \ side, since Segment sends data to them via our own servers." - required: true - label: Serverside Tracking ID - - name: setAllMappedProps - type: boolean - defaultValue: true - description: "Google Analytics allows users to either pass\ - \ custom dimensions / metrics as properties of specific\ - \ events or as properties for all events on a given page\ - \ (or the lifetime of the global tracker object). The default\ - \ Segment behavior is the latter. Any metrics / dimensions\ - \ that are mapped to a given property will be set to the\ - \ page and sent as properties of all subsequent events on\ - \ that page. You can disable this functionality with this\ - \ setting. If disabled, Segment will only pass custom dimensions\ - \ / metrics as part of the payload of the event with which\ - \ they are explicitly associated. Please reference the Google\ - \ Analytics [documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets#implementation)\ - \ for more info." - required: false - label: Set Custom Dimensions & Metrics to the Page - - name: siteSpeedSampleRate - type: number - defaultValue: 1 - description: "Defines the sample size for Site Speed data\ - \ collection. If you have a small number of visitors you\ - \ might want to adjust the sampling to a larger rate for\ - \ your [site speed stats](https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration?hl=en#_gat.GA_Tracker_._setSiteSpeedSampleRate)." - required: false - label: Site Speed Sample Rate - - name: topLevelContextMapping - type: boolean - defaultValue: false - description: "By default, Segment allows mappings from custom\ - \ traits and properties to Google Analytics custom dimensions\ - \ and metrics. If you enable this setting, Segment will\ - \ also send top-level and `context` object fields mapped\ - \ in the **Custom Dimensions** and **Custom Metrics** settings.\ - \ When evaluating mappings, Segment will prioritize properties\ - \ and traits before top-level and `context` fields. This\ - \ setting only applies to server side connections." - required: false - label: Enable Mappings from Top-Level or Context Fields - - Server Side Only - - name: trackCategorizedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `category` associated with them. E.g.\ - \ `page('Docs', 'Index')` translates to **Viewed Docs Page**." - required: false - label: Track Categorized Pages - - name: trackNamedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `name` associated with them. E.g. `page('Signup')`\ - \ translates to **Viewed Signup Page**." - required: false - label: Track Named Pages - - name: trackingId - type: string - defaultValue: "" - description: "Your website's Tracking ID is in the **Tracking\ - \ Info** tab on the [Admin Page](https://www.google.com/analytics/web/#management/Property)\ - \ of Google Analytics. Leave it blank if you don't have\ - \ a website property." - required: true - label: Website Tracking ID - - name: typeOverride - type: boolean - defaultValue: false - description: "By default, Segment sends \"Product List Viewed\"\ - \ and \"Product List Filtered\" ecommerce events to GA as\ - \ \"pageview\" hit types. Enable this setting to instead\ - \ map these two specced Segment track events to GA as \"\ - event\" hit types." - required: false - label: Send Segment "Product List" Events to GA as "Event" - Hits - - name: useGoogleAmpClientId - type: boolean - defaultValue: false - description: "Google’s AMP Client ID API lets you uniquely\ - \ identify users who engage with your content on AMP and\ - \ non-AMP pages. If you opt-in, Google Analytics will use\ - \ the user's AMP Client ID to determine that multiple site\ - \ events belong to the same user when those users visit\ - \ AMP pages via a [Google viewer](https://support.google.com/websearch/answer/7220196).\ - \ Associating events and users provides features like user\ - \ counts and session-based metrics. *Enabling this feature\ - \ will affect your reporting.* Please carefully reference\ - \ Google's [documentation](https://support.google.com/analytics/answer/7486764?hl=en&ref_topic=7378717)\ - \ for more info before you enable it." - required: false - label: Use Google AMP Client ID - - name: userDeletion - type: string - defaultValue: "" - description: 'Sign in to Google Analytics oAuth to enable - User Deletion. ' - required: false - label: User Deletion - status: PUBLIC - categories: - - Analytics - website: http://google.com/analytics - components: - - code: https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: BROWSER - - code: https://github.com/segment-integrations/analytics-ios-integration-google-analytics - owner: SEGMENT - type: IOS - - code: https://github.com/segment-integrations/analytics-android-integration-google-analytics - owner: SEGMENT - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: SERVER - previousNames: - - Google Analytics - - Google Universal Analytics - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: false - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: true - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/getDestination_200_response' - application/vnd.segment.v1+json: - example: - data: - destination: - id: fP7qoQw2HTWt9WdMr718gn - enabled: false - name: "" - settings: - anonymizeIp: false - classic: false - contentGroupings: {} - dimensions: {} - domain: "" - doubleClick: false - enableServerIdentify: false - enhancedEcommerce: false - enhancedLinkAttribution: false - identifyCategory: "" - identifyEventName: "" - ignoredReferrers: [] - includeSearch: false - metrics: {} - mobileTrackingId: "123" - nameTracker: false - nonInteraction: false - optimize: "" - preferAnonymousId: false - protocolMappings: {} - reportUncaughtExceptions: false - resetCustomDimensionsOnPage: [] - sampleRate: 100 - sendUserId: false - serversideClassic: false - serversideTrackingId: "123" - setAllMappedProps: true - siteSpeedSampleRate: 1 - topLevelContextMapping: false - trackCategorizedPages: true - trackNamedPages: true - trackingId: "123" - typeOverride: false - useGoogleAmpClientId: false - userDeletion: "" - metadata: - id: 54521fd725e721e32a72eebb - name: Google Universal Analytics - description: Google Universal Analytics is the most popular - analytics tool for the web. It’s free and provides a wide - range of features. It’s especially good at measuring traffic - sources and ad campaigns. - slug: google-analytics - logos: - default: https://cdn.filepicker.io/api/file/anFgceQJTGeMxChCgiyU - mark: https://cdn.filepicker.io/api/file/zebLRcY3RtOlynDXTgNk - options: - - name: anonymizeIp - type: boolean - defaultValue: false - description: "For client side libraries. Read more about anonymizing\ - \ IP addresses from the [Google support documentation](https://support.google.com/analytics/answer/2763052?hl=en)." - required: false - label: Anonymize IP Addresses - - name: classic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier ones are Classic. An easy test: if you see\ - \ `_gaq.push` in your code you're using Classic, so enable\ - \ this." - required: false - label: Use Classic Analytics on Your Site - - name: contentGroupings - type: map - defaultValue: {} - description: "Enter a property name on the left. Choose the\ - \ Google Analytics content grouping you want on the right.\ - \ Google Analytics only accepts numbered content groupings\ - \ (e.g. contentGrouping3). When you use `analytics.page(name,\ - \ properties)` with custom properties, we'll use the value\ - \ of the property you designate as the value of the specified\ - \ content grouping." - required: false - label: Content Groupings - - name: dimensions - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom traits or `analytics.track('event',\ - \ properties)` with custom properties, you need to map those\ - \ traits and properties to Google Analytics custom dimensions\ - \ if you want them to be sent to GA. Enter a trait or property\ - \ name on the left. Choose the Google Analytics dimension\ - \ you want on the right. Google Analytics only accepts numbered\ - \ dimensions (e.g. dimension3). We suggest using user-scoped\ - \ dimensions for trait mappings and hit-scoped dimensions\ - \ for properties [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Dimensions - - name: domain - type: string - defaultValue: "" - description: "_Only data sent from visitors on this domain_\ - \ will be recorded. By default Google Analytics automatically\ - \ resolves the domain name, so you should **leave this blank\ - \ unless you know you want otherwise**! This option is useful\ - \ if you need to ignore data from other domains, or explicitly\ - \ set the domain of your Google Analytics cookie. This is\ - \ known as Override Domain Name in [GA Classic](https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite).\ - \ If you are testing locally, you can set the domain to\ - \ `none`. [Read more about this setting in our docs](https://segment.com/docs/connections/destinations/catalog/google-analytics/#cookie-domain-name)." - required: false - label: Cookie Domain Name - - name: doubleClick - type: boolean - defaultValue: false - description: Works with both Universal and Classic tracking - methods. - required: false - label: "Remarketing, Display Ads and Demographic Reports." - - name: enableServerIdentify - type: boolean - defaultValue: false - description: "If you are sending `.identify()` calls from\ - \ your server side libraries or have Segment Cloud Apps\ - \ that send back `.identify()` calls with enriched user\ - \ traits, you can send that data to your GA account via\ - \ custom dimensions and metrics. Unlike the client side\ - \ integration which has the luxury of browsers and the global\ - \ window `ga` tracker, for server side we will check your\ - \ `traits` and your settings for custom dimension/metric\ - \ mappings and send it with an explicit event. " - required: false - label: Enable Server Side Identify - - name: enhancedEcommerce - type: boolean - defaultValue: false - description: "If you want more detailed reports on ecommerce,\ - \ you might want to enable this feature. Read more about\ - \ it [here](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce)." - required: false - label: Enable Enhanced Ecommerce - - name: enhancedLinkAttribution - type: boolean - defaultValue: false - description: "Provides more detailed reports on the links\ - \ clicked on your site. Read more about it in the [Google\ - \ support documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-link-attribution)." - required: false - label: Enable Enhanced Link Attribution - - name: identifyCategory - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify the trait you want to look up for setting\ - \ the event category will be since all custom metrics/dimensions\ - \ for server side `.identify()` calls will be sent via an\ - \ event hit to GA. The default value will be `'All'`. For\ - \ example, if you are sending `traits.category`, you can\ - \ put 'category' in the setting above and we will send the\ - \ value of this trait as the event category." - required: false - label: Server Side Identify Event Category - - name: identifyEventName - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify what the event action will be since all\ - \ custom metrics/dimensions for server side `.identify()`\ - \ calls will be sent via an event hit to GA. The default\ - \ value will be `'User Enriched'`" - required: false - label: Server Side Identify Event Action - - name: ignoredReferrers - type: strings - defaultValue: [] - description: "Add any domains you want to ignore, separated\ - \ by line breaks. You might use this if you want Google\ - \ Analytics to ignore certain referral domains (e.g. to\ - \ prevent your subdomains from showing up as referrers in\ - \ your analytics). _Note: this only works for Classic profiles.\ - \ Universal profiles can_ [edit their ignored referrers](https://support.google.com/analytics/answer/2795830?hl=en&ref_topic=2790009)\ - \ _directly inside Google Analytics._" - required: false - label: Ignored Referrers - - name: includeSearch - type: boolean - defaultValue: false - description: "The querystring doesn't usually affect the content\ - \ of the page in a significant way (like sorting), so we\ - \ disable this by default." - required: false - label: Include the Querystring in Page Views - - name: metrics - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom numerical traits or `analytics.track('event',\ - \ properties)` with custom numerical properties, you need\ - \ to map those traits and properties to Google Analytics\ - \ custom metrics if you want them to be sent to GA. Enter\ - \ a trait or property name on the left. Choose the Google\ - \ Analytics metric you want on the right. Google Analytics\ - \ only accepts numbered metrics (e.g. metric3). We suggest\ - \ using user-scoped metrics for trait mappings and hit-scoped\ - \ metrics for properties. [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Metrics - - name: mobileTrackingId - type: string - defaultValue: "" - description: "Google Analytics tracks mobile apps separately,\ - \ so you'll want to create a separate Google Analytics mobile\ - \ app property. Remember to only add a mobile tracking ID\ - \ if you're tracking from a mobile library. If you're tracking\ - \ from a hybrid app, fill in your website tracking ID instead.\ - \ Leave it blank if you don't have a mobile app property." - required: true - label: Mobile Tracking ID - - name: nameTracker - type: boolean - defaultValue: false - description: "Name the tracker 'segmentGATracker'. Enable\ - \ this if you're working with additional Google Analytics\ - \ trackers and want to ensure that your Segment tracker\ - \ has a distinct name. If this is enabled you must prepend\ - \ this tracker name to any native Google Analytics (except\ - \ for create) that you call, e.g. 'segmentGATracker.require(....)' " - required: false - label: Name Tracker - - name: nonInteraction - type: boolean - defaultValue: false - description: "Adds a _nonInteraction: true_ flag to every\ - \ non-enhanced ecommerce event tracked to Google Analytics.\ - \ If you're seeing unusually low bounce rates this will\ - \ solve that issue." - required: false - label: Add the non-interaction flag to all events - - name: optimize - type: string - defaultValue: "" - description: Integrate with Google Analytics Optimize plugin. - Please enter your Optimize Container ID - required: false - label: Optimize Container ID - - name: preferAnonymousId - type: boolean - defaultValue: false - description: Enable this setting if you want `clientId` to - always be set as a hash of `anonymousId`. If no `anonymousId` - is present we will fallback to set the `clientId` to `userId`. - This setting only applies to server side connections. - required: false - label: Prefer Anonymous ID for Client ID - Server Side Only - - name: protocolMappings - type: map - defaultValue: {} - description: "If you are using the *server side* GA integration,\ - \ you can map your custom traits or properties to known\ - \ [measurement protocol params](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters)." - required: false - label: Map Traits or Properties to Measurement Protocol Params - - name: reportUncaughtExceptions - type: boolean - defaultValue: false - description: This lets you study errors and exceptions in - your iOS and Android apps in Google Analytics. - required: false - label: Send Uncaught Exceptions to GA (Mobile) - - name: resetCustomDimensionsOnPage - type: array - defaultValue: [] - description: "If you have an SPA website, and need to reset\ - \ custom dimensions between page calls, add to this setting\ - \ all the properties (already mapped as custom dimensions)\ - \ that need to be reset for each page call." - required: false - label: Reset dimensions on Page calls - - name: sampleRate - type: number - defaultValue: 100 - description: "Specifies what percentage of users should be\ - \ tracked. This defaults to 100 (no users are sampled out)\ - \ but large sites may need to use a lower sample rate to\ - \ stay within Google Analytics processing limits as [seen\ - \ here](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#sampleRate).\ - \ Currently only available in the browser - mobile coming\ - \ soon." - required: false - label: Sample Rate - - name: sendUserId - type: boolean - defaultValue: false - description: "User-ID enables the analysis of groups of sessions\ - \ across devices, using a unique and persistent ID. This\ - \ only works with Google Analytics Universal. IMPORTANT:\ - \ Sending email or other personally identifiable information\ - \ (PII) violates Google Analytics Terms of Service." - required: false - label: Send User-ID to GA - - name: serversideClassic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier profiles are Classic. An easy test: if you\ - \ see `_gaq.push` in your code you're using Classic, so\ - \ enable this." - required: false - label: Use Classic Analytics for Your Serverside Tracking - - name: serversideTrackingId - type: string - defaultValue: "" - description: "Your Serverside Tracking ID is the UA code for\ - \ the Google Analytics property you want to send server-side\ - \ calls to. Leave it blank if you don't have a server-side\ - \ client library that you want to send data from. Remember\ - \ that data tracked from mobile integrations that are not\ - \ bundled in your app send data to Google Analytics server\ - \ side, since Segment sends data to them via our own servers." - required: true - label: Serverside Tracking ID - - name: setAllMappedProps - type: boolean - defaultValue: true - description: "Google Analytics allows users to either pass\ - \ custom dimensions / metrics as properties of specific\ - \ events or as properties for all events on a given page\ - \ (or the lifetime of the global tracker object). The default\ - \ Segment behavior is the latter. Any metrics / dimensions\ - \ that are mapped to a given property will be set to the\ - \ page and sent as properties of all subsequent events on\ - \ that page. You can disable this functionality with this\ - \ setting. If disabled, Segment will only pass custom dimensions\ - \ / metrics as part of the payload of the event with which\ - \ they are explicitly associated. Please reference the Google\ - \ Analytics [documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets#implementation)\ - \ for more info." - required: false - label: Set Custom Dimensions & Metrics to the Page - - name: siteSpeedSampleRate - type: number - defaultValue: 1 - description: "Defines the sample size for Site Speed data\ - \ collection. If you have a small number of visitors you\ - \ might want to adjust the sampling to a larger rate for\ - \ your [site speed stats](https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration?hl=en#_gat.GA_Tracker_._setSiteSpeedSampleRate)." - required: false - label: Site Speed Sample Rate - - name: topLevelContextMapping - type: boolean - defaultValue: false - description: "By default, Segment allows mappings from custom\ - \ traits and properties to Google Analytics custom dimensions\ - \ and metrics. If you enable this setting, Segment will\ - \ also send top-level and `context` object fields mapped\ - \ in the **Custom Dimensions** and **Custom Metrics** settings.\ - \ When evaluating mappings, Segment will prioritize properties\ - \ and traits before top-level and `context` fields. This\ - \ setting only applies to server side connections." - required: false - label: Enable Mappings from Top-Level or Context Fields - - Server Side Only - - name: trackCategorizedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `category` associated with them. E.g.\ - \ `page('Docs', 'Index')` translates to **Viewed Docs Page**." - required: false - label: Track Categorized Pages - - name: trackNamedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `name` associated with them. E.g. `page('Signup')`\ - \ translates to **Viewed Signup Page**." - required: false - label: Track Named Pages - - name: trackingId - type: string - defaultValue: "" - description: "Your website's Tracking ID is in the **Tracking\ - \ Info** tab on the [Admin Page](https://www.google.com/analytics/web/#management/Property)\ - \ of Google Analytics. Leave it blank if you don't have\ - \ a website property." - required: true - label: Website Tracking ID - - name: typeOverride - type: boolean - defaultValue: false - description: "By default, Segment sends \"Product List Viewed\"\ - \ and \"Product List Filtered\" ecommerce events to GA as\ - \ \"pageview\" hit types. Enable this setting to instead\ - \ map these two specced Segment track events to GA as \"\ - event\" hit types." - required: false - label: Send Segment "Product List" Events to GA as "Event" - Hits - - name: useGoogleAmpClientId - type: boolean - defaultValue: false - description: "Google’s AMP Client ID API lets you uniquely\ - \ identify users who engage with your content on AMP and\ - \ non-AMP pages. If you opt-in, Google Analytics will use\ - \ the user's AMP Client ID to determine that multiple site\ - \ events belong to the same user when those users visit\ - \ AMP pages via a [Google viewer](https://support.google.com/websearch/answer/7220196).\ - \ Associating events and users provides features like user\ - \ counts and session-based metrics. *Enabling this feature\ - \ will affect your reporting.* Please carefully reference\ - \ Google's [documentation](https://support.google.com/analytics/answer/7486764?hl=en&ref_topic=7378717)\ - \ for more info before you enable it." - required: false - label: Use Google AMP Client ID - - name: userDeletion - type: string - defaultValue: "" - description: 'Sign in to Google Analytics oAuth to enable - User Deletion. ' - required: false - label: User Deletion - status: PUBLIC - categories: - - Analytics - website: http://google.com/analytics - components: - - code: https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: BROWSER - - code: https://github.com/segment-integrations/analytics-ios-integration-google-analytics - owner: SEGMENT - type: IOS - - code: https://github.com/segment-integrations/analytics-android-integration-google-analytics - owner: SEGMENT - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: SERVER - previousNames: - - Google Analytics - - Google Universal Analytics - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: false - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: true - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/getDestination_200_response' - application/json: - example: - data: - destination: - id: fP7qoQw2HTWt9WdMr718gn - enabled: false - name: "" - settings: - anonymizeIp: false - classic: false - contentGroupings: {} - dimensions: {} - domain: "" - doubleClick: false - enableServerIdentify: false - enhancedEcommerce: false - enhancedLinkAttribution: false - identifyCategory: "" - identifyEventName: "" - ignoredReferrers: [] - includeSearch: false - metrics: {} - mobileTrackingId: "123" - nameTracker: false - nonInteraction: false - optimize: "" - preferAnonymousId: false - protocolMappings: {} - reportUncaughtExceptions: false - resetCustomDimensionsOnPage: [] - sampleRate: 100 - sendUserId: false - serversideClassic: false - serversideTrackingId: "123" - setAllMappedProps: true - siteSpeedSampleRate: 1 - topLevelContextMapping: false - trackCategorizedPages: true - trackNamedPages: true - trackingId: "123" - typeOverride: false - useGoogleAmpClientId: false - userDeletion: "" - metadata: - id: 54521fd725e721e32a72eebb - name: Google Universal Analytics - description: Google Universal Analytics is the most popular - analytics tool for the web. It’s free and provides a wide - range of features. It’s especially good at measuring traffic - sources and ad campaigns. - slug: google-analytics - logos: - default: https://cdn.filepicker.io/api/file/anFgceQJTGeMxChCgiyU - mark: https://cdn.filepicker.io/api/file/zebLRcY3RtOlynDXTgNk - options: - - name: anonymizeIp - type: boolean - defaultValue: false - description: "For client side libraries. Read more about anonymizing\ - \ IP addresses from the [Google support documentation](https://support.google.com/analytics/answer/2763052?hl=en)." - required: false - label: Anonymize IP Addresses - - name: classic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier ones are Classic. An easy test: if you see\ - \ `_gaq.push` in your code you're using Classic, so enable\ - \ this." - required: false - label: Use Classic Analytics on Your Site - - name: contentGroupings - type: map - defaultValue: {} - description: "Enter a property name on the left. Choose the\ - \ Google Analytics content grouping you want on the right.\ - \ Google Analytics only accepts numbered content groupings\ - \ (e.g. contentGrouping3). When you use `analytics.page(name,\ - \ properties)` with custom properties, we'll use the value\ - \ of the property you designate as the value of the specified\ - \ content grouping." - required: false - label: Content Groupings - - name: dimensions - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom traits or `analytics.track('event',\ - \ properties)` with custom properties, you need to map those\ - \ traits and properties to Google Analytics custom dimensions\ - \ if you want them to be sent to GA. Enter a trait or property\ - \ name on the left. Choose the Google Analytics dimension\ - \ you want on the right. Google Analytics only accepts numbered\ - \ dimensions (e.g. dimension3). We suggest using user-scoped\ - \ dimensions for trait mappings and hit-scoped dimensions\ - \ for properties [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Dimensions - - name: domain - type: string - defaultValue: "" - description: "_Only data sent from visitors on this domain_\ - \ will be recorded. By default Google Analytics automatically\ - \ resolves the domain name, so you should **leave this blank\ - \ unless you know you want otherwise**! This option is useful\ - \ if you need to ignore data from other domains, or explicitly\ - \ set the domain of your Google Analytics cookie. This is\ - \ known as Override Domain Name in [GA Classic](https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite).\ - \ If you are testing locally, you can set the domain to\ - \ `none`. [Read more about this setting in our docs](https://segment.com/docs/connections/destinations/catalog/google-analytics/#cookie-domain-name)." - required: false - label: Cookie Domain Name - - name: doubleClick - type: boolean - defaultValue: false - description: Works with both Universal and Classic tracking - methods. - required: false - label: "Remarketing, Display Ads and Demographic Reports." - - name: enableServerIdentify - type: boolean - defaultValue: false - description: "If you are sending `.identify()` calls from\ - \ your server side libraries or have Segment Cloud Apps\ - \ that send back `.identify()` calls with enriched user\ - \ traits, you can send that data to your GA account via\ - \ custom dimensions and metrics. Unlike the client side\ - \ integration which has the luxury of browsers and the global\ - \ window `ga` tracker, for server side we will check your\ - \ `traits` and your settings for custom dimension/metric\ - \ mappings and send it with an explicit event. " - required: false - label: Enable Server Side Identify - - name: enhancedEcommerce - type: boolean - defaultValue: false - description: "If you want more detailed reports on ecommerce,\ - \ you might want to enable this feature. Read more about\ - \ it [here](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce)." - required: false - label: Enable Enhanced Ecommerce - - name: enhancedLinkAttribution - type: boolean - defaultValue: false - description: "Provides more detailed reports on the links\ - \ clicked on your site. Read more about it in the [Google\ - \ support documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-link-attribution)." - required: false - label: Enable Enhanced Link Attribution - - name: identifyCategory - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify the trait you want to look up for setting\ - \ the event category will be since all custom metrics/dimensions\ - \ for server side `.identify()` calls will be sent via an\ - \ event hit to GA. The default value will be `'All'`. For\ - \ example, if you are sending `traits.category`, you can\ - \ put 'category' in the setting above and we will send the\ - \ value of this trait as the event category." - required: false - label: Server Side Identify Event Category - - name: identifyEventName - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify what the event action will be since all\ - \ custom metrics/dimensions for server side `.identify()`\ - \ calls will be sent via an event hit to GA. The default\ - \ value will be `'User Enriched'`" - required: false - label: Server Side Identify Event Action - - name: ignoredReferrers - type: strings - defaultValue: [] - description: "Add any domains you want to ignore, separated\ - \ by line breaks. You might use this if you want Google\ - \ Analytics to ignore certain referral domains (e.g. to\ - \ prevent your subdomains from showing up as referrers in\ - \ your analytics). _Note: this only works for Classic profiles.\ - \ Universal profiles can_ [edit their ignored referrers](https://support.google.com/analytics/answer/2795830?hl=en&ref_topic=2790009)\ - \ _directly inside Google Analytics._" - required: false - label: Ignored Referrers - - name: includeSearch - type: boolean - defaultValue: false - description: "The querystring doesn't usually affect the content\ - \ of the page in a significant way (like sorting), so we\ - \ disable this by default." - required: false - label: Include the Querystring in Page Views - - name: metrics - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom numerical traits or `analytics.track('event',\ - \ properties)` with custom numerical properties, you need\ - \ to map those traits and properties to Google Analytics\ - \ custom metrics if you want them to be sent to GA. Enter\ - \ a trait or property name on the left. Choose the Google\ - \ Analytics metric you want on the right. Google Analytics\ - \ only accepts numbered metrics (e.g. metric3). We suggest\ - \ using user-scoped metrics for trait mappings and hit-scoped\ - \ metrics for properties. [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Metrics - - name: mobileTrackingId - type: string - defaultValue: "" - description: "Google Analytics tracks mobile apps separately,\ - \ so you'll want to create a separate Google Analytics mobile\ - \ app property. Remember to only add a mobile tracking ID\ - \ if you're tracking from a mobile library. If you're tracking\ - \ from a hybrid app, fill in your website tracking ID instead.\ - \ Leave it blank if you don't have a mobile app property." - required: true - label: Mobile Tracking ID - - name: nameTracker - type: boolean - defaultValue: false - description: "Name the tracker 'segmentGATracker'. Enable\ - \ this if you're working with additional Google Analytics\ - \ trackers and want to ensure that your Segment tracker\ - \ has a distinct name. If this is enabled you must prepend\ - \ this tracker name to any native Google Analytics (except\ - \ for create) that you call, e.g. 'segmentGATracker.require(....)' " - required: false - label: Name Tracker - - name: nonInteraction - type: boolean - defaultValue: false - description: "Adds a _nonInteraction: true_ flag to every\ - \ non-enhanced ecommerce event tracked to Google Analytics.\ - \ If you're seeing unusually low bounce rates this will\ - \ solve that issue." - required: false - label: Add the non-interaction flag to all events - - name: optimize - type: string - defaultValue: "" - description: Integrate with Google Analytics Optimize plugin. - Please enter your Optimize Container ID - required: false - label: Optimize Container ID - - name: preferAnonymousId - type: boolean - defaultValue: false - description: Enable this setting if you want `clientId` to - always be set as a hash of `anonymousId`. If no `anonymousId` - is present we will fallback to set the `clientId` to `userId`. - This setting only applies to server side connections. - required: false - label: Prefer Anonymous ID for Client ID - Server Side Only - - name: protocolMappings - type: map - defaultValue: {} - description: "If you are using the *server side* GA integration,\ - \ you can map your custom traits or properties to known\ - \ [measurement protocol params](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters)." - required: false - label: Map Traits or Properties to Measurement Protocol Params - - name: reportUncaughtExceptions - type: boolean - defaultValue: false - description: This lets you study errors and exceptions in - your iOS and Android apps in Google Analytics. - required: false - label: Send Uncaught Exceptions to GA (Mobile) - - name: resetCustomDimensionsOnPage - type: array - defaultValue: [] - description: "If you have an SPA website, and need to reset\ - \ custom dimensions between page calls, add to this setting\ - \ all the properties (already mapped as custom dimensions)\ - \ that need to be reset for each page call." - required: false - label: Reset dimensions on Page calls - - name: sampleRate - type: number - defaultValue: 100 - description: "Specifies what percentage of users should be\ - \ tracked. This defaults to 100 (no users are sampled out)\ - \ but large sites may need to use a lower sample rate to\ - \ stay within Google Analytics processing limits as [seen\ - \ here](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#sampleRate).\ - \ Currently only available in the browser - mobile coming\ - \ soon." - required: false - label: Sample Rate - - name: sendUserId - type: boolean - defaultValue: false - description: "User-ID enables the analysis of groups of sessions\ - \ across devices, using a unique and persistent ID. This\ - \ only works with Google Analytics Universal. IMPORTANT:\ - \ Sending email or other personally identifiable information\ - \ (PII) violates Google Analytics Terms of Service." - required: false - label: Send User-ID to GA - - name: serversideClassic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier profiles are Classic. An easy test: if you\ - \ see `_gaq.push` in your code you're using Classic, so\ - \ enable this." - required: false - label: Use Classic Analytics for Your Serverside Tracking - - name: serversideTrackingId - type: string - defaultValue: "" - description: "Your Serverside Tracking ID is the UA code for\ - \ the Google Analytics property you want to send server-side\ - \ calls to. Leave it blank if you don't have a server-side\ - \ client library that you want to send data from. Remember\ - \ that data tracked from mobile integrations that are not\ - \ bundled in your app send data to Google Analytics server\ - \ side, since Segment sends data to them via our own servers." - required: true - label: Serverside Tracking ID - - name: setAllMappedProps - type: boolean - defaultValue: true - description: "Google Analytics allows users to either pass\ - \ custom dimensions / metrics as properties of specific\ - \ events or as properties for all events on a given page\ - \ (or the lifetime of the global tracker object). The default\ - \ Segment behavior is the latter. Any metrics / dimensions\ - \ that are mapped to a given property will be set to the\ - \ page and sent as properties of all subsequent events on\ - \ that page. You can disable this functionality with this\ - \ setting. If disabled, Segment will only pass custom dimensions\ - \ / metrics as part of the payload of the event with which\ - \ they are explicitly associated. Please reference the Google\ - \ Analytics [documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets#implementation)\ - \ for more info." - required: false - label: Set Custom Dimensions & Metrics to the Page - - name: siteSpeedSampleRate - type: number - defaultValue: 1 - description: "Defines the sample size for Site Speed data\ - \ collection. If you have a small number of visitors you\ - \ might want to adjust the sampling to a larger rate for\ - \ your [site speed stats](https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration?hl=en#_gat.GA_Tracker_._setSiteSpeedSampleRate)." - required: false - label: Site Speed Sample Rate - - name: topLevelContextMapping - type: boolean - defaultValue: false - description: "By default, Segment allows mappings from custom\ - \ traits and properties to Google Analytics custom dimensions\ - \ and metrics. If you enable this setting, Segment will\ - \ also send top-level and `context` object fields mapped\ - \ in the **Custom Dimensions** and **Custom Metrics** settings.\ - \ When evaluating mappings, Segment will prioritize properties\ - \ and traits before top-level and `context` fields. This\ - \ setting only applies to server side connections." - required: false - label: Enable Mappings from Top-Level or Context Fields - - Server Side Only - - name: trackCategorizedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `category` associated with them. E.g.\ - \ `page('Docs', 'Index')` translates to **Viewed Docs Page**." - required: false - label: Track Categorized Pages - - name: trackNamedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `name` associated with them. E.g. `page('Signup')`\ - \ translates to **Viewed Signup Page**." - required: false - label: Track Named Pages - - name: trackingId - type: string - defaultValue: "" - description: "Your website's Tracking ID is in the **Tracking\ - \ Info** tab on the [Admin Page](https://www.google.com/analytics/web/#management/Property)\ - \ of Google Analytics. Leave it blank if you don't have\ - \ a website property." - required: true - label: Website Tracking ID - - name: typeOverride - type: boolean - defaultValue: false - description: "By default, Segment sends \"Product List Viewed\"\ - \ and \"Product List Filtered\" ecommerce events to GA as\ - \ \"pageview\" hit types. Enable this setting to instead\ - \ map these two specced Segment track events to GA as \"\ - event\" hit types." - required: false - label: Send Segment "Product List" Events to GA as "Event" - Hits - - name: useGoogleAmpClientId - type: boolean - defaultValue: false - description: "Google’s AMP Client ID API lets you uniquely\ - \ identify users who engage with your content on AMP and\ - \ non-AMP pages. If you opt-in, Google Analytics will use\ - \ the user's AMP Client ID to determine that multiple site\ - \ events belong to the same user when those users visit\ - \ AMP pages via a [Google viewer](https://support.google.com/websearch/answer/7220196).\ - \ Associating events and users provides features like user\ - \ counts and session-based metrics. *Enabling this feature\ - \ will affect your reporting.* Please carefully reference\ - \ Google's [documentation](https://support.google.com/analytics/answer/7486764?hl=en&ref_topic=7378717)\ - \ for more info before you enable it." - required: false - label: Use Google AMP Client ID - - name: userDeletion - type: string - defaultValue: "" - description: 'Sign in to Google Analytics oAuth to enable - User Deletion. ' - required: false - label: User Deletion - status: PUBLIC - categories: - - Analytics - website: http://google.com/analytics - components: - - code: https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: BROWSER - - code: https://github.com/segment-integrations/analytics-ios-integration-google-analytics - owner: SEGMENT - type: IOS - - code: https://github.com/segment-integrations/analytics-android-integration-google-analytics - owner: SEGMENT - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: SERVER - previousNames: - - Google Analytics - - Google Universal Analytics - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: false - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: true - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/getDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Destination - tags: - - Destinations - x-domain-hierarchy: - - Connections - - Destinations - x-accepts: application/json - patch: - deprecated: false - description: "Updates an existing Destination.\n\n**Note**: if you attempt to\ - \ update read-only settings for your destination you'll encounter the following\ - \ behavior:\n\n * If only read-only properties are being updated, the endpoint\ - \ will return an HTTP 400 error.\n * If there's a mix of writable and read-only\ - \ properties in the payload, the request will be accepted, the writable properties\ - \ will be updated and the read-only properties ignored.\n\n\n\n\nWhen called,\ - \ this endpoint may generate the `Integration Disabled` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n\nConfig API omitted fields:\n- `updateMask`\n " - operationId: updateDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - destinationId: fP7qoQw2HTWt9WdMr718gn - enabled: false - schema: - $ref: '#/components/schemas/UpdateDestinationV1Input' - application/vnd.segment.v1beta+json: - example: - destinationId: fP7qoQw2HTWt9WdMr718gn - enabled: false - schema: - $ref: '#/components/schemas/UpdateDestinationV1Input' - application/vnd.segment.v1+json: - example: - destinationId: fP7qoQw2HTWt9WdMr718gn - enabled: false - schema: - $ref: '#/components/schemas/UpdateDestinationV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - destination: - id: fP7qoQw2HTWt9WdMr718gn - enabled: false - name: "" - settings: - anonymizeIp: false - classic: false - contentGroupings: {} - dimensions: {} - domain: "" - doubleClick: false - enableServerIdentify: false - enhancedEcommerce: false - enhancedLinkAttribution: false - identifyCategory: "" - identifyEventName: "" - ignoredReferrers: [] - includeSearch: false - metrics: {} - mobileTrackingId: "123" - nameTracker: false - nonInteraction: false - optimize: "" - preferAnonymousId: false - protocolMappings: {} - reportUncaughtExceptions: false - resetCustomDimensionsOnPage: [] - sampleRate: 100 - sendUserId: false - serversideClassic: false - serversideTrackingId: "123" - setAllMappedProps: true - siteSpeedSampleRate: 1 - topLevelContextMapping: false - trackCategorizedPages: true - trackNamedPages: true - trackingId: "123" - typeOverride: false - useGoogleAmpClientId: false - userDeletion: "" - metadata: - id: 54521fd725e721e32a72eebb - name: Google Universal Analytics - description: Google Universal Analytics is the most popular - analytics tool for the web. It’s free and provides a wide - range of features. It’s especially good at measuring traffic - sources and ad campaigns. - slug: google-analytics - logos: - default: https://cdn.filepicker.io/api/file/anFgceQJTGeMxChCgiyU - mark: https://cdn.filepicker.io/api/file/zebLRcY3RtOlynDXTgNk - options: - - name: anonymizeIp - type: boolean - defaultValue: false - description: "For client side libraries. Read more about anonymizing\ - \ IP addresses from the [Google support documentation](https://support.google.com/analytics/answer/2763052?hl=en)." - required: false - label: Anonymize IP Addresses - - name: classic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier ones are Classic. An easy test: if you see\ - \ `_gaq.push` in your code you're using Classic, so enable\ - \ this." - required: false - label: Use Classic Analytics on Your Site - - name: contentGroupings - type: map - defaultValue: {} - description: "Enter a property name on the left. Choose the\ - \ Google Analytics content grouping you want on the right.\ - \ Google Analytics only accepts numbered content groupings\ - \ (e.g. contentGrouping3). When you use `analytics.page(name,\ - \ properties)` with custom properties, we'll use the value\ - \ of the property you designate as the value of the specified\ - \ content grouping." - required: false - label: Content Groupings - - name: dimensions - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom traits or `analytics.track('event',\ - \ properties)` with custom properties, you need to map those\ - \ traits and properties to Google Analytics custom dimensions\ - \ if you want them to be sent to GA. Enter a trait or property\ - \ name on the left. Choose the Google Analytics dimension\ - \ you want on the right. Google Analytics only accepts numbered\ - \ dimensions (e.g. dimension3). We suggest using user-scoped\ - \ dimensions for trait mappings and hit-scoped dimensions\ - \ for properties [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Dimensions - - name: domain - type: string - defaultValue: "" - description: "_Only data sent from visitors on this domain_\ - \ will be recorded. By default Google Analytics automatically\ - \ resolves the domain name, so you should **leave this blank\ - \ unless you know you want otherwise**! This option is useful\ - \ if you need to ignore data from other domains, or explicitly\ - \ set the domain of your Google Analytics cookie. This is\ - \ known as Override Domain Name in [GA Classic](https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite).\ - \ If you are testing locally, you can set the domain to\ - \ `none`. [Read more about this setting in our docs](https://segment.com/docs/connections/destinations/catalog/google-analytics/#cookie-domain-name)." - required: false - label: Cookie Domain Name - - name: doubleClick - type: boolean - defaultValue: false - description: Works with both Universal and Classic tracking - methods. - required: false - label: "Remarketing, Display Ads and Demographic Reports." - - name: enableServerIdentify - type: boolean - defaultValue: false - description: "If you are sending `.identify()` calls from\ - \ your server side libraries or have Segment Cloud Apps\ - \ that send back `.identify()` calls with enriched user\ - \ traits, you can send that data to your GA account via\ - \ custom dimensions and metrics. Unlike the client side\ - \ integration which has the luxury of browsers and the global\ - \ window `ga` tracker, for server side we will check your\ - \ `traits` and your settings for custom dimension/metric\ - \ mappings and send it with an explicit event. " - required: false - label: Enable Server Side Identify - - name: enhancedEcommerce - type: boolean - defaultValue: false - description: "If you want more detailed reports on ecommerce,\ - \ you might want to enable this feature. Read more about\ - \ it [here](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce)." - required: false - label: Enable Enhanced Ecommerce - - name: enhancedLinkAttribution - type: boolean - defaultValue: false - description: "Provides more detailed reports on the links\ - \ clicked on your site. Read more about it in the [Google\ - \ support documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-link-attribution)." - required: false - label: Enable Enhanced Link Attribution - - name: identifyCategory - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify the trait you want to look up for setting\ - \ the event category will be since all custom metrics/dimensions\ - \ for server side `.identify()` calls will be sent via an\ - \ event hit to GA. The default value will be `'All'`. For\ - \ example, if you are sending `traits.category`, you can\ - \ put 'category' in the setting above and we will send the\ - \ value of this trait as the event category." - required: false - label: Server Side Identify Event Category - - name: identifyEventName - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify what the event action will be since all\ - \ custom metrics/dimensions for server side `.identify()`\ - \ calls will be sent via an event hit to GA. The default\ - \ value will be `'User Enriched'`" - required: false - label: Server Side Identify Event Action - - name: ignoredReferrers - type: strings - defaultValue: [] - description: "Add any domains you want to ignore, separated\ - \ by line breaks. You might use this if you want Google\ - \ Analytics to ignore certain referral domains (e.g. to\ - \ prevent your subdomains from showing up as referrers in\ - \ your analytics). _Note: this only works for Classic profiles.\ - \ Universal profiles can_ [edit their ignored referrers](https://support.google.com/analytics/answer/2795830?hl=en&ref_topic=2790009)\ - \ _directly inside Google Analytics._" - required: false - label: Ignored Referrers - - name: includeSearch - type: boolean - defaultValue: false - description: "The querystring doesn't usually affect the content\ - \ of the page in a significant way (like sorting), so we\ - \ disable this by default." - required: false - label: Include the Querystring in Page Views - - name: metrics - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom numerical traits or `analytics.track('event',\ - \ properties)` with custom numerical properties, you need\ - \ to map those traits and properties to Google Analytics\ - \ custom metrics if you want them to be sent to GA. Enter\ - \ a trait or property name on the left. Choose the Google\ - \ Analytics metric you want on the right. Google Analytics\ - \ only accepts numbered metrics (e.g. metric3). We suggest\ - \ using user-scoped metrics for trait mappings and hit-scoped\ - \ metrics for properties. [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Metrics - - name: mobileTrackingId - type: string - defaultValue: "" - description: "Google Analytics tracks mobile apps separately,\ - \ so you'll want to create a separate Google Analytics mobile\ - \ app property. Remember to only add a mobile tracking ID\ - \ if you're tracking from a mobile library. If you're tracking\ - \ from a hybrid app, fill in your website tracking ID instead.\ - \ Leave it blank if you don't have a mobile app property." - required: true - label: Mobile Tracking ID - - name: nameTracker - type: boolean - defaultValue: false - description: "Name the tracker 'segmentGATracker'. Enable\ - \ this if you're working with additional Google Analytics\ - \ trackers and want to ensure that your Segment tracker\ - \ has a distinct name. If this is enabled you must prepend\ - \ this tracker name to any native Google Analytics (except\ - \ for create) that you call, e.g. 'segmentGATracker.require(....)' " - required: false - label: Name Tracker - - name: nonInteraction - type: boolean - defaultValue: false - description: "Adds a _nonInteraction: true_ flag to every\ - \ non-enhanced ecommerce event tracked to Google Analytics.\ - \ If you're seeing unusually low bounce rates this will\ - \ solve that issue." - required: false - label: Add the non-interaction flag to all events - - name: optimize - type: string - defaultValue: "" - description: Integrate with Google Analytics Optimize plugin. - Please enter your Optimize Container ID - required: false - label: Optimize Container ID - - name: preferAnonymousId - type: boolean - defaultValue: false - description: Enable this setting if you want `clientId` to - always be set as a hash of `anonymousId`. If no `anonymousId` - is present we will fallback to set the `clientId` to `userId`. - This setting only applies to server side connections. - required: false - label: Prefer Anonymous ID for Client ID - Server Side Only - - name: protocolMappings - type: map - defaultValue: {} - description: "If you are using the *server side* GA integration,\ - \ you can map your custom traits or properties to known\ - \ [measurement protocol params](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters)." - required: false - label: Map Traits or Properties to Measurement Protocol Params - - name: reportUncaughtExceptions - type: boolean - defaultValue: false - description: This lets you study errors and exceptions in - your iOS and Android apps in Google Analytics. - required: false - label: Send Uncaught Exceptions to GA (Mobile) - - name: resetCustomDimensionsOnPage - type: array - defaultValue: [] - description: "If you have an SPA website, and need to reset\ - \ custom dimensions between page calls, add to this setting\ - \ all the properties (already mapped as custom dimensions)\ - \ that need to be reset for each page call." - required: false - label: Reset dimensions on Page calls - - name: sampleRate - type: number - defaultValue: 100 - description: "Specifies what percentage of users should be\ - \ tracked. This defaults to 100 (no users are sampled out)\ - \ but large sites may need to use a lower sample rate to\ - \ stay within Google Analytics processing limits as [seen\ - \ here](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#sampleRate).\ - \ Currently only available in the browser - mobile coming\ - \ soon." - required: false - label: Sample Rate - - name: sendUserId - type: boolean - defaultValue: false - description: "User-ID enables the analysis of groups of sessions\ - \ across devices, using a unique and persistent ID. This\ - \ only works with Google Analytics Universal. IMPORTANT:\ - \ Sending email or other personally identifiable information\ - \ (PII) violates Google Analytics Terms of Service." - required: false - label: Send User-ID to GA - - name: serversideClassic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier profiles are Classic. An easy test: if you\ - \ see `_gaq.push` in your code you're using Classic, so\ - \ enable this." - required: false - label: Use Classic Analytics for Your Serverside Tracking - - name: serversideTrackingId - type: string - defaultValue: "" - description: "Your Serverside Tracking ID is the UA code for\ - \ the Google Analytics property you want to send server-side\ - \ calls to. Leave it blank if you don't have a server-side\ - \ client library that you want to send data from. Remember\ - \ that data tracked from mobile integrations that are not\ - \ bundled in your app send data to Google Analytics server\ - \ side, since Segment sends data to them via our own servers." - required: true - label: Serverside Tracking ID - - name: setAllMappedProps - type: boolean - defaultValue: true - description: "Google Analytics allows users to either pass\ - \ custom dimensions / metrics as properties of specific\ - \ events or as properties for all events on a given page\ - \ (or the lifetime of the global tracker object). The default\ - \ Segment behavior is the latter. Any metrics / dimensions\ - \ that are mapped to a given property will be set to the\ - \ page and sent as properties of all subsequent events on\ - \ that page. You can disable this functionality with this\ - \ setting. If disabled, Segment will only pass custom dimensions\ - \ / metrics as part of the payload of the event with which\ - \ they are explicitly associated. Please reference the Google\ - \ Analytics [documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets#implementation)\ - \ for more info." - required: false - label: Set Custom Dimensions & Metrics to the Page - - name: siteSpeedSampleRate - type: number - defaultValue: 1 - description: "Defines the sample size for Site Speed data\ - \ collection. If you have a small number of visitors you\ - \ might want to adjust the sampling to a larger rate for\ - \ your [site speed stats](https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration?hl=en#_gat.GA_Tracker_._setSiteSpeedSampleRate)." - required: false - label: Site Speed Sample Rate - - name: topLevelContextMapping - type: boolean - defaultValue: false - description: "By default, Segment allows mappings from custom\ - \ traits and properties to Google Analytics custom dimensions\ - \ and metrics. If you enable this setting, Segment will\ - \ also send top-level and `context` object fields mapped\ - \ in the **Custom Dimensions** and **Custom Metrics** settings.\ - \ When evaluating mappings, Segment will prioritize properties\ - \ and traits before top-level and `context` fields. This\ - \ setting only applies to server side connections." - required: false - label: Enable Mappings from Top-Level or Context Fields - - Server Side Only - - name: trackCategorizedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `category` associated with them. E.g.\ - \ `page('Docs', 'Index')` translates to **Viewed Docs Page**." - required: false - label: Track Categorized Pages - - name: trackNamedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `name` associated with them. E.g. `page('Signup')`\ - \ translates to **Viewed Signup Page**." - required: false - label: Track Named Pages - - name: trackingId - type: string - defaultValue: "" - description: "Your website's Tracking ID is in the **Tracking\ - \ Info** tab on the [Admin Page](https://www.google.com/analytics/web/#management/Property)\ - \ of Google Analytics. Leave it blank if you don't have\ - \ a website property." - required: true - label: Website Tracking ID - - name: typeOverride - type: boolean - defaultValue: false - description: "By default, Segment sends \"Product List Viewed\"\ - \ and \"Product List Filtered\" ecommerce events to GA as\ - \ \"pageview\" hit types. Enable this setting to instead\ - \ map these two specced Segment track events to GA as \"\ - event\" hit types." - required: false - label: Send Segment "Product List" Events to GA as "Event" - Hits - - name: useGoogleAmpClientId - type: boolean - defaultValue: false - description: "Google’s AMP Client ID API lets you uniquely\ - \ identify users who engage with your content on AMP and\ - \ non-AMP pages. If you opt-in, Google Analytics will use\ - \ the user's AMP Client ID to determine that multiple site\ - \ events belong to the same user when those users visit\ - \ AMP pages via a [Google viewer](https://support.google.com/websearch/answer/7220196).\ - \ Associating events and users provides features like user\ - \ counts and session-based metrics. *Enabling this feature\ - \ will affect your reporting.* Please carefully reference\ - \ Google's [documentation](https://support.google.com/analytics/answer/7486764?hl=en&ref_topic=7378717)\ - \ for more info before you enable it." - required: false - label: Use Google AMP Client ID - - name: userDeletion - type: string - defaultValue: "" - description: 'Sign in to Google Analytics oAuth to enable - User Deletion. ' - required: false - label: User Deletion - status: PUBLIC - categories: - - Analytics - website: http://google.com/analytics - components: - - code: https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: BROWSER - - code: https://github.com/segment-integrations/analytics-ios-integration-google-analytics - owner: SEGMENT - type: IOS - - code: https://github.com/segment-integrations/analytics-android-integration-google-analytics - owner: SEGMENT - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: SERVER - previousNames: - - Google Analytics - - Google Universal Analytics - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: false - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: true - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/updateDestination_200_response' - application/vnd.segment.v1beta+json: - example: - data: - destination: - id: fP7qoQw2HTWt9WdMr718gn - enabled: false - name: "" - settings: - anonymizeIp: false - classic: false - contentGroupings: {} - dimensions: {} - domain: "" - doubleClick: false - enableServerIdentify: false - enhancedEcommerce: false - enhancedLinkAttribution: false - identifyCategory: "" - identifyEventName: "" - ignoredReferrers: [] - includeSearch: false - metrics: {} - mobileTrackingId: "123" - nameTracker: false - nonInteraction: false - optimize: "" - preferAnonymousId: false - protocolMappings: {} - reportUncaughtExceptions: false - resetCustomDimensionsOnPage: [] - sampleRate: 100 - sendUserId: false - serversideClassic: false - serversideTrackingId: "123" - setAllMappedProps: true - siteSpeedSampleRate: 1 - topLevelContextMapping: false - trackCategorizedPages: true - trackNamedPages: true - trackingId: "123" - typeOverride: false - useGoogleAmpClientId: false - userDeletion: "" - metadata: - id: 54521fd725e721e32a72eebb - name: Google Universal Analytics - description: Google Universal Analytics is the most popular - analytics tool for the web. It’s free and provides a wide - range of features. It’s especially good at measuring traffic - sources and ad campaigns. - slug: google-analytics - logos: - default: https://cdn.filepicker.io/api/file/anFgceQJTGeMxChCgiyU - mark: https://cdn.filepicker.io/api/file/zebLRcY3RtOlynDXTgNk - options: - - name: anonymizeIp - type: boolean - defaultValue: false - description: "For client side libraries. Read more about anonymizing\ - \ IP addresses from the [Google support documentation](https://support.google.com/analytics/answer/2763052?hl=en)." - required: false - label: Anonymize IP Addresses - - name: classic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier ones are Classic. An easy test: if you see\ - \ `_gaq.push` in your code you're using Classic, so enable\ - \ this." - required: false - label: Use Classic Analytics on Your Site - - name: contentGroupings - type: map - defaultValue: {} - description: "Enter a property name on the left. Choose the\ - \ Google Analytics content grouping you want on the right.\ - \ Google Analytics only accepts numbered content groupings\ - \ (e.g. contentGrouping3). When you use `analytics.page(name,\ - \ properties)` with custom properties, we'll use the value\ - \ of the property you designate as the value of the specified\ - \ content grouping." - required: false - label: Content Groupings - - name: dimensions - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom traits or `analytics.track('event',\ - \ properties)` with custom properties, you need to map those\ - \ traits and properties to Google Analytics custom dimensions\ - \ if you want them to be sent to GA. Enter a trait or property\ - \ name on the left. Choose the Google Analytics dimension\ - \ you want on the right. Google Analytics only accepts numbered\ - \ dimensions (e.g. dimension3). We suggest using user-scoped\ - \ dimensions for trait mappings and hit-scoped dimensions\ - \ for properties [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Dimensions - - name: domain - type: string - defaultValue: "" - description: "_Only data sent from visitors on this domain_\ - \ will be recorded. By default Google Analytics automatically\ - \ resolves the domain name, so you should **leave this blank\ - \ unless you know you want otherwise**! This option is useful\ - \ if you need to ignore data from other domains, or explicitly\ - \ set the domain of your Google Analytics cookie. This is\ - \ known as Override Domain Name in [GA Classic](https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite).\ - \ If you are testing locally, you can set the domain to\ - \ `none`. [Read more about this setting in our docs](https://segment.com/docs/connections/destinations/catalog/google-analytics/#cookie-domain-name)." - required: false - label: Cookie Domain Name - - name: doubleClick - type: boolean - defaultValue: false - description: Works with both Universal and Classic tracking - methods. - required: false - label: "Remarketing, Display Ads and Demographic Reports." - - name: enableServerIdentify - type: boolean - defaultValue: false - description: "If you are sending `.identify()` calls from\ - \ your server side libraries or have Segment Cloud Apps\ - \ that send back `.identify()` calls with enriched user\ - \ traits, you can send that data to your GA account via\ - \ custom dimensions and metrics. Unlike the client side\ - \ integration which has the luxury of browsers and the global\ - \ window `ga` tracker, for server side we will check your\ - \ `traits` and your settings for custom dimension/metric\ - \ mappings and send it with an explicit event. " - required: false - label: Enable Server Side Identify - - name: enhancedEcommerce - type: boolean - defaultValue: false - description: "If you want more detailed reports on ecommerce,\ - \ you might want to enable this feature. Read more about\ - \ it [here](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce)." - required: false - label: Enable Enhanced Ecommerce - - name: enhancedLinkAttribution - type: boolean - defaultValue: false - description: "Provides more detailed reports on the links\ - \ clicked on your site. Read more about it in the [Google\ - \ support documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-link-attribution)." - required: false - label: Enable Enhanced Link Attribution - - name: identifyCategory - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify the trait you want to look up for setting\ - \ the event category will be since all custom metrics/dimensions\ - \ for server side `.identify()` calls will be sent via an\ - \ event hit to GA. The default value will be `'All'`. For\ - \ example, if you are sending `traits.category`, you can\ - \ put 'category' in the setting above and we will send the\ - \ value of this trait as the event category." - required: false - label: Server Side Identify Event Category - - name: identifyEventName - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify what the event action will be since all\ - \ custom metrics/dimensions for server side `.identify()`\ - \ calls will be sent via an event hit to GA. The default\ - \ value will be `'User Enriched'`" - required: false - label: Server Side Identify Event Action - - name: ignoredReferrers - type: strings - defaultValue: [] - description: "Add any domains you want to ignore, separated\ - \ by line breaks. You might use this if you want Google\ - \ Analytics to ignore certain referral domains (e.g. to\ - \ prevent your subdomains from showing up as referrers in\ - \ your analytics). _Note: this only works for Classic profiles.\ - \ Universal profiles can_ [edit their ignored referrers](https://support.google.com/analytics/answer/2795830?hl=en&ref_topic=2790009)\ - \ _directly inside Google Analytics._" - required: false - label: Ignored Referrers - - name: includeSearch - type: boolean - defaultValue: false - description: "The querystring doesn't usually affect the content\ - \ of the page in a significant way (like sorting), so we\ - \ disable this by default." - required: false - label: Include the Querystring in Page Views - - name: metrics - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom numerical traits or `analytics.track('event',\ - \ properties)` with custom numerical properties, you need\ - \ to map those traits and properties to Google Analytics\ - \ custom metrics if you want them to be sent to GA. Enter\ - \ a trait or property name on the left. Choose the Google\ - \ Analytics metric you want on the right. Google Analytics\ - \ only accepts numbered metrics (e.g. metric3). We suggest\ - \ using user-scoped metrics for trait mappings and hit-scoped\ - \ metrics for properties. [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Metrics - - name: mobileTrackingId - type: string - defaultValue: "" - description: "Google Analytics tracks mobile apps separately,\ - \ so you'll want to create a separate Google Analytics mobile\ - \ app property. Remember to only add a mobile tracking ID\ - \ if you're tracking from a mobile library. If you're tracking\ - \ from a hybrid app, fill in your website tracking ID instead.\ - \ Leave it blank if you don't have a mobile app property." - required: true - label: Mobile Tracking ID - - name: nameTracker - type: boolean - defaultValue: false - description: "Name the tracker 'segmentGATracker'. Enable\ - \ this if you're working with additional Google Analytics\ - \ trackers and want to ensure that your Segment tracker\ - \ has a distinct name. If this is enabled you must prepend\ - \ this tracker name to any native Google Analytics (except\ - \ for create) that you call, e.g. 'segmentGATracker.require(....)' " - required: false - label: Name Tracker - - name: nonInteraction - type: boolean - defaultValue: false - description: "Adds a _nonInteraction: true_ flag to every\ - \ non-enhanced ecommerce event tracked to Google Analytics.\ - \ If you're seeing unusually low bounce rates this will\ - \ solve that issue." - required: false - label: Add the non-interaction flag to all events - - name: optimize - type: string - defaultValue: "" - description: Integrate with Google Analytics Optimize plugin. - Please enter your Optimize Container ID - required: false - label: Optimize Container ID - - name: preferAnonymousId - type: boolean - defaultValue: false - description: Enable this setting if you want `clientId` to - always be set as a hash of `anonymousId`. If no `anonymousId` - is present we will fallback to set the `clientId` to `userId`. - This setting only applies to server side connections. - required: false - label: Prefer Anonymous ID for Client ID - Server Side Only - - name: protocolMappings - type: map - defaultValue: {} - description: "If you are using the *server side* GA integration,\ - \ you can map your custom traits or properties to known\ - \ [measurement protocol params](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters)." - required: false - label: Map Traits or Properties to Measurement Protocol Params - - name: reportUncaughtExceptions - type: boolean - defaultValue: false - description: This lets you study errors and exceptions in - your iOS and Android apps in Google Analytics. - required: false - label: Send Uncaught Exceptions to GA (Mobile) - - name: resetCustomDimensionsOnPage - type: array - defaultValue: [] - description: "If you have an SPA website, and need to reset\ - \ custom dimensions between page calls, add to this setting\ - \ all the properties (already mapped as custom dimensions)\ - \ that need to be reset for each page call." - required: false - label: Reset dimensions on Page calls - - name: sampleRate - type: number - defaultValue: 100 - description: "Specifies what percentage of users should be\ - \ tracked. This defaults to 100 (no users are sampled out)\ - \ but large sites may need to use a lower sample rate to\ - \ stay within Google Analytics processing limits as [seen\ - \ here](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#sampleRate).\ - \ Currently only available in the browser - mobile coming\ - \ soon." - required: false - label: Sample Rate - - name: sendUserId - type: boolean - defaultValue: false - description: "User-ID enables the analysis of groups of sessions\ - \ across devices, using a unique and persistent ID. This\ - \ only works with Google Analytics Universal. IMPORTANT:\ - \ Sending email or other personally identifiable information\ - \ (PII) violates Google Analytics Terms of Service." - required: false - label: Send User-ID to GA - - name: serversideClassic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier profiles are Classic. An easy test: if you\ - \ see `_gaq.push` in your code you're using Classic, so\ - \ enable this." - required: false - label: Use Classic Analytics for Your Serverside Tracking - - name: serversideTrackingId - type: string - defaultValue: "" - description: "Your Serverside Tracking ID is the UA code for\ - \ the Google Analytics property you want to send server-side\ - \ calls to. Leave it blank if you don't have a server-side\ - \ client library that you want to send data from. Remember\ - \ that data tracked from mobile integrations that are not\ - \ bundled in your app send data to Google Analytics server\ - \ side, since Segment sends data to them via our own servers." - required: true - label: Serverside Tracking ID - - name: setAllMappedProps - type: boolean - defaultValue: true - description: "Google Analytics allows users to either pass\ - \ custom dimensions / metrics as properties of specific\ - \ events or as properties for all events on a given page\ - \ (or the lifetime of the global tracker object). The default\ - \ Segment behavior is the latter. Any metrics / dimensions\ - \ that are mapped to a given property will be set to the\ - \ page and sent as properties of all subsequent events on\ - \ that page. You can disable this functionality with this\ - \ setting. If disabled, Segment will only pass custom dimensions\ - \ / metrics as part of the payload of the event with which\ - \ they are explicitly associated. Please reference the Google\ - \ Analytics [documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets#implementation)\ - \ for more info." - required: false - label: Set Custom Dimensions & Metrics to the Page - - name: siteSpeedSampleRate - type: number - defaultValue: 1 - description: "Defines the sample size for Site Speed data\ - \ collection. If you have a small number of visitors you\ - \ might want to adjust the sampling to a larger rate for\ - \ your [site speed stats](https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration?hl=en#_gat.GA_Tracker_._setSiteSpeedSampleRate)." - required: false - label: Site Speed Sample Rate - - name: topLevelContextMapping - type: boolean - defaultValue: false - description: "By default, Segment allows mappings from custom\ - \ traits and properties to Google Analytics custom dimensions\ - \ and metrics. If you enable this setting, Segment will\ - \ also send top-level and `context` object fields mapped\ - \ in the **Custom Dimensions** and **Custom Metrics** settings.\ - \ When evaluating mappings, Segment will prioritize properties\ - \ and traits before top-level and `context` fields. This\ - \ setting only applies to server side connections." - required: false - label: Enable Mappings from Top-Level or Context Fields - - Server Side Only - - name: trackCategorizedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `category` associated with them. E.g.\ - \ `page('Docs', 'Index')` translates to **Viewed Docs Page**." - required: false - label: Track Categorized Pages - - name: trackNamedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `name` associated with them. E.g. `page('Signup')`\ - \ translates to **Viewed Signup Page**." - required: false - label: Track Named Pages - - name: trackingId - type: string - defaultValue: "" - description: "Your website's Tracking ID is in the **Tracking\ - \ Info** tab on the [Admin Page](https://www.google.com/analytics/web/#management/Property)\ - \ of Google Analytics. Leave it blank if you don't have\ - \ a website property." - required: true - label: Website Tracking ID - - name: typeOverride - type: boolean - defaultValue: false - description: "By default, Segment sends \"Product List Viewed\"\ - \ and \"Product List Filtered\" ecommerce events to GA as\ - \ \"pageview\" hit types. Enable this setting to instead\ - \ map these two specced Segment track events to GA as \"\ - event\" hit types." - required: false - label: Send Segment "Product List" Events to GA as "Event" - Hits - - name: useGoogleAmpClientId - type: boolean - defaultValue: false - description: "Google’s AMP Client ID API lets you uniquely\ - \ identify users who engage with your content on AMP and\ - \ non-AMP pages. If you opt-in, Google Analytics will use\ - \ the user's AMP Client ID to determine that multiple site\ - \ events belong to the same user when those users visit\ - \ AMP pages via a [Google viewer](https://support.google.com/websearch/answer/7220196).\ - \ Associating events and users provides features like user\ - \ counts and session-based metrics. *Enabling this feature\ - \ will affect your reporting.* Please carefully reference\ - \ Google's [documentation](https://support.google.com/analytics/answer/7486764?hl=en&ref_topic=7378717)\ - \ for more info before you enable it." - required: false - label: Use Google AMP Client ID - - name: userDeletion - type: string - defaultValue: "" - description: 'Sign in to Google Analytics oAuth to enable - User Deletion. ' - required: false - label: User Deletion - status: PUBLIC - categories: - - Analytics - website: http://google.com/analytics - components: - - code: https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: BROWSER - - code: https://github.com/segment-integrations/analytics-ios-integration-google-analytics - owner: SEGMENT - type: IOS - - code: https://github.com/segment-integrations/analytics-android-integration-google-analytics - owner: SEGMENT - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: SERVER - previousNames: - - Google Analytics - - Google Universal Analytics - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: false - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: true - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/updateDestination_200_response' - application/vnd.segment.v1+json: - example: - data: - destination: - id: fP7qoQw2HTWt9WdMr718gn - enabled: false - name: "" - settings: - anonymizeIp: false - classic: false - contentGroupings: {} - dimensions: {} - domain: "" - doubleClick: false - enableServerIdentify: false - enhancedEcommerce: false - enhancedLinkAttribution: false - identifyCategory: "" - identifyEventName: "" - ignoredReferrers: [] - includeSearch: false - metrics: {} - mobileTrackingId: "123" - nameTracker: false - nonInteraction: false - optimize: "" - preferAnonymousId: false - protocolMappings: {} - reportUncaughtExceptions: false - resetCustomDimensionsOnPage: [] - sampleRate: 100 - sendUserId: false - serversideClassic: false - serversideTrackingId: "123" - setAllMappedProps: true - siteSpeedSampleRate: 1 - topLevelContextMapping: false - trackCategorizedPages: true - trackNamedPages: true - trackingId: "123" - typeOverride: false - useGoogleAmpClientId: false - userDeletion: "" - metadata: - id: 54521fd725e721e32a72eebb - name: Google Universal Analytics - description: Google Universal Analytics is the most popular - analytics tool for the web. It’s free and provides a wide - range of features. It’s especially good at measuring traffic - sources and ad campaigns. - slug: google-analytics - logos: - default: https://cdn.filepicker.io/api/file/anFgceQJTGeMxChCgiyU - mark: https://cdn.filepicker.io/api/file/zebLRcY3RtOlynDXTgNk - options: - - name: anonymizeIp - type: boolean - defaultValue: false - description: "For client side libraries. Read more about anonymizing\ - \ IP addresses from the [Google support documentation](https://support.google.com/analytics/answer/2763052?hl=en)." - required: false - label: Anonymize IP Addresses - - name: classic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier ones are Classic. An easy test: if you see\ - \ `_gaq.push` in your code you're using Classic, so enable\ - \ this." - required: false - label: Use Classic Analytics on Your Site - - name: contentGroupings - type: map - defaultValue: {} - description: "Enter a property name on the left. Choose the\ - \ Google Analytics content grouping you want on the right.\ - \ Google Analytics only accepts numbered content groupings\ - \ (e.g. contentGrouping3). When you use `analytics.page(name,\ - \ properties)` with custom properties, we'll use the value\ - \ of the property you designate as the value of the specified\ - \ content grouping." - required: false - label: Content Groupings - - name: dimensions - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom traits or `analytics.track('event',\ - \ properties)` with custom properties, you need to map those\ - \ traits and properties to Google Analytics custom dimensions\ - \ if you want them to be sent to GA. Enter a trait or property\ - \ name on the left. Choose the Google Analytics dimension\ - \ you want on the right. Google Analytics only accepts numbered\ - \ dimensions (e.g. dimension3). We suggest using user-scoped\ - \ dimensions for trait mappings and hit-scoped dimensions\ - \ for properties [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Dimensions - - name: domain - type: string - defaultValue: "" - description: "_Only data sent from visitors on this domain_\ - \ will be recorded. By default Google Analytics automatically\ - \ resolves the domain name, so you should **leave this blank\ - \ unless you know you want otherwise**! This option is useful\ - \ if you need to ignore data from other domains, or explicitly\ - \ set the domain of your Google Analytics cookie. This is\ - \ known as Override Domain Name in [GA Classic](https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite).\ - \ If you are testing locally, you can set the domain to\ - \ `none`. [Read more about this setting in our docs](https://segment.com/docs/connections/destinations/catalog/google-analytics/#cookie-domain-name)." - required: false - label: Cookie Domain Name - - name: doubleClick - type: boolean - defaultValue: false - description: Works with both Universal and Classic tracking - methods. - required: false - label: "Remarketing, Display Ads and Demographic Reports." - - name: enableServerIdentify - type: boolean - defaultValue: false - description: "If you are sending `.identify()` calls from\ - \ your server side libraries or have Segment Cloud Apps\ - \ that send back `.identify()` calls with enriched user\ - \ traits, you can send that data to your GA account via\ - \ custom dimensions and metrics. Unlike the client side\ - \ integration which has the luxury of browsers and the global\ - \ window `ga` tracker, for server side we will check your\ - \ `traits` and your settings for custom dimension/metric\ - \ mappings and send it with an explicit event. " - required: false - label: Enable Server Side Identify - - name: enhancedEcommerce - type: boolean - defaultValue: false - description: "If you want more detailed reports on ecommerce,\ - \ you might want to enable this feature. Read more about\ - \ it [here](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce)." - required: false - label: Enable Enhanced Ecommerce - - name: enhancedLinkAttribution - type: boolean - defaultValue: false - description: "Provides more detailed reports on the links\ - \ clicked on your site. Read more about it in the [Google\ - \ support documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-link-attribution)." - required: false - label: Enable Enhanced Link Attribution - - name: identifyCategory - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify the trait you want to look up for setting\ - \ the event category will be since all custom metrics/dimensions\ - \ for server side `.identify()` calls will be sent via an\ - \ event hit to GA. The default value will be `'All'`. For\ - \ example, if you are sending `traits.category`, you can\ - \ put 'category' in the setting above and we will send the\ - \ value of this trait as the event category." - required: false - label: Server Side Identify Event Category - - name: identifyEventName - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify what the event action will be since all\ - \ custom metrics/dimensions for server side `.identify()`\ - \ calls will be sent via an event hit to GA. The default\ - \ value will be `'User Enriched'`" - required: false - label: Server Side Identify Event Action - - name: ignoredReferrers - type: strings - defaultValue: [] - description: "Add any domains you want to ignore, separated\ - \ by line breaks. You might use this if you want Google\ - \ Analytics to ignore certain referral domains (e.g. to\ - \ prevent your subdomains from showing up as referrers in\ - \ your analytics). _Note: this only works for Classic profiles.\ - \ Universal profiles can_ [edit their ignored referrers](https://support.google.com/analytics/answer/2795830?hl=en&ref_topic=2790009)\ - \ _directly inside Google Analytics._" - required: false - label: Ignored Referrers - - name: includeSearch - type: boolean - defaultValue: false - description: "The querystring doesn't usually affect the content\ - \ of the page in a significant way (like sorting), so we\ - \ disable this by default." - required: false - label: Include the Querystring in Page Views - - name: metrics - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom numerical traits or `analytics.track('event',\ - \ properties)` with custom numerical properties, you need\ - \ to map those traits and properties to Google Analytics\ - \ custom metrics if you want them to be sent to GA. Enter\ - \ a trait or property name on the left. Choose the Google\ - \ Analytics metric you want on the right. Google Analytics\ - \ only accepts numbered metrics (e.g. metric3). We suggest\ - \ using user-scoped metrics for trait mappings and hit-scoped\ - \ metrics for properties. [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Metrics - - name: mobileTrackingId - type: string - defaultValue: "" - description: "Google Analytics tracks mobile apps separately,\ - \ so you'll want to create a separate Google Analytics mobile\ - \ app property. Remember to only add a mobile tracking ID\ - \ if you're tracking from a mobile library. If you're tracking\ - \ from a hybrid app, fill in your website tracking ID instead.\ - \ Leave it blank if you don't have a mobile app property." - required: true - label: Mobile Tracking ID - - name: nameTracker - type: boolean - defaultValue: false - description: "Name the tracker 'segmentGATracker'. Enable\ - \ this if you're working with additional Google Analytics\ - \ trackers and want to ensure that your Segment tracker\ - \ has a distinct name. If this is enabled you must prepend\ - \ this tracker name to any native Google Analytics (except\ - \ for create) that you call, e.g. 'segmentGATracker.require(....)' " - required: false - label: Name Tracker - - name: nonInteraction - type: boolean - defaultValue: false - description: "Adds a _nonInteraction: true_ flag to every\ - \ non-enhanced ecommerce event tracked to Google Analytics.\ - \ If you're seeing unusually low bounce rates this will\ - \ solve that issue." - required: false - label: Add the non-interaction flag to all events - - name: optimize - type: string - defaultValue: "" - description: Integrate with Google Analytics Optimize plugin. - Please enter your Optimize Container ID - required: false - label: Optimize Container ID - - name: preferAnonymousId - type: boolean - defaultValue: false - description: Enable this setting if you want `clientId` to - always be set as a hash of `anonymousId`. If no `anonymousId` - is present we will fallback to set the `clientId` to `userId`. - This setting only applies to server side connections. - required: false - label: Prefer Anonymous ID for Client ID - Server Side Only - - name: protocolMappings - type: map - defaultValue: {} - description: "If you are using the *server side* GA integration,\ - \ you can map your custom traits or properties to known\ - \ [measurement protocol params](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters)." - required: false - label: Map Traits or Properties to Measurement Protocol Params - - name: reportUncaughtExceptions - type: boolean - defaultValue: false - description: This lets you study errors and exceptions in - your iOS and Android apps in Google Analytics. - required: false - label: Send Uncaught Exceptions to GA (Mobile) - - name: resetCustomDimensionsOnPage - type: array - defaultValue: [] - description: "If you have an SPA website, and need to reset\ - \ custom dimensions between page calls, add to this setting\ - \ all the properties (already mapped as custom dimensions)\ - \ that need to be reset for each page call." - required: false - label: Reset dimensions on Page calls - - name: sampleRate - type: number - defaultValue: 100 - description: "Specifies what percentage of users should be\ - \ tracked. This defaults to 100 (no users are sampled out)\ - \ but large sites may need to use a lower sample rate to\ - \ stay within Google Analytics processing limits as [seen\ - \ here](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#sampleRate).\ - \ Currently only available in the browser - mobile coming\ - \ soon." - required: false - label: Sample Rate - - name: sendUserId - type: boolean - defaultValue: false - description: "User-ID enables the analysis of groups of sessions\ - \ across devices, using a unique and persistent ID. This\ - \ only works with Google Analytics Universal. IMPORTANT:\ - \ Sending email or other personally identifiable information\ - \ (PII) violates Google Analytics Terms of Service." - required: false - label: Send User-ID to GA - - name: serversideClassic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier profiles are Classic. An easy test: if you\ - \ see `_gaq.push` in your code you're using Classic, so\ - \ enable this." - required: false - label: Use Classic Analytics for Your Serverside Tracking - - name: serversideTrackingId - type: string - defaultValue: "" - description: "Your Serverside Tracking ID is the UA code for\ - \ the Google Analytics property you want to send server-side\ - \ calls to. Leave it blank if you don't have a server-side\ - \ client library that you want to send data from. Remember\ - \ that data tracked from mobile integrations that are not\ - \ bundled in your app send data to Google Analytics server\ - \ side, since Segment sends data to them via our own servers." - required: true - label: Serverside Tracking ID - - name: setAllMappedProps - type: boolean - defaultValue: true - description: "Google Analytics allows users to either pass\ - \ custom dimensions / metrics as properties of specific\ - \ events or as properties for all events on a given page\ - \ (or the lifetime of the global tracker object). The default\ - \ Segment behavior is the latter. Any metrics / dimensions\ - \ that are mapped to a given property will be set to the\ - \ page and sent as properties of all subsequent events on\ - \ that page. You can disable this functionality with this\ - \ setting. If disabled, Segment will only pass custom dimensions\ - \ / metrics as part of the payload of the event with which\ - \ they are explicitly associated. Please reference the Google\ - \ Analytics [documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets#implementation)\ - \ for more info." - required: false - label: Set Custom Dimensions & Metrics to the Page - - name: siteSpeedSampleRate - type: number - defaultValue: 1 - description: "Defines the sample size for Site Speed data\ - \ collection. If you have a small number of visitors you\ - \ might want to adjust the sampling to a larger rate for\ - \ your [site speed stats](https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration?hl=en#_gat.GA_Tracker_._setSiteSpeedSampleRate)." - required: false - label: Site Speed Sample Rate - - name: topLevelContextMapping - type: boolean - defaultValue: false - description: "By default, Segment allows mappings from custom\ - \ traits and properties to Google Analytics custom dimensions\ - \ and metrics. If you enable this setting, Segment will\ - \ also send top-level and `context` object fields mapped\ - \ in the **Custom Dimensions** and **Custom Metrics** settings.\ - \ When evaluating mappings, Segment will prioritize properties\ - \ and traits before top-level and `context` fields. This\ - \ setting only applies to server side connections." - required: false - label: Enable Mappings from Top-Level or Context Fields - - Server Side Only - - name: trackCategorizedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `category` associated with them. E.g.\ - \ `page('Docs', 'Index')` translates to **Viewed Docs Page**." - required: false - label: Track Categorized Pages - - name: trackNamedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `name` associated with them. E.g. `page('Signup')`\ - \ translates to **Viewed Signup Page**." - required: false - label: Track Named Pages - - name: trackingId - type: string - defaultValue: "" - description: "Your website's Tracking ID is in the **Tracking\ - \ Info** tab on the [Admin Page](https://www.google.com/analytics/web/#management/Property)\ - \ of Google Analytics. Leave it blank if you don't have\ - \ a website property." - required: true - label: Website Tracking ID - - name: typeOverride - type: boolean - defaultValue: false - description: "By default, Segment sends \"Product List Viewed\"\ - \ and \"Product List Filtered\" ecommerce events to GA as\ - \ \"pageview\" hit types. Enable this setting to instead\ - \ map these two specced Segment track events to GA as \"\ - event\" hit types." - required: false - label: Send Segment "Product List" Events to GA as "Event" - Hits - - name: useGoogleAmpClientId - type: boolean - defaultValue: false - description: "Google’s AMP Client ID API lets you uniquely\ - \ identify users who engage with your content on AMP and\ - \ non-AMP pages. If you opt-in, Google Analytics will use\ - \ the user's AMP Client ID to determine that multiple site\ - \ events belong to the same user when those users visit\ - \ AMP pages via a [Google viewer](https://support.google.com/websearch/answer/7220196).\ - \ Associating events and users provides features like user\ - \ counts and session-based metrics. *Enabling this feature\ - \ will affect your reporting.* Please carefully reference\ - \ Google's [documentation](https://support.google.com/analytics/answer/7486764?hl=en&ref_topic=7378717)\ - \ for more info before you enable it." - required: false - label: Use Google AMP Client ID - - name: userDeletion - type: string - defaultValue: "" - description: 'Sign in to Google Analytics oAuth to enable - User Deletion. ' - required: false - label: User Deletion - status: PUBLIC - categories: - - Analytics - website: http://google.com/analytics - components: - - code: https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: BROWSER - - code: https://github.com/segment-integrations/analytics-ios-integration-google-analytics - owner: SEGMENT - type: IOS - - code: https://github.com/segment-integrations/analytics-android-integration-google-analytics - owner: SEGMENT - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: SERVER - previousNames: - - Google Analytics - - Google Universal Analytics - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: false - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: true - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/updateDestination_200_response' - application/json: - example: - data: - destination: - id: fP7qoQw2HTWt9WdMr718gn - enabled: false - name: "" - settings: - anonymizeIp: false - classic: false - contentGroupings: {} - dimensions: {} - domain: "" - doubleClick: false - enableServerIdentify: false - enhancedEcommerce: false - enhancedLinkAttribution: false - identifyCategory: "" - identifyEventName: "" - ignoredReferrers: [] - includeSearch: false - metrics: {} - mobileTrackingId: "123" - nameTracker: false - nonInteraction: false - optimize: "" - preferAnonymousId: false - protocolMappings: {} - reportUncaughtExceptions: false - resetCustomDimensionsOnPage: [] - sampleRate: 100 - sendUserId: false - serversideClassic: false - serversideTrackingId: "123" - setAllMappedProps: true - siteSpeedSampleRate: 1 - topLevelContextMapping: false - trackCategorizedPages: true - trackNamedPages: true - trackingId: "123" - typeOverride: false - useGoogleAmpClientId: false - userDeletion: "" - metadata: - id: 54521fd725e721e32a72eebb - name: Google Universal Analytics - description: Google Universal Analytics is the most popular - analytics tool for the web. It’s free and provides a wide - range of features. It’s especially good at measuring traffic - sources and ad campaigns. - slug: google-analytics - logos: - default: https://cdn.filepicker.io/api/file/anFgceQJTGeMxChCgiyU - mark: https://cdn.filepicker.io/api/file/zebLRcY3RtOlynDXTgNk - options: - - name: anonymizeIp - type: boolean - defaultValue: false - description: "For client side libraries. Read more about anonymizing\ - \ IP addresses from the [Google support documentation](https://support.google.com/analytics/answer/2763052?hl=en)." - required: false - label: Anonymize IP Addresses - - name: classic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier ones are Classic. An easy test: if you see\ - \ `_gaq.push` in your code you're using Classic, so enable\ - \ this." - required: false - label: Use Classic Analytics on Your Site - - name: contentGroupings - type: map - defaultValue: {} - description: "Enter a property name on the left. Choose the\ - \ Google Analytics content grouping you want on the right.\ - \ Google Analytics only accepts numbered content groupings\ - \ (e.g. contentGrouping3). When you use `analytics.page(name,\ - \ properties)` with custom properties, we'll use the value\ - \ of the property you designate as the value of the specified\ - \ content grouping." - required: false - label: Content Groupings - - name: dimensions - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom traits or `analytics.track('event',\ - \ properties)` with custom properties, you need to map those\ - \ traits and properties to Google Analytics custom dimensions\ - \ if you want them to be sent to GA. Enter a trait or property\ - \ name on the left. Choose the Google Analytics dimension\ - \ you want on the right. Google Analytics only accepts numbered\ - \ dimensions (e.g. dimension3). We suggest using user-scoped\ - \ dimensions for trait mappings and hit-scoped dimensions\ - \ for properties [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Dimensions - - name: domain - type: string - defaultValue: "" - description: "_Only data sent from visitors on this domain_\ - \ will be recorded. By default Google Analytics automatically\ - \ resolves the domain name, so you should **leave this blank\ - \ unless you know you want otherwise**! This option is useful\ - \ if you need to ignore data from other domains, or explicitly\ - \ set the domain of your Google Analytics cookie. This is\ - \ known as Override Domain Name in [GA Classic](https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite).\ - \ If you are testing locally, you can set the domain to\ - \ `none`. [Read more about this setting in our docs](https://segment.com/docs/connections/destinations/catalog/google-analytics/#cookie-domain-name)." - required: false - label: Cookie Domain Name - - name: doubleClick - type: boolean - defaultValue: false - description: Works with both Universal and Classic tracking - methods. - required: false - label: "Remarketing, Display Ads and Demographic Reports." - - name: enableServerIdentify - type: boolean - defaultValue: false - description: "If you are sending `.identify()` calls from\ - \ your server side libraries or have Segment Cloud Apps\ - \ that send back `.identify()` calls with enriched user\ - \ traits, you can send that data to your GA account via\ - \ custom dimensions and metrics. Unlike the client side\ - \ integration which has the luxury of browsers and the global\ - \ window `ga` tracker, for server side we will check your\ - \ `traits` and your settings for custom dimension/metric\ - \ mappings and send it with an explicit event. " - required: false - label: Enable Server Side Identify - - name: enhancedEcommerce - type: boolean - defaultValue: false - description: "If you want more detailed reports on ecommerce,\ - \ you might want to enable this feature. Read more about\ - \ it [here](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce)." - required: false - label: Enable Enhanced Ecommerce - - name: enhancedLinkAttribution - type: boolean - defaultValue: false - description: "Provides more detailed reports on the links\ - \ clicked on your site. Read more about it in the [Google\ - \ support documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-link-attribution)." - required: false - label: Enable Enhanced Link Attribution - - name: identifyCategory - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify the trait you want to look up for setting\ - \ the event category will be since all custom metrics/dimensions\ - \ for server side `.identify()` calls will be sent via an\ - \ event hit to GA. The default value will be `'All'`. For\ - \ example, if you are sending `traits.category`, you can\ - \ put 'category' in the setting above and we will send the\ - \ value of this trait as the event category." - required: false - label: Server Side Identify Event Category - - name: identifyEventName - type: string - defaultValue: "" - description: "If you have **Enabled Server Side Identify**,\ - \ you can specify what the event action will be since all\ - \ custom metrics/dimensions for server side `.identify()`\ - \ calls will be sent via an event hit to GA. The default\ - \ value will be `'User Enriched'`" - required: false - label: Server Side Identify Event Action - - name: ignoredReferrers - type: strings - defaultValue: [] - description: "Add any domains you want to ignore, separated\ - \ by line breaks. You might use this if you want Google\ - \ Analytics to ignore certain referral domains (e.g. to\ - \ prevent your subdomains from showing up as referrers in\ - \ your analytics). _Note: this only works for Classic profiles.\ - \ Universal profiles can_ [edit their ignored referrers](https://support.google.com/analytics/answer/2795830?hl=en&ref_topic=2790009)\ - \ _directly inside Google Analytics._" - required: false - label: Ignored Referrers - - name: includeSearch - type: boolean - defaultValue: false - description: "The querystring doesn't usually affect the content\ - \ of the page in a significant way (like sorting), so we\ - \ disable this by default." - required: false - label: Include the Querystring in Page Views - - name: metrics - type: map - defaultValue: {} - description: "Because Google Analytics cannot accept arbitrary\ - \ data about users or events, when you use `analytics.identify(userId,\ - \ traits)` with custom numerical traits or `analytics.track('event',\ - \ properties)` with custom numerical properties, you need\ - \ to map those traits and properties to Google Analytics\ - \ custom metrics if you want them to be sent to GA. Enter\ - \ a trait or property name on the left. Choose the Google\ - \ Analytics metric you want on the right. Google Analytics\ - \ only accepts numbered metrics (e.g. metric3). We suggest\ - \ using user-scoped metrics for trait mappings and hit-scoped\ - \ metrics for properties. [Contact us](https://segment.com/contact)\ - \ if you need help!" - required: false - label: Custom Metrics - - name: mobileTrackingId - type: string - defaultValue: "" - description: "Google Analytics tracks mobile apps separately,\ - \ so you'll want to create a separate Google Analytics mobile\ - \ app property. Remember to only add a mobile tracking ID\ - \ if you're tracking from a mobile library. If you're tracking\ - \ from a hybrid app, fill in your website tracking ID instead.\ - \ Leave it blank if you don't have a mobile app property." - required: true - label: Mobile Tracking ID - - name: nameTracker - type: boolean - defaultValue: false - description: "Name the tracker 'segmentGATracker'. Enable\ - \ this if you're working with additional Google Analytics\ - \ trackers and want to ensure that your Segment tracker\ - \ has a distinct name. If this is enabled you must prepend\ - \ this tracker name to any native Google Analytics (except\ - \ for create) that you call, e.g. 'segmentGATracker.require(....)' " - required: false - label: Name Tracker - - name: nonInteraction - type: boolean - defaultValue: false - description: "Adds a _nonInteraction: true_ flag to every\ - \ non-enhanced ecommerce event tracked to Google Analytics.\ - \ If you're seeing unusually low bounce rates this will\ - \ solve that issue." - required: false - label: Add the non-interaction flag to all events - - name: optimize - type: string - defaultValue: "" - description: Integrate with Google Analytics Optimize plugin. - Please enter your Optimize Container ID - required: false - label: Optimize Container ID - - name: preferAnonymousId - type: boolean - defaultValue: false - description: Enable this setting if you want `clientId` to - always be set as a hash of `anonymousId`. If no `anonymousId` - is present we will fallback to set the `clientId` to `userId`. - This setting only applies to server side connections. - required: false - label: Prefer Anonymous ID for Client ID - Server Side Only - - name: protocolMappings - type: map - defaultValue: {} - description: "If you are using the *server side* GA integration,\ - \ you can map your custom traits or properties to known\ - \ [measurement protocol params](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters)." - required: false - label: Map Traits or Properties to Measurement Protocol Params - - name: reportUncaughtExceptions - type: boolean - defaultValue: false - description: This lets you study errors and exceptions in - your iOS and Android apps in Google Analytics. - required: false - label: Send Uncaught Exceptions to GA (Mobile) - - name: resetCustomDimensionsOnPage - type: array - defaultValue: [] - description: "If you have an SPA website, and need to reset\ - \ custom dimensions between page calls, add to this setting\ - \ all the properties (already mapped as custom dimensions)\ - \ that need to be reset for each page call." - required: false - label: Reset dimensions on Page calls - - name: sampleRate - type: number - defaultValue: 100 - description: "Specifies what percentage of users should be\ - \ tracked. This defaults to 100 (no users are sampled out)\ - \ but large sites may need to use a lower sample rate to\ - \ stay within Google Analytics processing limits as [seen\ - \ here](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#sampleRate).\ - \ Currently only available in the browser - mobile coming\ - \ soon." - required: false - label: Sample Rate - - name: sendUserId - type: boolean - defaultValue: false - description: "User-ID enables the analysis of groups of sessions\ - \ across devices, using a unique and persistent ID. This\ - \ only works with Google Analytics Universal. IMPORTANT:\ - \ Sending email or other personally identifiable information\ - \ (PII) violates Google Analytics Terms of Service." - required: false - label: Send User-ID to GA - - name: serversideClassic - type: boolean - defaultValue: false - description: "**Important:** When creating your Google Analytics\ - \ profile, you can choose between **Classic** and **Universal**\ - \ Analytics. After March 2013, new profiles default to Universal,\ - \ while earlier profiles are Classic. An easy test: if you\ - \ see `_gaq.push` in your code you're using Classic, so\ - \ enable this." - required: false - label: Use Classic Analytics for Your Serverside Tracking - - name: serversideTrackingId - type: string - defaultValue: "" - description: "Your Serverside Tracking ID is the UA code for\ - \ the Google Analytics property you want to send server-side\ - \ calls to. Leave it blank if you don't have a server-side\ - \ client library that you want to send data from. Remember\ - \ that data tracked from mobile integrations that are not\ - \ bundled in your app send data to Google Analytics server\ - \ side, since Segment sends data to them via our own servers." - required: true - label: Serverside Tracking ID - - name: setAllMappedProps - type: boolean - defaultValue: true - description: "Google Analytics allows users to either pass\ - \ custom dimensions / metrics as properties of specific\ - \ events or as properties for all events on a given page\ - \ (or the lifetime of the global tracker object). The default\ - \ Segment behavior is the latter. Any metrics / dimensions\ - \ that are mapped to a given property will be set to the\ - \ page and sent as properties of all subsequent events on\ - \ that page. You can disable this functionality with this\ - \ setting. If disabled, Segment will only pass custom dimensions\ - \ / metrics as part of the payload of the event with which\ - \ they are explicitly associated. Please reference the Google\ - \ Analytics [documentation](https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets#implementation)\ - \ for more info." - required: false - label: Set Custom Dimensions & Metrics to the Page - - name: siteSpeedSampleRate - type: number - defaultValue: 1 - description: "Defines the sample size for Site Speed data\ - \ collection. If you have a small number of visitors you\ - \ might want to adjust the sampling to a larger rate for\ - \ your [site speed stats](https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration?hl=en#_gat.GA_Tracker_._setSiteSpeedSampleRate)." - required: false - label: Site Speed Sample Rate - - name: topLevelContextMapping - type: boolean - defaultValue: false - description: "By default, Segment allows mappings from custom\ - \ traits and properties to Google Analytics custom dimensions\ - \ and metrics. If you enable this setting, Segment will\ - \ also send top-level and `context` object fields mapped\ - \ in the **Custom Dimensions** and **Custom Metrics** settings.\ - \ When evaluating mappings, Segment will prioritize properties\ - \ and traits before top-level and `context` fields. This\ - \ setting only applies to server side connections." - required: false - label: Enable Mappings from Top-Level or Context Fields - - Server Side Only - - name: trackCategorizedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `category` associated with them. E.g.\ - \ `page('Docs', 'Index')` translates to **Viewed Docs Page**." - required: false - label: Track Categorized Pages - - name: trackNamedPages - type: boolean - defaultValue: true - description: "Tracks events to Google Analytics for [`page`\ - \ method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page)\ - \ calls that have a `name` associated with them. E.g. `page('Signup')`\ - \ translates to **Viewed Signup Page**." - required: false - label: Track Named Pages - - name: trackingId - type: string - defaultValue: "" - description: "Your website's Tracking ID is in the **Tracking\ - \ Info** tab on the [Admin Page](https://www.google.com/analytics/web/#management/Property)\ - \ of Google Analytics. Leave it blank if you don't have\ - \ a website property." - required: true - label: Website Tracking ID - - name: typeOverride - type: boolean - defaultValue: false - description: "By default, Segment sends \"Product List Viewed\"\ - \ and \"Product List Filtered\" ecommerce events to GA as\ - \ \"pageview\" hit types. Enable this setting to instead\ - \ map these two specced Segment track events to GA as \"\ - event\" hit types." - required: false - label: Send Segment "Product List" Events to GA as "Event" - Hits - - name: useGoogleAmpClientId - type: boolean - defaultValue: false - description: "Google’s AMP Client ID API lets you uniquely\ - \ identify users who engage with your content on AMP and\ - \ non-AMP pages. If you opt-in, Google Analytics will use\ - \ the user's AMP Client ID to determine that multiple site\ - \ events belong to the same user when those users visit\ - \ AMP pages via a [Google viewer](https://support.google.com/websearch/answer/7220196).\ - \ Associating events and users provides features like user\ - \ counts and session-based metrics. *Enabling this feature\ - \ will affect your reporting.* Please carefully reference\ - \ Google's [documentation](https://support.google.com/analytics/answer/7486764?hl=en&ref_topic=7378717)\ - \ for more info before you enable it." - required: false - label: Use Google AMP Client ID - - name: userDeletion - type: string - defaultValue: "" - description: 'Sign in to Google Analytics oAuth to enable - User Deletion. ' - required: false - label: User Deletion - status: PUBLIC - categories: - - Analytics - website: http://google.com/analytics - components: - - code: https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: BROWSER - - code: https://github.com/segment-integrations/analytics-ios-integration-google-analytics - owner: SEGMENT - type: IOS - - code: https://github.com/segment-integrations/analytics-android-integration-google-analytics - owner: SEGMENT - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/google-analytics - owner: SEGMENT - type: SERVER - previousNames: - - Google Analytics - - Google Universal Analytics - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: false - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: true - browserUnbundlingPublic: true - actions: [] - presets: [] - sourceId: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/updateDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Update Destination - tags: - - Destinations - x-domain-hierarchy: - - Connections - - Destinations - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /functions/{functionId}: - delete: - deprecated: false - description: "Deletes a Function.\n\n**Note**: In order to successfully call\ - \ this endpoint, the specified Workspace needs to have the Functions feature\ - \ enabled. Please reach out to your customer success manager for more information." - operationId: deleteFunction - parameters: - - explode: false - in: path - name: functionId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteFunction_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteFunction_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteFunction_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteFunction_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Delete Function - tags: - - Functions - x-domain-hierarchy: - - Connections - - Functions - x-accepts: application/json - get: - deprecated: false - description: "Gets a Function.\n\n**Note**: In order to successfully call this\ - \ endpoint, the specified Workspace needs to have the Functions feature enabled.\ - \ Please reach out to your customer success manager for more information." - operationId: getFunction - parameters: - - explode: false - in: path - name: functionId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - function: - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - previewWebhookUrl: "" - settings: - - name: apiKey - label: api key - description: api key - type: STRING - required: false - sensitive: false - - name: mySecret - label: my secret key - description: secret key - type: STRING - required: false - sensitive: true - buildpack: "" - catalogId: wXzcDGFR3KmjLDrtSawNHf - batchMaxCount: 0 - resourceType: SOURCE - schema: - $ref: '#/components/schemas/getFunction_200_response' - application/vnd.segment.v1beta+json: - example: - data: - function: - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - previewWebhookUrl: "" - settings: - - name: apiKey - label: api key - description: api key - type: STRING - required: false - sensitive: false - - name: mySecret - label: my secret key - description: secret key - type: STRING - required: false - sensitive: true - buildpack: "" - catalogId: wXzcDGFR3KmjLDrtSawNHf - batchMaxCount: 0 - resourceType: SOURCE - schema: - $ref: '#/components/schemas/getFunction_200_response' - application/vnd.segment.v1+json: - example: - data: - function: - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - previewWebhookUrl: "" - settings: - - name: apiKey - label: api key - description: api key - type: STRING - required: false - sensitive: false - - name: mySecret - label: my secret key - description: secret key - type: STRING - required: false - sensitive: true - buildpack: "" - catalogId: wXzcDGFR3KmjLDrtSawNHf - batchMaxCount: 0 - resourceType: SOURCE - schema: - $ref: '#/components/schemas/getFunction_200_response' - application/json: - example: - data: - function: - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - previewWebhookUrl: "" - settings: - - name: apiKey - label: api key - description: api key - type: STRING - required: false - sensitive: false - - name: mySecret - label: my secret key - description: secret key - type: STRING - required: false - sensitive: true - buildpack: "" - catalogId: wXzcDGFR3KmjLDrtSawNHf - batchMaxCount: 0 - resourceType: SOURCE - schema: - $ref: '#/components/schemas/getFunction_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Function - tags: - - Functions - x-domain-hierarchy: - - Connections - - Functions - x-accepts: application/json - patch: - deprecated: false - description: "Updates a Function.\n\n**Note**: In order to successfully call\ - \ this endpoint, the specified Workspace needs to have the Functions feature\ - \ enabled. Please reach out to your customer success manager for more information.\n\ - \nConfig API omitted fields:\n- `updateMask`\n" - operationId: updateFunction - parameters: - - explode: false - in: path - name: functionId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - functionId: sfnc_wXzcDGFR3KmjLDrtSawNHf - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - logoUrl: https://placekitten.com/200/139 - schema: - $ref: '#/components/schemas/UpdateFunctionV1Input' - application/vnd.segment.v1beta+json: - example: - functionId: sfnc_wXzcDGFR3KmjLDrtSawNHf - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - logoUrl: https://placekitten.com/200/139 - schema: - $ref: '#/components/schemas/UpdateFunctionV1Input' - application/vnd.segment.v1+json: - example: - functionId: sfnc_wXzcDGFR3KmjLDrtSawNHf - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - logoUrl: https://placekitten.com/200/139 - schema: - $ref: '#/components/schemas/UpdateFunctionV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - function: - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - previewWebhookUrl: "" - settings: - - name: apiKey - label: api key - description: api key - type: STRING - required: false - sensitive: false - - name: mySecret - label: my secret key - description: secret key - type: STRING - required: false - sensitive: true - buildpack: "" - catalogId: wXzcDGFR3KmjLDrtSawNHf - batchMaxCount: 0 - resourceType: SOURCE - schema: - $ref: '#/components/schemas/updateFunction_200_response' - application/vnd.segment.v1beta+json: - example: - data: - function: - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - previewWebhookUrl: "" - settings: - - name: apiKey - label: api key - description: api key - type: STRING - required: false - sensitive: false - - name: mySecret - label: my secret key - description: secret key - type: STRING - required: false - sensitive: true - buildpack: "" - catalogId: wXzcDGFR3KmjLDrtSawNHf - batchMaxCount: 0 - resourceType: SOURCE - schema: - $ref: '#/components/schemas/updateFunction_200_response' - application/vnd.segment.v1+json: - example: - data: - function: - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - previewWebhookUrl: "" - settings: - - name: apiKey - label: api key - description: api key - type: STRING - required: false - sensitive: false - - name: mySecret - label: my secret key - description: secret key - type: STRING - required: false - sensitive: true - buildpack: "" - catalogId: wXzcDGFR3KmjLDrtSawNHf - batchMaxCount: 0 - resourceType: SOURCE - schema: - $ref: '#/components/schemas/updateFunction_200_response' - application/json: - example: - data: - function: - id: sfnc_wXzcDGFR3KmjLDrtSawNHf - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - displayName: PAPI Source Function - description: My source function - logoUrl: https://placekitten.com/200/139 - code: // Learn more about source functions API at https://segment.com/docs/connections/sources/source-functions - createdAt: 2006-01-02T15:04:05.000Z - createdBy: sgJDWk3K21k6LE3tLU9nRK - previewWebhookUrl: "" - settings: - - name: apiKey - label: api key - description: api key - type: STRING - required: false - sensitive: false - - name: mySecret - label: my secret key - description: secret key - type: STRING - required: false - sensitive: true - buildpack: "" - catalogId: wXzcDGFR3KmjLDrtSawNHf - batchMaxCount: 0 - resourceType: SOURCE - schema: - $ref: '#/components/schemas/updateFunction_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Update Function - tags: - - Functions - x-domain-hierarchy: - - Connections - - Functions - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /labels/{key}/{value}: - delete: - deprecated: false - description: "Deletes a label.\n\n\n\nWhen called, this endpoint may generate\ - \ the `Label Deleted` [Audit Trail](/tag/Audit-Trail) event.\n \n\n\n\ - The rate limit for this endpoint is 60 requests per minute, which is lower\ - \ than the default due to access pattern restrictions. Once reached, this\ - \ endpoint will respond with the 429 HTTP status code with headers indicating\ - \ the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: deleteLabel - parameters: - - explode: false - in: path - name: key - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - explode: false - in: path - name: value - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteLabel_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteLabel_200_response_1' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteLabel_200_response_1' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteLabel_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Delete Label - tags: - - Labels - x-domain-hierarchy: - - Admin - - Labels - x-accepts: application/json - /regulations/{regulateId}: - delete: - deprecated: false - description: "Deletes a regulation from the Workspace. The regulation must be\ - \ in the initialized state to be deleted.\n\n\n\nWhen called, this endpoint\ - \ may generate the `Regulation Deleted` [Audit Trail](/tag/Audit-Trail) event.\n\ - \ " - operationId: deleteRegulation - parameters: - - explode: false - in: path - name: regulateId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteRegulation_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteRegulation_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteRegulation_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteRegulation_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Delete Regulation - tags: - - Deletion and Suppression - x-domain-hierarchy: - - Connections - - Deletion and Suppression - x-accepts: application/json - get: - deprecated: false - description: "Gets a regulation from the Workspace.\n\n Config API omitted\ - \ fields:\n- `parent`\n " - operationId: getRegulation - parameters: - - explode: false - in: path - name: regulateId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - regulation: - id: 1qJkfE1tpwvQcklImGksLN629wn - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - overallStatus: FINISHED - finishedAt: 2022-03-08T00:39:36.546951Z - createdAt: 2022-03-08T00:39:36.546951Z - streamStatus: [] - schema: - $ref: '#/components/schemas/getRegulation_200_response' - application/vnd.segment.v1beta+json: - example: - data: - regulation: - id: 1qJkfE1tpwvQcklImGksLN629wn - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - overallStatus: FINISHED - finishedAt: 2022-03-08T00:39:36.546951Z - createdAt: 2022-03-08T00:39:36.546951Z - streamStatus: [] - schema: - $ref: '#/components/schemas/getRegulation_200_response' - application/vnd.segment.v1+json: - example: - data: - regulation: - id: 1qJkfE1tpwvQcklImGksLN629wn - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - overallStatus: FINISHED - finishedAt: 2022-03-08T00:39:36.546951Z - createdAt: 2022-03-08T00:39:36.546951Z - streamStatus: [] - schema: - $ref: '#/components/schemas/getRegulation_200_response' - application/json: - example: - data: - regulation: - id: 1qJkfE1tpwvQcklImGksLN629wn - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - overallStatus: FINISHED - finishedAt: 2022-03-08T00:39:36.546951Z - createdAt: 2022-03-08T00:39:36.546951Z - streamStatus: [] - schema: - $ref: '#/components/schemas/getRegulation_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Regulation - tags: - - Deletion and Suppression - x-domain-hierarchy: - - Connections - - Deletion and Suppression - x-accepts: application/json - /sources/{sourceId}: - delete: - deprecated: false - description: "Deletes an existing Source.\n\n\n\nWhen called, this endpoint\ - \ may generate the `Source Deleted` [Audit Trail](/tag/Audit-Trail) event.\n\ - \ " - operationId: deleteSource - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteSource_200_response_1' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteSource_200_response_1' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteSource_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Delete Source - tags: - - Sources - x-domain-hierarchy: - - Connections - - Sources - x-accepts: application/json - get: - deprecated: false - description: Returns a Source by its id. - operationId: getSource - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - source: - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - schema: - $ref: '#/components/schemas/getSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - source: - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - schema: - $ref: '#/components/schemas/getSource_200_response_1' - application/vnd.segment.v1+json: - example: - data: - source: - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - schema: - $ref: '#/components/schemas/getSource_200_response_1' - application/json: - example: - data: - source: - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - schema: - $ref: '#/components/schemas/getSource_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Source - tags: - - Sources - x-domain-hierarchy: - - Connections - - Sources - x-accepts: application/json - patch: - deprecated: false - description: "Updates an existing Source.\n\nWhen called, this endpoint may\ - \ generate one or more of the following [Audit Trail](/tag/Audit-Trail) events:\n\ - * Source Modified\n* Source Enabled\n* Source Settings Modified\n* Source\ - \ Disabled\n\nConfig API omitted fields:\n- `updateMask`\n" - operationId: updateSource - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - sourceId: piTVHEYNrRgBMM1uQGCPbK - name: My updated source - enabled: false - schema: - $ref: '#/components/schemas/UpdateSourceAlphaInput' - application/vnd.segment.v1beta+json: - example: - sourceId: kgPS3ESM35Ez5UQ7nvfJbC - name: My updated source - enabled: false - schema: - $ref: '#/components/schemas/UpdateSourceV1Input' - application/vnd.segment.v1+json: - example: - sourceId: 3uCNQopSsSnXeAHAwYKZqF - name: My updated source - enabled: false - schema: - $ref: '#/components/schemas/UpdateSourceV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - source: - id: piTVHEYNrRgBMM1uQGCPbK - slug: update-source-slug-gqd2dx - name: My updated source - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: false - writeKeys: - - VkV0fu40bXSSNJtqnQEzonkzLOWj2llN - metadata: - id: IqDTy1TpoU - slug: javascript - name: Javascript - categories: - - Website - description: "This is our most flexible and powerful tracking\ - \ system, using analytics.js. Track and analyze information\ - \ about your visitors and customers, and every action that\ - \ they take, in any of our 140 integrations, business intelligence\ - \ tools, or directly with SQL tools." - logos: - default: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - alt: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - mark: https://cdn.filepicker.io/api/file/kBpmEoSSaakidAvoFmzd - options: [] - isCloudEventSource: false - settings: {} - labels: [] - schema: - $ref: '#/components/schemas/updateSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - source: - id: kgPS3ESM35Ez5UQ7nvfJbC - slug: update-source-slug-wb_c2h - name: My updated source - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: false - writeKeys: - - HqFwQdNCYOAsLPE8FQEgBo6RwHALu7lj - metadata: - id: IqDTy1TpoU - slug: javascript - name: Javascript - categories: - - Website - description: "This is our most flexible and powerful tracking\ - \ system, using analytics.js. Track and analyze information\ - \ about your visitors and customers, and every action that\ - \ they take, in any of our 140 integrations, business intelligence\ - \ tools, or directly with SQL tools." - logos: - default: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - alt: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - mark: https://cdn.filepicker.io/api/file/kBpmEoSSaakidAvoFmzd - options: [] - isCloudEventSource: false - settings: {} - labels: [] - schema: - $ref: '#/components/schemas/updateSource_200_response_1' - application/vnd.segment.v1+json: - example: - data: - source: - id: 3uCNQopSsSnXeAHAwYKZqF - slug: update-source-slug-a-yoz5 - name: My updated source - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: false - writeKeys: - - 4czIPB0pGAv89HEJZDYUa5XomDi5dj4E - metadata: - id: IqDTy1TpoU - slug: javascript - name: Javascript - categories: - - Website - description: "This is our most flexible and powerful tracking\ - \ system, using analytics.js. Track and analyze information\ - \ about your visitors and customers, and every action that\ - \ they take, in any of our 140 integrations, business intelligence\ - \ tools, or directly with SQL tools." - logos: - default: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - alt: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - mark: https://cdn.filepicker.io/api/file/kBpmEoSSaakidAvoFmzd - options: [] - isCloudEventSource: false - settings: {} - labels: [] - schema: - $ref: '#/components/schemas/updateSource_200_response_1' - application/json: - example: - data: - source: - id: 3uCNQopSsSnXeAHAwYKZqF - slug: update-source-slug-a-yoz5 - name: My updated source - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: false - writeKeys: - - 4czIPB0pGAv89HEJZDYUa5XomDi5dj4E - metadata: - id: IqDTy1TpoU - slug: javascript - name: Javascript - categories: - - Website - description: "This is our most flexible and powerful tracking\ - \ system, using analytics.js. Track and analyze information\ - \ about your visitors and customers, and every action that\ - \ they take, in any of our 140 integrations, business intelligence\ - \ tools, or directly with SQL tools." - logos: - default: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - alt: https://cdn.filepicker.io/api/file/aRgo4XJQZausZxD4gZQq - mark: https://cdn.filepicker.io/api/file/kBpmEoSSaakidAvoFmzd - options: [] - isCloudEventSource: false - settings: {} - labels: [] - schema: - $ref: '#/components/schemas/updateSource_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Update Source - tags: - - Sources - x-domain-hierarchy: - - Connections - - Sources - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /tracking-plans/{trackingPlanId}: - delete: - deprecated: false - description: "Deletes a Tracking Plan.\n\n**Note**: In order to successfully\ - \ call this endpoint, the specified Workspace needs to have the Protocols\ - \ feature enabled. Please reach out to your customer success manager for more\ - \ information." - operationId: deleteTrackingPlan - parameters: - - explode: false - in: path - name: trackingPlanId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteTrackingPlan_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteTrackingPlan_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteTrackingPlan_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteTrackingPlan_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Delete Tracking Plan - tags: - - Tracking Plans - x-domain-hierarchy: - - Protocols - - Tracking Plans - x-accepts: application/json - get: - deprecated: false - description: "Returns a Tracking Plan.\n\n**Note**: In order to successfully\ - \ call this endpoint, the specified Workspace needs to have the Protocols\ - \ feature enabled. Please reach out to your customer success manager for more\ - \ information." - operationId: getTrackingPlan - parameters: - - explode: false - in: path - name: trackingPlanId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - trackingPlan: - id: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: New TP - resourceSchemaId: rs_1yVwS3zy60dONy9UhCyDqMmVvAE - slug: "" - description: "" - type: LIVE - updatedAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/getTrackingPlan_200_response' - application/vnd.segment.v1beta+json: - example: - data: - trackingPlan: - id: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: New TP - resourceSchemaId: rs_1yVwS3zy60dONy9UhCyDqMmVvAE - slug: "" - description: "" - type: LIVE - updatedAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/getTrackingPlan_200_response' - application/vnd.segment.v1+json: - example: - data: - trackingPlan: - id: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: New TP - resourceSchemaId: rs_1yVwS3zy60dONy9UhCyDqMmVvAE - slug: "" - description: "" - type: LIVE - updatedAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/getTrackingPlan_200_response' - application/json: - example: - data: - trackingPlan: - id: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: New TP - resourceSchemaId: rs_1yVwS3zy60dONy9UhCyDqMmVvAE - slug: "" - description: "" - type: LIVE - updatedAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/getTrackingPlan_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Tracking Plan - tags: - - Tracking Plans - x-domain-hierarchy: - - Protocols - - Tracking Plans - x-accepts: application/json - patch: - deprecated: false - description: "Updates a Tracking Plan.\n\n**Note**: In order to successfully\ - \ call this endpoint, the specified Workspace needs to have the Protocols\ - \ feature enabled. Please reach out to your customer success manager for more\ - \ information.\n\nConfig API omitted fields:\n- `updateMask`\n " - operationId: updateTrackingPlan - parameters: - - explode: false - in: path - name: trackingPlanId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - trackingPlanId: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: Updated TP - schema: - $ref: '#/components/schemas/UpdateTrackingPlanV1Input' - application/vnd.segment.v1beta+json: - example: - trackingPlanId: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: Updated TP - schema: - $ref: '#/components/schemas/UpdateTrackingPlanV1Input' - application/vnd.segment.v1+json: - example: - trackingPlanId: tp_sprout_rVGCC6WdrNxjCf6JpCHP - name: Updated TP - schema: - $ref: '#/components/schemas/UpdateTrackingPlanV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/updateTrackingPlan_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/updateTrackingPlan_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/updateTrackingPlan_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/updateTrackingPlan_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Update Tracking Plan - tags: - - Tracking Plans - x-domain-hierarchy: - - Protocols - - Tracking Plans - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /transformations/{transformationId}: - delete: - deprecated: false - description: "Deletes a Transformation.\n\n\n\nWhen called, this endpoint may\ - \ generate the `Transformation Deleted` [Audit Trail](/tag/Audit-Trail) event.\n\ - **Note**: In order to successfully call this endpoint, the specified Workspace\ - \ needs to have the Protocols feature enabled. Please reach out to your customer\ - \ success manager for more information." - operationId: deleteTransformation - parameters: - - explode: false - in: path - name: transformationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteTransformation_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteTransformation_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Delete Transformation - tags: - - Transformations - x-domain-hierarchy: - - Protocols - - Transformations - x-accepts: application/json - get: - deprecated: false - description: "Gets a Transformation.\n\n**Note**: In order to successfully call\ - \ this endpoint, the specified Workspace needs to have the Protocols feature\ - \ enabled. Please reach out to your customer success manager for more information." - operationId: getTransformation - parameters: - - explode: false - in: path - name: transformationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - transformation: - id: pHrD51Ds35Zjfka84yXQE6 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: User clicked edit track event - enabled: true - sourceId: qQEHquLrjRDN9j1ByrChyn - if: event = 'User Clicked' - propertyRenames: - - oldName: Category - newName: category - schema: - $ref: '#/components/schemas/getTransformation_200_response' - application/vnd.segment.v1beta+json: - example: - data: - transformation: - id: pHrD51Ds35Zjfka84yXQE6 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: updated-name - enabled: true - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationMetadataId: 547610a5db31d978f14a5c4e - if: event="my-event" - newEventName: my-updated-event - propertyRenames: - - oldName: old-property - newName: new-property - schema: - $ref: '#/components/schemas/getTransformation_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Transformation - tags: - - Transformations - x-domain-hierarchy: - - Protocols - - Transformations - x-accepts: application/json - patch: - deprecated: false - description: "Updates an existing Transformation.\n\n\n\nWhen called, this endpoint\ - \ may generate the `Transformation Updated` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n**Note**: In order to successfully call this endpoint, the specified\ - \ Workspace needs to have the Protocols feature enabled. Please reach out\ - \ to your customer success manager for more information." - operationId: updateTransformation - parameters: - - explode: false - in: path - name: transformationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - transformationId: pHrD51Ds35Zjfka84yXQE6 - name: updated-name - sourceId: rh5BDZp6QDHvXFCkibm1pR - enabled: true - destinationMetadataId: 547610a5db31d978f14a5c4e - if: event="my-event" - newEventName: my-updated-event - propertyRenames: - - newName: new-property - oldName: old-property - schema: - $ref: '#/components/schemas/UpdateTransformationBetaInput' - application/vnd.segment.v1beta+json: - example: - transformationId: pHrD51Ds35Zjfka84yXQE6 - name: updated-name - sourceId: rh5BDZp6QDHvXFCkibm1pR - enabled: true - destinationMetadataId: 547610a5db31d978f14a5c4e - if: event="my-event" - newEventName: my-updated-event - propertyRenames: - - newName: new-property - oldName: old-property - schema: - $ref: '#/components/schemas/UpdateTransformationBetaInput' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - transformation: - id: pHrD51Ds35Zjfka84yXQE6 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: updated-name - enabled: true - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationMetadataId: 547610a5db31d978f14a5c4e - if: event="my-event" - newEventName: my-updated-event - propertyRenames: - - oldName: old-property - newName: new-property - schema: - $ref: '#/components/schemas/updateTransformation_200_response' - application/vnd.segment.v1beta+json: - example: - data: - transformation: - id: pHrD51Ds35Zjfka84yXQE6 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - name: updated-name - enabled: true - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationMetadataId: 547610a5db31d978f14a5c4e - if: event="my-event" - newEventName: my-updated-event - propertyRenames: - - oldName: old-property - newName: new-property - schema: - $ref: '#/components/schemas/updateTransformation_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Update Transformation - tags: - - Transformations - x-domain-hierarchy: - - Protocols - - Transformations - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /groups/{userGroupId}: - delete: - deprecated: false - description: "Removes a user group from a Workspace.\n\n\n\nWhen called, this\ - \ endpoint may generate the `User Group Deleted` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n \n\n\nThe rate limit for this endpoint is 60 requests per\ - \ minute, which is lower than the default due to access pattern restrictions.\ - \ Once reached, this endpoint will respond with the 429 HTTP status code with\ - \ headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits)\ - \ for more information." - operationId: deleteUserGroup - parameters: - - explode: false - in: path - name: userGroupId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteUserGroup_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteUserGroup_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteUserGroup_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteUserGroup_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Delete User Group - tags: - - IAM Groups - x-domain-hierarchy: - - Admin - - IAM Groups - x-accepts: application/json - get: - deprecated: false - description: Returns a user group. - operationId: getUserGroup - parameters: - - explode: false - in: path - name: userGroupId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: Public API Group - memberCount: 1 - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/getUserGroup_200_response' - application/vnd.segment.v1beta+json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 0 - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/getUserGroup_200_response' - application/vnd.segment.v1+json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 0 - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/getUserGroup_200_response' - application/json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 0 - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/getUserGroup_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get User Group - tags: - - IAM Groups - x-domain-hierarchy: - - Admin - - IAM Groups - x-accepts: application/json - patch: - deprecated: false - description: "Updates a user group for a Workspace.\n\n\n\nWhen called, this\ - \ endpoint may generate the `User Group Updated` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n \n\n\nThe rate limit for this endpoint is 60 requests per\ - \ minute, which is lower than the default due to access pattern restrictions.\ - \ Once reached, this endpoint will respond with the 429 HTTP status code with\ - \ headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits)\ - \ for more information." - operationId: updateUserGroup - parameters: - - explode: false - in: path - name: userGroupId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - userGroupId: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - schema: - $ref: '#/components/schemas/UpdateUserGroupV1Input' - application/vnd.segment.v1beta+json: - example: - userGroupId: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - schema: - $ref: '#/components/schemas/UpdateUserGroupV1Input' - application/vnd.segment.v1+json: - example: - userGroupId: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - schema: - $ref: '#/components/schemas/UpdateUserGroupV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 1 - schema: - $ref: '#/components/schemas/updateUserGroup_200_response' - application/vnd.segment.v1beta+json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 0 - schema: - $ref: '#/components/schemas/updateUserGroup_200_response' - application/vnd.segment.v1+json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 0 - schema: - $ref: '#/components/schemas/updateUserGroup_200_response' - application/json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 0 - schema: - $ref: '#/components/schemas/updateUserGroup_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Update User Group - tags: - - IAM Groups - x-domain-hierarchy: - - Admin - - IAM Groups - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /users: - delete: - deprecated: false - description: "Removes one or multiple users.\n\n\n\nWhen called, this endpoint\ - \ may generate the `Group Memberships Deleted` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n \n\n\nThe rate limit for this endpoint is 60 requests per\ - \ minute, which is lower than the default due to access pattern restrictions.\ - \ Once reached, this endpoint will respond with the 429 HTTP status code with\ - \ headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits)\ - \ for more information." - operationId: deleteUsers - parameters: - - description: |- - The ids of the users to remove. - - This parameter exists in alpha. - explode: false - in: query - name: userIds - required: true - schema: - description: The ids of the users to remove. - items: - type: string - title: userIds - type: array - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteUsers_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteUsers_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteUsers_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteUsers_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Delete Users - tags: - - IAM Users - x-domain-hierarchy: - - Admin - - IAM Users - x-accepts: application/json - get: - deprecated: false - description: Returns a list of users with access to the Workspace. - operationId: listUsers - parameters: - - description: |- - Pagination for users. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - users: - - id: i2VTJURQprNfqdwjLFPWYx - name: Sloth - email: sloth@segment.com - - id: sgJDWk3K21k6LE3tLU9nRK - name: "" - email: papi@segment.com - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listUsers_200_response' - application/vnd.segment.v1beta+json: - example: - data: - users: - - id: i2VTJURQprNfqdwjLFPWYx - name: Sloth - email: sloth@segment.com - - id: sgJDWk3K21k6LE3tLU9nRK - name: "" - email: papi@segment.com - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listUsers_200_response' - application/vnd.segment.v1+json: - example: - data: - users: - - id: i2VTJURQprNfqdwjLFPWYx - name: Sloth - email: sloth@segment.com - - id: sgJDWk3K21k6LE3tLU9nRK - name: "" - email: papi@segment.com - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listUsers_200_response' - application/json: - example: - data: - users: - - id: i2VTJURQprNfqdwjLFPWYx - name: Sloth - email: sloth@segment.com - - id: sgJDWk3K21k6LE3tLU9nRK - name: "" - email: papi@segment.com - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listUsers_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Users - tags: - - IAM Users - x-domain-hierarchy: - - Admin - - IAM Users - x-accepts: application/json - /warehouses/{warehouseId}: - delete: - deprecated: false - description: "Deletes an existing Warehouse.\n\n\n\nWhen called, this endpoint\ - \ may generate the `Storage Destination Deleted` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n " - operationId: deleteWarehouse - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteWarehouse_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/deleteWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Delete Warehouse - tags: - - Warehouses - x-domain-hierarchy: - - Connections - - Warehouses - x-accepts: application/json - get: - deprecated: false - description: Returns a Warehouse by its id. - operationId: getWarehouse - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - warehouse: - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - schema: - $ref: '#/components/schemas/getWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - warehouse: - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - schema: - $ref: '#/components/schemas/getWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - warehouse: - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - schema: - $ref: '#/components/schemas/getWarehouse_200_response' - application/json: - example: - data: - warehouse: - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - schema: - $ref: '#/components/schemas/getWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Warehouse - tags: - - Warehouses - x-domain-hierarchy: - - Connections - - Warehouses - x-accepts: application/json - patch: - deprecated: false - description: "Updates an existing Warehouse.\n\nWhen called, this endpoint may\ - \ generate one or more of the following [Audit Trail](/tag/Audit-Trail) events:\n\ - * Storage Destination Modified\n* Storage Destination Enabled\n " - operationId: updateWarehouse - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - warehouseId: kjU72LCJexvrqL7G4TMHHN - name: API Example Test Warehouse Update - settings: - host: aws.redshift.dev - schema: - $ref: '#/components/schemas/UpdateWarehouseV1Input' - application/vnd.segment.v1beta+json: - example: - warehouseId: kjU72LCJexvrqL7G4TMHHN - name: Redshift Dev - settings: - host: aws.redshift.dev - schema: - $ref: '#/components/schemas/UpdateWarehouseV1Input' - application/vnd.segment.v1+json: - example: - warehouseId: kjU72LCJexvrqL7G4TMHHN - name: Redshift Dev - settings: - host: aws.redshift.dev - schema: - $ref: '#/components/schemas/UpdateWarehouseV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - warehouse: - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: - host: aws.redshift.dev - name: API Example Test Warehouse Update - schema: - $ref: '#/components/schemas/updateWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - warehouse: - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: - host: aws.redshift.dev - name: Redshift Dev - schema: - $ref: '#/components/schemas/updateWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - warehouse: - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: - host: aws.redshift.dev - name: Redshift Dev - schema: - $ref: '#/components/schemas/updateWarehouse_200_response' - application/json: - example: - data: - warehouse: - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: - host: aws.redshift.dev - name: Redshift Dev - schema: - $ref: '#/components/schemas/updateWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Update Warehouse - tags: - - Warehouses - x-domain-hierarchy: - - Connections - - Warehouses - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /sources/{sourceId}/edge-functions/disable: - patch: - deprecated: false - description: "Disable Edge Functions for your Source.\n\n**Note**: In order\ - \ to successfully call this endpoint, the specified Workspace needs to have\ - \ the Edge Functions feature enabled. Please reach out to your customer success\ - \ manager for more information.\n " - operationId: disableEdgeFunctions - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - edgeFunctions: - id: 1d1f7465-429b-451c-96e6-f5656f8f4f85 - sourceId: qQEHquLrjRDN9j1ByrChyn - downloadURL: "" - createdBy: sgJDWk3K21k6LE3tLU9nRK - createdAt: 2006-01-02T15:04:05.000Z - version: 2 - schema: - $ref: '#/components/schemas/disableEdgeFunctions_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Disable Edge Functions - tags: - - Edge Functions - x-domain-hierarchy: - - Connections - - Edge Functions - x-accepts: application/json - /echo: - get: - deprecated: false - description: Public Echo endpoint. - operationId: echo - parameters: - - description: |- - Sets the response `message` field. The response contains this field's entry. - - This parameter exists in v1. - explode: false - in: query - name: message - required: true - schema: - description: Sets the response `message` field. The response contains this - field's entry. - title: message - type: string - style: deepObject - - description: "The desired response delay, in milliseconds.\n\nThis parameter\ - \ exists in v1." - explode: false - in: query - name: delay - required: false - schema: - description: "The desired response delay, in milliseconds." - title: delay - type: number - style: deepObject - - description: "If `true`, returns an HTTP `4xx` error that contains the string\ - \ in `message`.\n\nThis parameter exists in v1." - explode: false - in: query - name: triggerError - required: false - schema: - description: "If `true`, returns an HTTP `4xx` error that contains the string\ - \ in `message`." - title: triggerError - type: boolean - style: deepObject - - description: "If `true`, returns an HTTP `4xx` error that contains the value\ - \ of the `message` field in the error message array.\n\nThis has no effect\ - \ if the request sets `triggerError`.\n\nThis parameter exists in v1." - explode: false - in: query - name: triggerMultipleErrors - required: false - schema: - description: "If `true`, returns an HTTP `4xx` error that contains the value\ - \ of the `message` field in the error message array.\n\nThis has no effect\ - \ if the request sets `triggerError`." - title: triggerMultipleErrors - type: boolean - style: deepObject - - description: "If `true`, triggers a `500` error.\n\nThis has no effect if\ - \ the request sets either `triggerError` or `triggerMultipleErrors`.\n\n\ - This parameter exists in v1." - explode: false - in: query - name: triggerUnexpectedError - required: false - schema: - description: "If `true`, triggers a `500` error.\n\nThis has no effect if\ - \ the request sets either `triggerError` or `triggerMultipleErrors`." - title: triggerUnexpectedError - type: boolean - style: deepObject - - description: |- - Sets the HTTP status code to return. - - This parameter exists in v1. - explode: false - in: query - name: statusCode - required: false - schema: - description: Sets the HTTP status code to return. - title: statusCode - type: number - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - method: get - message: "Hello, World!" - headers: - : - schema: - $ref: '#/components/schemas/echo_200_response' - application/vnd.segment.v1+json: - example: - data: - method: get - message: "Hello, World!" - headers: - : - schema: - $ref: '#/components/schemas/echo_200_response_1' - application/json: - example: - data: - method: get - message: "Hello, World!" - headers: - : - schema: - $ref: '#/components/schemas/echo_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Echo - tags: - - Testing - x-domain-hierarchy: - - General - - Testing - x-accepts: application/json - /sources/{sourceId}/edge-functions/upload-url: - post: - deprecated: false - description: "Generate a temporary upload URL, that can be used to upload an\ - \ Edge Functions bundle.\n\n**Note**: In order to successfully call this endpoint,\ - \ the specified Workspace needs to have the Edge Functions feature enabled.\ - \ Please reach out to your customer success manager for more information.\n\ - \ " - operationId: generateUploadURLForEdgeFunctions - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - uploadURL: - schema: - $ref: '#/components/schemas/generateUploadURLForEdgeFunctions_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Generate Upload URL for Edge Functions - tags: - - Edge Functions - x-domain-hierarchy: - - Connections - - Edge Functions - x-accepts: application/json - /warehouses/{warehouseId}/advanced-sync-schedule: - get: - deprecated: false - description: "Returns the advanced sync schedule for a Warehouse.\n\n\nThe rate\ - \ limit for this endpoint is 2 requests per minute, which is lower than the\ - \ default due to access pattern restrictions. Once reached, this endpoint\ - \ will respond with the 429 HTTP status code with headers indicating the limit\ - \ parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: getAdvancedSyncScheduleFromWarehouse - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - enabled: false - schema: - $ref: '#/components/schemas/getAdvancedSyncScheduleFromWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - enabled: true - schedule: - times: - - hourOfDay: 5 - enabled: false - - hourOfDay: 7 - enabled: true - - hourOfDay: 23 - enabled: true - timezone: America/Vancouver - schema: - $ref: '#/components/schemas/getAdvancedSyncScheduleFromWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - enabled: true - schedule: - times: - - hourOfDay: 5 - enabled: false - - hourOfDay: 7 - enabled: true - - hourOfDay: 23 - enabled: true - timezone: America/Vancouver - schema: - $ref: '#/components/schemas/getAdvancedSyncScheduleFromWarehouse_200_response' - application/json: - example: - data: - enabled: true - schedule: - times: - - hourOfDay: 5 - enabled: false - - hourOfDay: 7 - enabled: true - - hourOfDay: 23 - enabled: true - timezone: America/Vancouver - schema: - $ref: '#/components/schemas/getAdvancedSyncScheduleFromWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Advanced Sync Schedule from Warehouse - tags: - - Selective Sync - x-domain-hierarchy: - - Connections - - Selective Sync - x-accepts: application/json - put: - deprecated: false - description: "Updates the advanced sync schedule for a Warehouse, replacing\ - \ the sync schedule with a new schedule.\n\n\nThe rate limit for this endpoint\ - \ is 2 requests per minute, which is lower than the default due to access\ - \ pattern restrictions. Once reached, this endpoint will respond with the\ - \ 429 HTTP status code with headers indicating the limit parameters. See [Rate\ - \ Limiting](/#tag/Rate-Limits) for more information." - operationId: replaceAdvancedSyncScheduleForWarehouse - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - warehouseId: kjU72LCJexvrqL7G4TMHHN - enabled: true - schedule: - times: - - enabled: true - hourOfDay: 7 - - enabled: false - hourOfDay: 5 - - enabled: true - hourOfDay: 23 - timezone: America/Vancouver - schema: - $ref: '#/components/schemas/ReplaceAdvancedSyncScheduleForWarehouseV1Input' - application/vnd.segment.v1beta+json: - example: - warehouseId: kjU72LCJexvrqL7G4TMHHN - enabled: true - schedule: - times: - - enabled: true - hourOfDay: 7 - - enabled: false - hourOfDay: 5 - - enabled: true - hourOfDay: 23 - timezone: America/Vancouver - schema: - $ref: '#/components/schemas/ReplaceAdvancedSyncScheduleForWarehouseV1Input' - application/vnd.segment.v1+json: - example: - warehouseId: kjU72LCJexvrqL7G4TMHHN - enabled: true - schedule: - times: - - enabled: true - hourOfDay: 7 - - enabled: false - hourOfDay: 5 - - enabled: true - hourOfDay: 23 - timezone: America/Vancouver - schema: - $ref: '#/components/schemas/ReplaceAdvancedSyncScheduleForWarehouseV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - enabled: true - schedule: - times: - - hourOfDay: 5 - enabled: false - - hourOfDay: 7 - enabled: true - - hourOfDay: 23 - enabled: true - timezone: America/Vancouver - schema: - $ref: '#/components/schemas/replaceAdvancedSyncScheduleForWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - enabled: true - schedule: - times: - - hourOfDay: 5 - enabled: false - - hourOfDay: 7 - enabled: true - - hourOfDay: 23 - enabled: true - timezone: America/Vancouver - schema: - $ref: '#/components/schemas/replaceAdvancedSyncScheduleForWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - enabled: true - schedule: - times: - - hourOfDay: 5 - enabled: false - - hourOfDay: 7 - enabled: true - - hourOfDay: 23 - enabled: true - timezone: America/Vancouver - schema: - $ref: '#/components/schemas/replaceAdvancedSyncScheduleForWarehouse_200_response' - application/json: - example: - data: - enabled: true - schedule: - times: - - hourOfDay: 5 - enabled: false - - hourOfDay: 7 - enabled: true - - hourOfDay: 23 - enabled: true - timezone: America/Vancouver - schema: - $ref: '#/components/schemas/replaceAdvancedSyncScheduleForWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Replace Advanced Sync Schedule for Warehouse - tags: - - Selective Sync - x-domain-hierarchy: - - Connections - - Selective Sync - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /warehouses/{warehouseId}/connection-state: - get: - deprecated: false - description: "Verifies the state of Warehouse connection settings.\n\n\nThe\ - \ rate limit for this endpoint is 20 requests per minute, which is lower than\ - \ the default due to access pattern restrictions. Once reached, this endpoint\ - \ will respond with the 429 HTTP status code with headers indicating the limit\ - \ parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: getConnectionStateFromWarehouse - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - connectionState: CONNECTED - schema: - $ref: '#/components/schemas/getConnectionStateFromWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - connectionState: CONNECTED - schema: - $ref: '#/components/schemas/getConnectionStateFromWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - connectionState: CONNECTED - schema: - $ref: '#/components/schemas/getConnectionStateFromWarehouse_200_response' - application/json: - example: - data: - connectionState: CONNECTED - schema: - $ref: '#/components/schemas/getConnectionStateFromWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Connection State from Warehouse - tags: - - Warehouses - x-domain-hierarchy: - - Connections - - Warehouses - x-accepts: application/json - /usage/api-calls/sources/daily: - get: - deprecated: false - description: Provides daily cumulative per-source API call counts for a usage - period. - operationId: getDailyPerSourceAPICallsUsage - parameters: - - description: |- - The start of the usage month in the ISO-8601 format. - - This parameter exists in alpha. - explode: false - in: query - name: period - required: true - schema: - description: The start of the usage month in the ISO-8601 format. - title: period - type: string - style: deepObject - - description: |- - Pagination input for per Source API calls counts. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - dailyPerSourceAPICallsUsage: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyPerSourceAPICallsUsage_200_response' - application/vnd.segment.v1beta+json: - example: - data: - dailyPerSourceAPICallsUsage: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyPerSourceAPICallsUsage_200_response' - application/vnd.segment.v1+json: - example: - data: - dailyPerSourceAPICallsUsage: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyPerSourceAPICallsUsage_200_response' - application/json: - example: - data: - dailyPerSourceAPICallsUsage: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyPerSourceAPICallsUsage_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Daily Per Source API Calls Usage - tags: - - API Calls - x-domain-hierarchy: - - Usage - - API Calls - x-accepts: application/json - /usage/mtu/sources/daily: - get: - deprecated: false - description: Provides daily cumulative per-source MTU counts for a usage period. - operationId: getDailyPerSourceMTUUsage - parameters: - - description: "The start of the usage month, in the ISO-8601 format.\n\nThis\ - \ parameter exists in alpha." - explode: false - in: query - name: period - required: true - schema: - description: "The start of the usage month, in the ISO-8601 format." - title: period - type: string - style: deepObject - - description: |- - Pagination input for per Source MTU counts. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - dailyPerSourceMTUUsage: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "3" - anonymousIdentified: "7" - identified: "33" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "7" - anonymousIdentified: "13" - identified: "67" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "10" - anonymousIdentified: "20" - identified: "100" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "13" - anonymousIdentified: "27" - identified: "133" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "17" - anonymousIdentified: "33" - identified: "167" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "20" - anonymousIdentified: "40" - identified: "200" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "23" - anonymousIdentified: "47" - identified: "233" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "27" - anonymousIdentified: "53" - identified: "267" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "30" - anonymousIdentified: "60" - identified: "300" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "33" - anonymousIdentified: "67" - identified: "333" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyPerSourceMTUUsage_200_response' - application/vnd.segment.v1beta+json: - example: - data: - dailyPerSourceMTUUsage: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "3" - anonymousIdentified: "7" - identified: "33" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "7" - anonymousIdentified: "13" - identified: "67" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "10" - anonymousIdentified: "20" - identified: "100" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "13" - anonymousIdentified: "27" - identified: "133" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "17" - anonymousIdentified: "33" - identified: "167" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "20" - anonymousIdentified: "40" - identified: "200" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "23" - anonymousIdentified: "47" - identified: "233" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "27" - anonymousIdentified: "53" - identified: "267" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "30" - anonymousIdentified: "60" - identified: "300" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "33" - anonymousIdentified: "67" - identified: "333" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyPerSourceMTUUsage_200_response' - application/vnd.segment.v1+json: - example: - data: - dailyPerSourceMTUUsage: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "3" - anonymousIdentified: "7" - identified: "33" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "7" - anonymousIdentified: "13" - identified: "67" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "10" - anonymousIdentified: "20" - identified: "100" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "13" - anonymousIdentified: "27" - identified: "133" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "17" - anonymousIdentified: "33" - identified: "167" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "20" - anonymousIdentified: "40" - identified: "200" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "23" - anonymousIdentified: "47" - identified: "233" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "27" - anonymousIdentified: "53" - identified: "267" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "30" - anonymousIdentified: "60" - identified: "300" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "33" - anonymousIdentified: "67" - identified: "333" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyPerSourceMTUUsage_200_response' - application/json: - example: - data: - dailyPerSourceMTUUsage: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "3" - anonymousIdentified: "7" - identified: "33" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "7" - anonymousIdentified: "13" - identified: "67" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "10" - anonymousIdentified: "20" - identified: "100" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "13" - anonymousIdentified: "27" - identified: "133" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "17" - anonymousIdentified: "33" - identified: "167" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "20" - anonymousIdentified: "40" - identified: "200" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "23" - anonymousIdentified: "47" - identified: "233" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "27" - anonymousIdentified: "53" - identified: "267" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "30" - anonymousIdentified: "60" - identified: "300" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - sourceId: rh5BDZp6QDHvXFCkibm1pR - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "33" - anonymousIdentified: "67" - identified: "333" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyPerSourceMTUUsage_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Daily Per Source MTU Usage - tags: - - Monthly Tracked Users - x-domain-hierarchy: - - Usage - - Monthly Tracked Users - x-accepts: application/json - /usage/api-calls/daily: - get: - deprecated: false - description: Provides daily cumulative API call counts for a usage period. - operationId: getDailyWorkspaceAPICallsUsage - parameters: - - description: |- - The start of the usage month in the ISO-8601 format. - - This parameter exists in alpha. - explode: false - in: query - name: period - required: true - schema: - description: The start of the usage month in the ISO-8601 format. - title: period - type: string - style: deepObject - - description: |- - Pagination input for Workspace API call counts. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - dailyWorkspaceAPICallsUsage: - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyWorkspaceAPICallsUsage_200_response' - application/vnd.segment.v1beta+json: - example: - data: - dailyWorkspaceAPICallsUsage: - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyWorkspaceAPICallsUsage_200_response' - application/vnd.segment.v1+json: - example: - data: - dailyWorkspaceAPICallsUsage: - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyWorkspaceAPICallsUsage_200_response' - application/json: - example: - data: - dailyWorkspaceAPICallsUsage: - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - - apiCalls: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyWorkspaceAPICallsUsage_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Daily Workspace API Calls Usage - tags: - - API Calls - x-domain-hierarchy: - - Usage - - API Calls - x-accepts: application/json - /usage/mtu/daily: - get: - deprecated: false - description: Provides daily cumulative MTU counts for a usage period. - operationId: getDailyWorkspaceMTUUsage - parameters: - - description: "The start of the usage month, in the ISO-8601 format.\n\nThis\ - \ parameter exists in alpha." - explode: false - in: query - name: period - required: true - schema: - description: "The start of the usage month, in the ISO-8601 format." - title: period - type: string - style: deepObject - - description: |- - Pagination input for Workspace MTU counts. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - dailyWorkspaceMTUUsage: - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "3" - anonymousIdentified: "7" - identified: "33" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "7" - anonymousIdentified: "13" - identified: "67" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "10" - anonymousIdentified: "20" - identified: "100" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "13" - anonymousIdentified: "27" - identified: "133" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "17" - anonymousIdentified: "33" - identified: "167" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "20" - anonymousIdentified: "40" - identified: "200" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "23" - anonymousIdentified: "47" - identified: "233" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "27" - anonymousIdentified: "53" - identified: "267" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "30" - anonymousIdentified: "60" - identified: "300" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "33" - anonymousIdentified: "67" - identified: "333" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyWorkspaceMTUUsage_200_response' - application/vnd.segment.v1beta+json: - example: - data: - dailyWorkspaceMTUUsage: - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "3" - anonymousIdentified: "7" - identified: "33" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "7" - anonymousIdentified: "13" - identified: "67" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "10" - anonymousIdentified: "20" - identified: "100" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "13" - anonymousIdentified: "27" - identified: "133" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "17" - anonymousIdentified: "33" - identified: "167" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "20" - anonymousIdentified: "40" - identified: "200" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "23" - anonymousIdentified: "47" - identified: "233" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "27" - anonymousIdentified: "53" - identified: "267" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "30" - anonymousIdentified: "60" - identified: "300" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "33" - anonymousIdentified: "67" - identified: "333" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyWorkspaceMTUUsage_200_response' - application/vnd.segment.v1+json: - example: - data: - dailyWorkspaceMTUUsage: - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "3" - anonymousIdentified: "7" - identified: "33" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "7" - anonymousIdentified: "13" - identified: "67" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "10" - anonymousIdentified: "20" - identified: "100" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "13" - anonymousIdentified: "27" - identified: "133" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "17" - anonymousIdentified: "33" - identified: "167" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "20" - anonymousIdentified: "40" - identified: "200" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "23" - anonymousIdentified: "47" - identified: "233" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "27" - anonymousIdentified: "53" - identified: "267" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "30" - anonymousIdentified: "60" - identified: "300" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "33" - anonymousIdentified: "67" - identified: "333" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyWorkspaceMTUUsage_200_response' - application/json: - example: - data: - dailyWorkspaceMTUUsage: - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "3" - anonymousIdentified: "7" - identified: "33" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "7" - anonymousIdentified: "13" - identified: "67" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "10" - anonymousIdentified: "20" - identified: "100" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "13" - anonymousIdentified: "27" - identified: "133" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "17" - anonymousIdentified: "33" - identified: "167" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "20" - anonymousIdentified: "40" - identified: "200" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "23" - anonymousIdentified: "47" - identified: "233" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "27" - anonymousIdentified: "53" - identified: "267" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "30" - anonymousIdentified: "60" - identified: "300" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - - periodStart: 1612137600 - periodEnd: 1614556800 - anonymous: "33" - anonymousIdentified: "67" - identified: "333" - neverIdentified: "0" - timestamp: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTA= - totalEntries: 28 - schema: - $ref: '#/components/schemas/getDailyWorkspaceMTUUsage_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Daily Workspace MTU Usage - tags: - - Monthly Tracked Users - x-domain-hierarchy: - - Usage - - Monthly Tracked Users - x-accepts: application/json - /catalog/destinations/{destinationMetadataId}: - get: - deprecated: false - description: Returns a Destination catalog item by its id. - operationId: getDestinationMetadata - parameters: - - explode: false - in: path - name: destinationMetadataId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - destinationMetadata: - id: 54521fd525e721e32a72ee91 - name: Amplitude - description: "Amplitude is an event tracking and segmentation\ - \ platform for your web and mobile apps. By analyzing the actions\ - \ your users perform, you can gain a better understanding to\ - \ drive retention, engagement, and conversion." - slug: amplitude - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/amplitude-default.svg - mark: https://cdn.filepicker.io/api/file/Nmj7LgOQR62rdAmlbnLO - options: - - name: apiKey - type: string - defaultValue: "" - description: "You can find your API Key on your Amplitude [Settings\ - \ page](https://amplitude.com/settings)." - required: true - label: API Key - - name: appendFieldsToEventProps - type: text-map - defaultValue: {} - description: "Web Device-mode only. Configure event fields to\ - \ be appended to `event_props` for all track calls. For example,\ - \ entering `context.page.title` on the left and `pageTitle`\ - \ on the right will set the value of `context.page.title`\ - \ at `event_properties.pageTitle`." - required: false - label: Append Fields To Event Properties - - name: batchEvents - type: boolean - defaultValue: false - description: "If true, events are batched together and uploaded\ - \ only when the number of unsent events is greater than or\ - \ equal to `eventUploadThreshold` or after `eventUploadPeriodMillis`\ - \ milliseconds have passed since the first unsent event was\ - \ logged." - required: false - label: Batch Events - - name: deviceIdFromUrlParam - type: boolean - defaultValue: false - description: "If true, the SDK will parse device ID values from\ - \ url parameter `amp_device_id` if available." - required: false - label: Set Device ID From URL Parameter amp_device_id - - name: enableLocationListening - type: boolean - defaultValue: true - description: "Mobile Only. If a user has granted your app location\ - \ permissions, enable this setting so that the SDK will also\ - \ grab the location of the user. Amplitude will never prompt\ - \ the user for location permission, so this must be done by\ - \ your app. " - required: false - label: Enable Location Listening - status: PUBLIC - categories: - - Analytics - website: http://amplitude.com - components: - - code: https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/amplitude - owner: SEGMENT - type: BROWSER - - code: https://github.com/segment-integrations/analytics-ios-integration-amplitude - owner: SEGMENT - type: IOS - - code: https://github.com/segment-integrations/analytics-android-integration-amplitude - owner: SEGMENT - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/amplitude - owner: SEGMENT - type: SERVER - previousNames: - - Amplitude - supportedMethods: - track: true - pageview: true - identify: true - group: true - alias: false - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: true - browserUnbundlingPublic: true - actions: [] - presets: [] - schema: - $ref: '#/components/schemas/getDestinationMetadata_200_response' - application/vnd.segment.v1beta+json: - example: - data: - destinationMetadata: - id: 54521fd525e721e32a72ee91 - name: Amplitude - description: "Amplitude is an event tracking and segmentation\ - \ platform for your web and mobile apps. By analyzing the actions\ - \ your users perform, you can gain a better understanding to\ - \ drive retention, engagement, and conversion." - slug: amplitude - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/amplitude-default.svg - mark: https://cdn.filepicker.io/api/file/Nmj7LgOQR62rdAmlbnLO - options: - - name: apiKey - type: string - defaultValue: "" - description: "You can find your API Key on your Amplitude [Settings\ - \ page](https://amplitude.com/settings)." - required: true - label: API Key - - name: appendFieldsToEventProps - type: text-map - defaultValue: {} - description: "Web Device-mode only. Configure event fields to\ - \ be appended to `event_props` for all track calls. For example,\ - \ entering `context.page.title` on the left and `pageTitle`\ - \ on the right will set the value of `context.page.title`\ - \ at `event_properties.pageTitle`." - required: false - label: Append Fields To Event Properties - - name: batchEvents - type: boolean - defaultValue: false - description: "If true, events are batched together and uploaded\ - \ only when the number of unsent events is greater than or\ - \ equal to `eventUploadThreshold` or after `eventUploadPeriodMillis`\ - \ milliseconds have passed since the first unsent event was\ - \ logged." - required: false - label: Batch Events - - name: deviceIdFromUrlParam - type: boolean - defaultValue: false - description: "If true, the SDK will parse device ID values from\ - \ url parameter `amp_device_id` if available." - required: false - label: Set Device ID From URL Parameter amp_device_id - - name: enableLocationListening - type: boolean - defaultValue: true - description: "Mobile Only. If a user has granted your app location\ - \ permissions, enable this setting so that the SDK will also\ - \ grab the location of the user. Amplitude will never prompt\ - \ the user for location permission, so this must be done by\ - \ your app. " - required: false - label: Enable Location Listening - status: PUBLIC - categories: - - Analytics - website: http://amplitude.com - components: - - code: https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/amplitude - owner: SEGMENT - type: BROWSER - - code: https://github.com/segment-integrations/analytics-ios-integration-amplitude - owner: SEGMENT - type: IOS - - code: https://github.com/segment-integrations/analytics-android-integration-amplitude - owner: SEGMENT - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/amplitude - owner: SEGMENT - type: SERVER - previousNames: - - Amplitude - supportedMethods: - track: true - pageview: true - identify: true - group: true - alias: false - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: true - browserUnbundlingPublic: true - actions: [] - presets: [] - schema: - $ref: '#/components/schemas/getDestinationMetadata_200_response' - application/vnd.segment.v1+json: - example: - data: - destinationMetadata: - id: 54521fd525e721e32a72ee91 - name: Amplitude - description: "Amplitude is an event tracking and segmentation\ - \ platform for your web and mobile apps. By analyzing the actions\ - \ your users perform, you can gain a better understanding to\ - \ drive retention, engagement, and conversion." - slug: amplitude - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/amplitude-default.svg - mark: https://cdn.filepicker.io/api/file/Nmj7LgOQR62rdAmlbnLO - options: - - name: apiKey - type: string - defaultValue: "" - description: "You can find your API Key on your Amplitude [Settings\ - \ page](https://amplitude.com/settings)." - required: true - label: API Key - - name: appendFieldsToEventProps - type: text-map - defaultValue: {} - description: "Web Device-mode only. Configure event fields to\ - \ be appended to `event_props` for all track calls. For example,\ - \ entering `context.page.title` on the left and `pageTitle`\ - \ on the right will set the value of `context.page.title`\ - \ at `event_properties.pageTitle`." - required: false - label: Append Fields To Event Properties - - name: batchEvents - type: boolean - defaultValue: false - description: "If true, events are batched together and uploaded\ - \ only when the number of unsent events is greater than or\ - \ equal to `eventUploadThreshold` or after `eventUploadPeriodMillis`\ - \ milliseconds have passed since the first unsent event was\ - \ logged." - required: false - label: Batch Events - - name: deviceIdFromUrlParam - type: boolean - defaultValue: false - description: "If true, the SDK will parse device ID values from\ - \ url parameter `amp_device_id` if available." - required: false - label: Set Device ID From URL Parameter amp_device_id - - name: enableLocationListening - type: boolean - defaultValue: true - description: "Mobile Only. If a user has granted your app location\ - \ permissions, enable this setting so that the SDK will also\ - \ grab the location of the user. Amplitude will never prompt\ - \ the user for location permission, so this must be done by\ - \ your app. " - required: false - label: Enable Location Listening - status: PUBLIC - categories: - - Analytics - website: http://amplitude.com - components: - - code: https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/amplitude - owner: SEGMENT - type: BROWSER - - code: https://github.com/segment-integrations/analytics-ios-integration-amplitude - owner: SEGMENT - type: IOS - - code: https://github.com/segment-integrations/analytics-android-integration-amplitude - owner: SEGMENT - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/amplitude - owner: SEGMENT - type: SERVER - previousNames: - - Amplitude - supportedMethods: - track: true - pageview: true - identify: true - group: true - alias: false - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: true - browserUnbundlingPublic: true - actions: [] - presets: [] - schema: - $ref: '#/components/schemas/getDestinationMetadata_200_response' - application/json: - example: - data: - destinationMetadata: - id: 54521fd525e721e32a72ee91 - name: Amplitude - description: "Amplitude is an event tracking and segmentation\ - \ platform for your web and mobile apps. By analyzing the actions\ - \ your users perform, you can gain a better understanding to\ - \ drive retention, engagement, and conversion." - slug: amplitude - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/amplitude-default.svg - mark: https://cdn.filepicker.io/api/file/Nmj7LgOQR62rdAmlbnLO - options: - - name: apiKey - type: string - defaultValue: "" - description: "You can find your API Key on your Amplitude [Settings\ - \ page](https://amplitude.com/settings)." - required: true - label: API Key - - name: appendFieldsToEventProps - type: text-map - defaultValue: {} - description: "Web Device-mode only. Configure event fields to\ - \ be appended to `event_props` for all track calls. For example,\ - \ entering `context.page.title` on the left and `pageTitle`\ - \ on the right will set the value of `context.page.title`\ - \ at `event_properties.pageTitle`." - required: false - label: Append Fields To Event Properties - - name: batchEvents - type: boolean - defaultValue: false - description: "If true, events are batched together and uploaded\ - \ only when the number of unsent events is greater than or\ - \ equal to `eventUploadThreshold` or after `eventUploadPeriodMillis`\ - \ milliseconds have passed since the first unsent event was\ - \ logged." - required: false - label: Batch Events - - name: deviceIdFromUrlParam - type: boolean - defaultValue: false - description: "If true, the SDK will parse device ID values from\ - \ url parameter `amp_device_id` if available." - required: false - label: Set Device ID From URL Parameter amp_device_id - - name: enableLocationListening - type: boolean - defaultValue: true - description: "Mobile Only. If a user has granted your app location\ - \ permissions, enable this setting so that the SDK will also\ - \ grab the location of the user. Amplitude will never prompt\ - \ the user for location permission, so this must be done by\ - \ your app. " - required: false - label: Enable Location Listening - status: PUBLIC - categories: - - Analytics - website: http://amplitude.com - components: - - code: https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/amplitude - owner: SEGMENT - type: BROWSER - - code: https://github.com/segment-integrations/analytics-ios-integration-amplitude - owner: SEGMENT - type: IOS - - code: https://github.com/segment-integrations/analytics-android-integration-amplitude - owner: SEGMENT - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/amplitude - owner: SEGMENT - type: SERVER - previousNames: - - Amplitude - supportedMethods: - track: true - pageview: true - identify: true - group: true - alias: false - supportedPlatforms: - browser: true - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: true - browserUnbundlingPublic: true - actions: [] - presets: [] - schema: - $ref: '#/components/schemas/getDestinationMetadata_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Destination Metadata - tags: - - Catalog - x-domain-hierarchy: - - Connections - - Catalog - x-accepts: application/json - /catalog/destinations: - get: - deprecated: false - description: Returns a list of all available Destinations in the Segment catalog. - operationId: getDestinationsCatalog - parameters: - - description: |- - Required pagination parameters used to filter the Destinations catalog. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - destinationsCatalog: - - id: 54521fd525e721e32a72ee8e - name: AdRoll - description: 'AdRoll is a retargeting network that allows you - to show ads to visitors who''ve landed on your site while browsing - the web. ' - slug: adroll - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/adroll-default.svg - mark: https://cdn.filepicker.io/api/file/IKo2fU59RROBsNtj4lHs - options: - - name: _version - type: number - defaultValue: 2 - description: "" - required: false - label: _version - - name: advId - type: string - defaultValue: "" - description: "You can find your Advertiser ID in your AdRoll\ - \ dashboard by clicking the **green or red dot** in the lower-left\ - \ corner. In the Javascript snippet, the Advertiser ID appears\ - \ as `adroll_avd_id = 'XXXXXXX'` on line 2. It should be 22\ - \ characters long and look something like this: `WYJD6WNIAJC2XG6PT7UK4B`." - required: true - label: Advertiser ID - - name: events - type: text-map - defaultValue: {} - description: AdRoll allows you to create a Segment Name and - ID for conversions events. Use this mapping to trigger the - *AdRoll Segment ID* (on the right) when the Event Name (on - the left) is passed in a Track method. - required: false - label: Events - - name: pixId - type: string - defaultValue: "" - description: "You can find your Pixel ID in your AdRoll dashboard\ - \ by clicking the **green or red dot** in the lower-left corner.\ - \ In the Javascript snippet, the Pixel ID appears as `adroll_pix_id\ - \ = 'XXXXXXX'` on line 3. It should be 22 characters long,\ - \ and look something like this: `6UUA5LKILFESVE44XH6SVX`." - required: true - label: Pixel ID - status: PUBLIC - categories: - - Advertising - website: http://adroll.com - components: - - code: https://github.com/segment-integrations/analytics.js-integration-adroll - type: BROWSER - previousNames: - - AdRoll - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: false - supportedPlatforms: - browser: true - mobile: false - server: false - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - - id: 54521fd525e721e32a72ee8f - name: AppsFlyer - description: Mobile app measurement and tracking. - slug: appsflyer - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/appsflyer-default.svg - mark: https://cdn.filepicker.io/api/file/AnJUEBvxRouLLOvIeQuK - options: - - name: androidAppID - type: string - defaultValue: "" - description: Your Android App's ID. Find this in your AppsFlyer's - 'My App' dashboard. It should look something like 'com.appsflyer.myapp'. - This is required for Android projects if you want to send - events using the server side integration. - required: true - label: Android App ID - - name: appleAppID - type: string - defaultValue: "" - description: "Your App's ID, which is accessible from iTunes\ - \ or in AppsFlyer's 'My App' dashboard. This is optional for\ - \ Android projects, and only required for iOS projects." - required: true - label: Apple App ID (iOS) - - name: appsFlyerDevKey - type: string - defaultValue: "" - description: "Your unique developer ID from AppsFlyer, which\ - \ is accessible from your AppsFlyer account." - required: true - label: AppsFlyer Dev Key - - name: canOmitAppsFlyerId - type: boolean - defaultValue: false - description: '*Only applicable for Appsflyer''s Business Tiers - customers using server-side or cloud mode destination.* Please - contact your AppsFlyer representative for more information. - This setting allows to use the advertising ID as appsflyer - ID.' - required: false - label: Can Omit AppsFlyerId - - name: fallbackToIdfv - type: boolean - defaultValue: false - description: "With the update to use analytics-ios v4.x SDK\ - \ if adTrackingEnabled is set to false, the advertisingId\ - \ key will be deleted from the event. If you have the setting\ - \ enabled \"Can Omit AppsFlyerId\", these events will fail\ - \ when sent to AppsFlyer API. To prevent these event failures\ - \ in this scenario enable this send the IDFV instead. When\ - \ the \"Can Omit AppsFlyerId\" setting is enabled if the IDFA\ - \ is zeroed out, we will also send an IDFV when this setting\ - \ is enabled. " - required: false - label: Fallback to send IDFV when advertisingId key not present - (Server-Side Only) - status: PUBLIC - categories: - - Attribution - - Deep Linking - website: http://www.appsflyer.com/ - components: - - code: https://github.com/AppsFlyerSDK/segment-appsflyer-ios - owner: PARTNER - type: IOS - - code: https://github.com/AppsFlyerSDK/AppsFlyer-Segment-Integration - owner: PARTNER - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/appsflyer - owner: SEGMENT - type: SERVER - previousNames: - - AppsFlyer - supportedMethods: - track: true - pageview: true - identify: true - group: true - alias: true - supportedPlatforms: - browser: false - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - pagination: - current: MA== - next: Mg== - totalEntries: 378 - schema: - $ref: '#/components/schemas/getDestinationsCatalog_200_response' - application/vnd.segment.v1beta+json: - example: - data: - destinationsCatalog: - - id: 54521fd525e721e32a72ee8e - name: AdRoll - description: 'AdRoll is a retargeting network that allows you - to show ads to visitors who''ve landed on your site while browsing - the web. ' - slug: adroll - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/adroll-default.svg - mark: https://cdn.filepicker.io/api/file/IKo2fU59RROBsNtj4lHs - options: - - name: _version - type: number - defaultValue: 2 - description: "" - required: false - label: _version - - name: advId - type: string - defaultValue: "" - description: "You can find your Advertiser ID in your AdRoll\ - \ dashboard by clicking the **green or red dot** in the lower-left\ - \ corner. In the Javascript snippet, the Advertiser ID appears\ - \ as `adroll_avd_id = 'XXXXXXX'` on line 2. It should be 22\ - \ characters long and look something like this: `WYJD6WNIAJC2XG6PT7UK4B`." - required: true - label: Advertiser ID - - name: events - type: text-map - defaultValue: {} - description: AdRoll allows you to create a Segment Name and - ID for conversions events. Use this mapping to trigger the - *AdRoll Segment ID* (on the right) when the Event Name (on - the left) is passed in a Track method. - required: false - label: Events - - name: pixId - type: string - defaultValue: "" - description: "You can find your Pixel ID in your AdRoll dashboard\ - \ by clicking the **green or red dot** in the lower-left corner.\ - \ In the Javascript snippet, the Pixel ID appears as `adroll_pix_id\ - \ = 'XXXXXXX'` on line 3. It should be 22 characters long,\ - \ and look something like this: `6UUA5LKILFESVE44XH6SVX`." - required: true - label: Pixel ID - status: PUBLIC - categories: - - Advertising - website: http://adroll.com - components: - - code: https://github.com/segment-integrations/analytics.js-integration-adroll - type: BROWSER - previousNames: - - AdRoll - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: false - supportedPlatforms: - browser: true - mobile: false - server: false - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - - id: 54521fd525e721e32a72ee8f - name: AppsFlyer - description: Mobile app measurement and tracking. - slug: appsflyer - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/appsflyer-default.svg - mark: https://cdn.filepicker.io/api/file/AnJUEBvxRouLLOvIeQuK - options: - - name: androidAppID - type: string - defaultValue: "" - description: Your Android App's ID. Find this in your AppsFlyer's - 'My App' dashboard. It should look something like 'com.appsflyer.myapp'. - This is required for Android projects if you want to send - events using the server side integration. - required: true - label: Android App ID - - name: appleAppID - type: string - defaultValue: "" - description: "Your App's ID, which is accessible from iTunes\ - \ or in AppsFlyer's 'My App' dashboard. This is optional for\ - \ Android projects, and only required for iOS projects." - required: true - label: Apple App ID (iOS) - - name: appsFlyerDevKey - type: string - defaultValue: "" - description: "Your unique developer ID from AppsFlyer, which\ - \ is accessible from your AppsFlyer account." - required: true - label: AppsFlyer Dev Key - - name: canOmitAppsFlyerId - type: boolean - defaultValue: false - description: '*Only applicable for Appsflyer''s Business Tiers - customers using server-side or cloud mode destination.* Please - contact your AppsFlyer representative for more information. - This setting allows to use the advertising ID as appsflyer - ID.' - required: false - label: Can Omit AppsFlyerId - - name: fallbackToIdfv - type: boolean - defaultValue: false - description: "With the update to use analytics-ios v4.x SDK\ - \ if adTrackingEnabled is set to false, the advertisingId\ - \ key will be deleted from the event. If you have the setting\ - \ enabled \"Can Omit AppsFlyerId\", these events will fail\ - \ when sent to AppsFlyer API. To prevent these event failures\ - \ in this scenario enable this send the IDFV instead. When\ - \ the \"Can Omit AppsFlyerId\" setting is enabled if the IDFA\ - \ is zeroed out, we will also send an IDFV when this setting\ - \ is enabled. " - required: false - label: Fallback to send IDFV when advertisingId key not present - (Server-Side Only) - status: PUBLIC - categories: - - Attribution - - Deep Linking - website: http://www.appsflyer.com/ - components: - - code: https://github.com/AppsFlyerSDK/segment-appsflyer-ios - owner: PARTNER - type: IOS - - code: https://github.com/AppsFlyerSDK/AppsFlyer-Segment-Integration - owner: PARTNER - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/appsflyer - owner: SEGMENT - type: SERVER - previousNames: - - AppsFlyer - supportedMethods: - track: true - pageview: true - identify: true - group: true - alias: true - supportedPlatforms: - browser: false - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - pagination: - current: MA== - next: Mg== - totalEntries: 378 - schema: - $ref: '#/components/schemas/getDestinationsCatalog_200_response' - application/vnd.segment.v1+json: - example: - data: - destinationsCatalog: - - id: 54521fd525e721e32a72ee8e - name: AdRoll - description: 'AdRoll is a retargeting network that allows you - to show ads to visitors who''ve landed on your site while browsing - the web. ' - slug: adroll - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/adroll-default.svg - mark: https://cdn.filepicker.io/api/file/IKo2fU59RROBsNtj4lHs - options: - - name: _version - type: number - defaultValue: 2 - description: "" - required: false - label: _version - - name: advId - type: string - defaultValue: "" - description: "You can find your Advertiser ID in your AdRoll\ - \ dashboard by clicking the **green or red dot** in the lower-left\ - \ corner. In the Javascript snippet, the Advertiser ID appears\ - \ as `adroll_avd_id = 'XXXXXXX'` on line 2. It should be 22\ - \ characters long and look something like this: `WYJD6WNIAJC2XG6PT7UK4B`." - required: true - label: Advertiser ID - - name: events - type: text-map - defaultValue: {} - description: AdRoll allows you to create a Segment Name and - ID for conversions events. Use this mapping to trigger the - *AdRoll Segment ID* (on the right) when the Event Name (on - the left) is passed in a Track method. - required: false - label: Events - - name: pixId - type: string - defaultValue: "" - description: "You can find your Pixel ID in your AdRoll dashboard\ - \ by clicking the **green or red dot** in the lower-left corner.\ - \ In the Javascript snippet, the Pixel ID appears as `adroll_pix_id\ - \ = 'XXXXXXX'` on line 3. It should be 22 characters long,\ - \ and look something like this: `6UUA5LKILFESVE44XH6SVX`." - required: true - label: Pixel ID - status: PUBLIC - categories: - - Advertising - website: http://adroll.com - components: - - code: https://github.com/segment-integrations/analytics.js-integration-adroll - type: BROWSER - previousNames: - - AdRoll - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: false - supportedPlatforms: - browser: true - mobile: false - server: false - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - - id: 54521fd525e721e32a72ee8f - name: AppsFlyer - description: Mobile app measurement and tracking. - slug: appsflyer - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/appsflyer-default.svg - mark: https://cdn.filepicker.io/api/file/AnJUEBvxRouLLOvIeQuK - options: - - name: androidAppID - type: string - defaultValue: "" - description: Your Android App's ID. Find this in your AppsFlyer's - 'My App' dashboard. It should look something like 'com.appsflyer.myapp'. - This is required for Android projects if you want to send - events using the server side integration. - required: true - label: Android App ID - - name: appleAppID - type: string - defaultValue: "" - description: "Your App's ID, which is accessible from iTunes\ - \ or in AppsFlyer's 'My App' dashboard. This is optional for\ - \ Android projects, and only required for iOS projects." - required: true - label: Apple App ID (iOS) - - name: appsFlyerDevKey - type: string - defaultValue: "" - description: "Your unique developer ID from AppsFlyer, which\ - \ is accessible from your AppsFlyer account." - required: true - label: AppsFlyer Dev Key - - name: canOmitAppsFlyerId - type: boolean - defaultValue: false - description: '*Only applicable for Appsflyer''s Business Tiers - customers using server-side or cloud mode destination.* Please - contact your AppsFlyer representative for more information. - This setting allows to use the advertising ID as appsflyer - ID.' - required: false - label: Can Omit AppsFlyerId - - name: fallbackToIdfv - type: boolean - defaultValue: false - description: "With the update to use analytics-ios v4.x SDK\ - \ if adTrackingEnabled is set to false, the advertisingId\ - \ key will be deleted from the event. If you have the setting\ - \ enabled \"Can Omit AppsFlyerId\", these events will fail\ - \ when sent to AppsFlyer API. To prevent these event failures\ - \ in this scenario enable this send the IDFV instead. When\ - \ the \"Can Omit AppsFlyerId\" setting is enabled if the IDFA\ - \ is zeroed out, we will also send an IDFV when this setting\ - \ is enabled. " - required: false - label: Fallback to send IDFV when advertisingId key not present - (Server-Side Only) - status: PUBLIC - categories: - - Attribution - - Deep Linking - website: http://www.appsflyer.com/ - components: - - code: https://github.com/AppsFlyerSDK/segment-appsflyer-ios - owner: PARTNER - type: IOS - - code: https://github.com/AppsFlyerSDK/AppsFlyer-Segment-Integration - owner: PARTNER - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/appsflyer - owner: SEGMENT - type: SERVER - previousNames: - - AppsFlyer - supportedMethods: - track: true - pageview: true - identify: true - group: true - alias: true - supportedPlatforms: - browser: false - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - pagination: - current: MA== - next: Mg== - totalEntries: 378 - schema: - $ref: '#/components/schemas/getDestinationsCatalog_200_response' - application/json: - example: - data: - destinationsCatalog: - - id: 54521fd525e721e32a72ee8e - name: AdRoll - description: 'AdRoll is a retargeting network that allows you - to show ads to visitors who''ve landed on your site while browsing - the web. ' - slug: adroll - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/adroll-default.svg - mark: https://cdn.filepicker.io/api/file/IKo2fU59RROBsNtj4lHs - options: - - name: _version - type: number - defaultValue: 2 - description: "" - required: false - label: _version - - name: advId - type: string - defaultValue: "" - description: "You can find your Advertiser ID in your AdRoll\ - \ dashboard by clicking the **green or red dot** in the lower-left\ - \ corner. In the Javascript snippet, the Advertiser ID appears\ - \ as `adroll_avd_id = 'XXXXXXX'` on line 2. It should be 22\ - \ characters long and look something like this: `WYJD6WNIAJC2XG6PT7UK4B`." - required: true - label: Advertiser ID - - name: events - type: text-map - defaultValue: {} - description: AdRoll allows you to create a Segment Name and - ID for conversions events. Use this mapping to trigger the - *AdRoll Segment ID* (on the right) when the Event Name (on - the left) is passed in a Track method. - required: false - label: Events - - name: pixId - type: string - defaultValue: "" - description: "You can find your Pixel ID in your AdRoll dashboard\ - \ by clicking the **green or red dot** in the lower-left corner.\ - \ In the Javascript snippet, the Pixel ID appears as `adroll_pix_id\ - \ = 'XXXXXXX'` on line 3. It should be 22 characters long,\ - \ and look something like this: `6UUA5LKILFESVE44XH6SVX`." - required: true - label: Pixel ID - status: PUBLIC - categories: - - Advertising - website: http://adroll.com - components: - - code: https://github.com/segment-integrations/analytics.js-integration-adroll - type: BROWSER - previousNames: - - AdRoll - supportedMethods: - track: true - pageview: true - identify: true - group: false - alias: false - supportedPlatforms: - browser: true - mobile: false - server: false - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - - id: 54521fd525e721e32a72ee8f - name: AppsFlyer - description: Mobile app measurement and tracking. - slug: appsflyer - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/appsflyer-default.svg - mark: https://cdn.filepicker.io/api/file/AnJUEBvxRouLLOvIeQuK - options: - - name: androidAppID - type: string - defaultValue: "" - description: Your Android App's ID. Find this in your AppsFlyer's - 'My App' dashboard. It should look something like 'com.appsflyer.myapp'. - This is required for Android projects if you want to send - events using the server side integration. - required: true - label: Android App ID - - name: appleAppID - type: string - defaultValue: "" - description: "Your App's ID, which is accessible from iTunes\ - \ or in AppsFlyer's 'My App' dashboard. This is optional for\ - \ Android projects, and only required for iOS projects." - required: true - label: Apple App ID (iOS) - - name: appsFlyerDevKey - type: string - defaultValue: "" - description: "Your unique developer ID from AppsFlyer, which\ - \ is accessible from your AppsFlyer account." - required: true - label: AppsFlyer Dev Key - - name: canOmitAppsFlyerId - type: boolean - defaultValue: false - description: '*Only applicable for Appsflyer''s Business Tiers - customers using server-side or cloud mode destination.* Please - contact your AppsFlyer representative for more information. - This setting allows to use the advertising ID as appsflyer - ID.' - required: false - label: Can Omit AppsFlyerId - - name: fallbackToIdfv - type: boolean - defaultValue: false - description: "With the update to use analytics-ios v4.x SDK\ - \ if adTrackingEnabled is set to false, the advertisingId\ - \ key will be deleted from the event. If you have the setting\ - \ enabled \"Can Omit AppsFlyerId\", these events will fail\ - \ when sent to AppsFlyer API. To prevent these event failures\ - \ in this scenario enable this send the IDFV instead. When\ - \ the \"Can Omit AppsFlyerId\" setting is enabled if the IDFA\ - \ is zeroed out, we will also send an IDFV when this setting\ - \ is enabled. " - required: false - label: Fallback to send IDFV when advertisingId key not present - (Server-Side Only) - status: PUBLIC - categories: - - Attribution - - Deep Linking - website: http://www.appsflyer.com/ - components: - - code: https://github.com/AppsFlyerSDK/segment-appsflyer-ios - owner: PARTNER - type: IOS - - code: https://github.com/AppsFlyerSDK/AppsFlyer-Segment-Integration - owner: PARTNER - type: ANDROID - - code: https://github.com/segmentio/integrations/tree/master/integrations/appsflyer - owner: SEGMENT - type: SERVER - previousNames: - - AppsFlyer - supportedMethods: - track: true - pageview: true - identify: true - group: true - alias: true - supportedPlatforms: - browser: false - mobile: true - server: true - supportedFeatures: - cloudModeInstances: "0" - deviceModeInstances: "0" - replay: false - browserUnbundling: false - browserUnbundlingPublic: true - actions: [] - presets: [] - pagination: - current: MA== - next: Mg== - totalEntries: 378 - schema: - $ref: '#/components/schemas/getDestinationsCatalog_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Destinations Catalog - tags: - - Catalog - x-domain-hierarchy: - - Connections - - Catalog - x-accepts: application/json - /events/volume: - get: - deprecated: false - description: "Enumerates the Workspace event volumes over time in minute increments.\n\ - \n\nThe rate limit for this endpoint is 20 requests per minute, which is lower\ - \ than the default due to access pattern restrictions. Once reached, this\ - \ endpoint will respond with the 429 HTTP status code with headers indicating\ - \ the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: getEventsVolumeFromWorkspace - parameters: - - description: |- - The size of each bucket in the requested window. - - This parameter exists in alpha. - explode: false - in: query - name: granularity - required: true - schema: - description: The size of each bucket in the requested window. - enum: - - DAY - - HOUR - - MINUTE - title: granularity - type: string - style: deepObject - - description: "The ISO8601 formatted timestamp that corresponds to the\nbeginning\ - \ of the requested time frame, inclusive.\n\nThis parameter exists in alpha." - explode: false - in: query - name: startTime - required: true - schema: - description: "The ISO8601 formatted timestamp that corresponds to the\n\ - beginning of the requested time frame, inclusive." - title: startTime - type: string - style: deepObject - - description: "The ISO8601 formatted timestamp that corresponds to the\nend\ - \ of the requested time frame, noninclusive.\nSegment recommends that you\ - \ lag queries 1 minute behind clock time to reduce\nthe risk for latency\ - \ to impact the counts.\n\nThis parameter exists in alpha." - explode: false - in: query - name: endTime - required: true - schema: - description: "The ISO8601 formatted timestamp that corresponds to the\n\ - end of the requested time frame, noninclusive.\nSegment recommends that\ - \ you lag queries 1 minute behind clock time to reduce\nthe risk for latency\ - \ to impact the counts." - title: endTime - type: string - style: deepObject - - description: "A comma-delimited list of strings that represents the dimensions\n\ - to group the result by. The options are:\n`eventName`, `eventType` and `source`.\n\ - \nThis parameter exists in alpha." - explode: false - in: query - name: groupBy - required: false - schema: - description: "A comma-delimited list of strings that represents the dimensions\n\ - to group the result by. The options are:\n`eventName`, `eventType` and\ - \ `source`." - items: - type: string - title: groupBy - type: array - style: deepObject - - description: |- - A list of strings which filters the results to the given - SourceIds. - - This parameter exists in alpha. - explode: false - in: query - name: sourceId - required: false - schema: - description: |- - A list of strings which filters the results to the given - SourceIds. - items: - type: string - title: sourceId - type: array - style: deepObject - - description: |- - A list of strings which filters the results to the given - EventNames. - - This parameter exists in alpha. - explode: false - in: query - name: eventName - required: false - schema: - description: |- - A list of strings which filters the results to the given - EventNames. - items: - type: string - title: eventName - type: array - style: deepObject - - description: |- - A list of strings which filters the results to the given - EventTypes. - - This parameter exists in alpha. - explode: false - in: query - name: eventType - required: false - schema: - description: |- - A list of strings which filters the results to the given - EventTypes. - items: - type: string - title: eventType - type: array - style: deepObject - - description: |- - A list of strings which filters the results to the given - AppVersions. - - This parameter exists in alpha. - explode: false - in: query - name: appVersion - required: false - schema: - description: |- - A list of strings which filters the results to the given - AppVersions. - items: - type: string - title: appVersion - type: array - style: deepObject - - description: |- - Pagination input for event volume by Workspace. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: false - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - result: - - eventType: track - total: 12533455 - series: - - time: 2021-10-28T00:00:00Z - count: 6221572 - - time: 2021-10-29T00:00:00Z - count: 6311883 - - eventType: identify - total: 178936 - series: - - time: 2021-10-28T00:00:00Z - count: 87914 - - time: 2021-10-29T00:00:00Z - count: 91022 - - eventType: group - total: 178936 - series: - - time: 2021-10-28T00:00:00Z - count: 87914 - - time: 2021-10-29T00:00:00Z - count: 91022 - - eventType: page - total: 46080 - series: - - time: 2021-10-28T00:00:00Z - count: 23040 - - time: 2021-10-29T00:00:00Z - count: 23040 - - eventType: screen - total: 46079 - series: - - time: 2021-10-28T00:00:00Z - count: 23039 - - time: 2021-10-29T00:00:00Z - count: 23040 - schema: - $ref: '#/components/schemas/getEventsVolumeFromWorkspace_200_response' - application/vnd.segment.v1beta+json: - example: - data: - result: - - eventType: track - total: 12533455 - series: - - time: 2021-10-28T00:00:00Z - count: 6221572 - - time: 2021-10-29T00:00:00Z - count: 6311883 - - eventType: identify - total: 178936 - series: - - time: 2021-10-28T00:00:00Z - count: 87914 - - time: 2021-10-29T00:00:00Z - count: 91022 - - eventType: group - total: 178936 - series: - - time: 2021-10-28T00:00:00Z - count: 87914 - - time: 2021-10-29T00:00:00Z - count: 91022 - - eventType: page - total: 46080 - series: - - time: 2021-10-28T00:00:00Z - count: 23040 - - time: 2021-10-29T00:00:00Z - count: 23040 - - eventType: screen - total: 46079 - series: - - time: 2021-10-28T00:00:00Z - count: 23039 - - time: 2021-10-29T00:00:00Z - count: 23040 - schema: - $ref: '#/components/schemas/getEventsVolumeFromWorkspace_200_response' - application/vnd.segment.v1+json: - example: - data: - result: - - eventType: track - total: 12533455 - series: - - time: 2021-10-28T00:00:00Z - count: 6221572 - - time: 2021-10-29T00:00:00Z - count: 6311883 - - eventType: identify - total: 178936 - series: - - time: 2021-10-28T00:00:00Z - count: 87914 - - time: 2021-10-29T00:00:00Z - count: 91022 - - eventType: group - total: 178936 - series: - - time: 2021-10-28T00:00:00Z - count: 87914 - - time: 2021-10-29T00:00:00Z - count: 91022 - - eventType: page - total: 46080 - series: - - time: 2021-10-28T00:00:00Z - count: 23040 - - time: 2021-10-29T00:00:00Z - count: 23040 - - eventType: screen - total: 46079 - series: - - time: 2021-10-28T00:00:00Z - count: 23039 - - time: 2021-10-29T00:00:00Z - count: 23040 - schema: - $ref: '#/components/schemas/getEventsVolumeFromWorkspace_200_response' - application/json: - example: - data: - result: - - eventType: track - total: 12533455 - series: - - time: 2021-10-28T00:00:00Z - count: 6221572 - - time: 2021-10-29T00:00:00Z - count: 6311883 - - eventType: identify - total: 178936 - series: - - time: 2021-10-28T00:00:00Z - count: 87914 - - time: 2021-10-29T00:00:00Z - count: 91022 - - eventType: group - total: 178936 - series: - - time: 2021-10-28T00:00:00Z - count: 87914 - - time: 2021-10-29T00:00:00Z - count: 91022 - - eventType: page - total: 46080 - series: - - time: 2021-10-28T00:00:00Z - count: 23040 - - time: 2021-10-29T00:00:00Z - count: 23040 - - eventType: screen - total: 46079 - series: - - time: 2021-10-28T00:00:00Z - count: 23039 - - time: 2021-10-29T00:00:00Z - count: 23040 - schema: - $ref: '#/components/schemas/getEventsVolumeFromWorkspace_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Events Volume from Workspace - tags: - - Events - x-domain-hierarchy: - - Monitoring - - Events - x-accepts: application/json - /destination/{destinationId}/filters/{filterId}: - delete: - deprecated: false - description: "Deletes a Destination filter.\n\n\n\nWhen called, this endpoint\ - \ may generate the `Destination Filter Deleted` [Audit Trail](/tag/Audit-Trail)\ - \ event.\n " - operationId: removeFilterFromDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - explode: false - in: path - name: filterId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeFilterFromDestination_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeFilterFromDestination_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeFilterFromDestination_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeFilterFromDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Remove Filter from Destination - tags: - - Destination Filters - x-domain-hierarchy: - - Connections - - Destination Filters - x-accepts: application/json - get: - deprecated: false - description: Gets a Destination filter by id. - operationId: getFilterInDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - explode: false - in: path - name: filterId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - filter: - id: xx6AySGeFExzdv2Gw2EuhV - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: event = "Order Completed" - actions: - - type: DROP_PROPERTIES - fields: - properties: - - userId - - secretValue - title: Order Completed - description: This filter probably does nothing - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/getFilterInDestination_200_response' - application/vnd.segment.v1beta+json: - example: - data: - filter: - id: xx6AySGeFExzdv2Gw2EuhV - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/getFilterInDestination_200_response' - application/vnd.segment.v1+json: - example: - data: - filter: - id: xx6AySGeFExzdv2Gw2EuhV - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/getFilterInDestination_200_response' - application/json: - example: - data: - filter: - id: xx6AySGeFExzdv2Gw2EuhV - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/getFilterInDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Filter in Destination - tags: - - Destination Filters - x-domain-hierarchy: - - Connections - - Destination Filters - x-accepts: application/json - patch: - deprecated: false - description: "Updates a filter in a Destination.\n\nWhen called, this endpoint\ - \ may generate one or more of the following [Audit Trail](/tag/Audit-Trail)\ - \ events:\n* Destination Filter Enabled\n* Destination Filter Disabled\n \ - \ " - operationId: updateFilterForDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - explode: false - in: path - name: filterId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - filterId: xx6AySGeFExzdv2Gw2EuhV - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - schema: - $ref: '#/components/schemas/UpdateFilterForDestinationV1Input' - application/vnd.segment.v1beta+json: - example: - filterId: xx6AySGeFExzdv2Gw2EuhV - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - schema: - $ref: '#/components/schemas/UpdateFilterForDestinationV1Input' - application/vnd.segment.v1+json: - example: - filterId: xx6AySGeFExzdv2Gw2EuhV - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - schema: - $ref: '#/components/schemas/UpdateFilterForDestinationV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - filter: - id: xx6AySGeFExzdv2Gw2EuhV - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/updateFilterForDestination_200_response' - application/vnd.segment.v1beta+json: - example: - data: - filter: - id: xx6AySGeFExzdv2Gw2EuhV - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/updateFilterForDestination_200_response' - application/vnd.segment.v1+json: - example: - data: - filter: - id: xx6AySGeFExzdv2Gw2EuhV - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/updateFilterForDestination_200_response' - application/json: - example: - data: - filter: - id: xx6AySGeFExzdv2Gw2EuhV - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationId: fP7qoQw2HTWt9WdMr718gn - if: '!(type = "track")' - actions: - - type: DROP - title: Allow Track - description: Allows track calls through to the destination. - enabled: true - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - schema: - $ref: '#/components/schemas/updateFilterForDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Update Filter for Destination - tags: - - Destination Filters - x-domain-hierarchy: - - Connections - - Destination Filters - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /sources/{sourceId}/edge-functions/latest: - get: - deprecated: false - description: "Get the latest Edge Functions for your Source.\n\n**Note**: In\ - \ order to successfully call this endpoint, the specified Workspace needs\ - \ to have the Edge Functions feature enabled. Please reach out to your customer\ - \ success manager for more information.\n " - operationId: getLatestFromEdgeFunctions - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - edgeFunctions: - id: 3b48bd4c-7c2c-4dec-813f-905718290a4c - sourceId: qQEHquLrjRDN9j1ByrChyn - downloadURL: https://cdn.edgefn.segment.build/qQEHquLrjRDN9j1ByrChyn/3b48bd4c-7c2c-4dec-813f-905718290a4c.js - createdBy: sgJDWk3K21k6LE3tLU9nRK - createdAt: 2006-01-02T15:04:05.000Z - version: 1 - schema: - $ref: '#/components/schemas/getLatestFromEdgeFunctions_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Latest from Edge Functions - tags: - - Edge Functions - x-domain-hierarchy: - - Connections - - Edge Functions - x-accepts: application/json - /catalog/sources/{sourceMetadataId}: - get: - deprecated: false - description: Returns a Source catalog item by its id. - operationId: getSourceMetadata - parameters: - - explode: false - in: path - name: sourceMetadataId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - sourceMetadata: - id: 1bow82lmk - slug: stripe - name: Stripe - categories: - - Payments - description: "Once you have successfully OAuth’d into Stripe,\ - \ we will begin syncing Stripe objects (and their corresponding\ - \ properties) to any databases you have turned on (to turn on\ - \ a database, navigate to the database tab in the navigation\ - \ pane on the left)." - logos: - default: https://cdn.filepicker.io/api/file/jp2UV0RtRU2FZaGxX4qF - alt: https://cdn.filepicker.io/api/file/7BXASJF8ReVG9pfQCX9Z - mark: https://cdn.filepicker.io/api/file/oVSkzKHQ96hIQkbK18ib - options: [] - isCloudEventSource: false - schema: - $ref: '#/components/schemas/getSourceMetadata_200_response' - application/vnd.segment.v1beta+json: - example: - data: - sourceMetadata: - id: 1bow82lmk - slug: stripe - name: Stripe - categories: - - Payments - description: "Once you have successfully OAuth’d into Stripe,\ - \ we will begin syncing Stripe objects (and their corresponding\ - \ properties) to any databases you have turned on (to turn on\ - \ a database, navigate to the database tab in the navigation\ - \ pane on the left)." - logos: - default: https://cdn.filepicker.io/api/file/jp2UV0RtRU2FZaGxX4qF - alt: https://cdn.filepicker.io/api/file/7BXASJF8ReVG9pfQCX9Z - mark: https://cdn.filepicker.io/api/file/oVSkzKHQ96hIQkbK18ib - options: [] - isCloudEventSource: false - schema: - $ref: '#/components/schemas/getSourceMetadata_200_response' - application/vnd.segment.v1+json: - example: - data: - sourceMetadata: - id: 1bow82lmk - slug: stripe - name: Stripe - categories: - - Payments - description: "Once you have successfully OAuth’d into Stripe,\ - \ we will begin syncing Stripe objects (and their corresponding\ - \ properties) to any databases you have turned on (to turn on\ - \ a database, navigate to the database tab in the navigation\ - \ pane on the left)." - logos: - default: https://cdn.filepicker.io/api/file/jp2UV0RtRU2FZaGxX4qF - alt: https://cdn.filepicker.io/api/file/7BXASJF8ReVG9pfQCX9Z - mark: https://cdn.filepicker.io/api/file/oVSkzKHQ96hIQkbK18ib - options: [] - isCloudEventSource: false - schema: - $ref: '#/components/schemas/getSourceMetadata_200_response' - application/json: - example: - data: - sourceMetadata: - id: 1bow82lmk - slug: stripe - name: Stripe - categories: - - Payments - description: "Once you have successfully OAuth’d into Stripe,\ - \ we will begin syncing Stripe objects (and their corresponding\ - \ properties) to any databases you have turned on (to turn on\ - \ a database, navigate to the database tab in the navigation\ - \ pane on the left)." - logos: - default: https://cdn.filepicker.io/api/file/jp2UV0RtRU2FZaGxX4qF - alt: https://cdn.filepicker.io/api/file/7BXASJF8ReVG9pfQCX9Z - mark: https://cdn.filepicker.io/api/file/oVSkzKHQ96hIQkbK18ib - options: [] - isCloudEventSource: false - schema: - $ref: '#/components/schemas/getSourceMetadata_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Source Metadata - tags: - - Catalog - x-domain-hierarchy: - - Connections - - Catalog - x-accepts: application/json - /catalog/sources: - get: - deprecated: false - description: Returns a list of all available Sources in the Segment catalog. - operationId: getSourcesCatalog - parameters: - - description: |- - Defines the pagination parameters. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - sourcesCatalog: - - id: 117eYCe9jH - slug: youbora - name: Youbora - categories: - - Analytics - description: "YOUBORA is a business intelligence and video analytics\ - \ solution for the online video industry to maximize revenue\ - \ through understanding user behavior using actionable data.\ - \ The platform delivers high quality and reliable insights based\ - \ on real-time data, in order for your business to ensure the\ - \ delivery of flawless video and a high quality of experiences\ - \ to your users." - logos: - default: https://cdn.filepicker.io/api/file/bzmEOg5CRO2RWAVFeHb5 - mark: https://cdn.filepicker.io/api/file/lIl1q5XSRriNiYAodvnC - options: [] - isCloudEventSource: true - - id: 1QTd6JKw53 - slug: regal-voice - name: Regal Voice - categories: - - Marketing Automation - - Personalization - - SMS & Push Notifications - description: Next-gen phone marketing and sales enablement for - innovative consumer and financial services brands - logos: - default: https://public-segment-devcenter-production.s3.amazonaws.com/a3189276-1b86-4126-a31c-d1a50057b7fe.svg - mark: https://public-segment-devcenter-production.s3.amazonaws.com/e20664bd-2398-440a-a6d6-59cd348b25e2.svg - options: - - name: api-key - required: true - type: string - defaultValue: "" - description: Regal Voice API key - isCloudEventSource: true - pagination: - current: MA== - next: Mg== - totalEntries: 81 - schema: - $ref: '#/components/schemas/getSourcesCatalog_200_response' - application/vnd.segment.v1beta+json: - example: - data: - sourcesCatalog: - - id: 117eYCe9jH - slug: youbora - name: Youbora - categories: - - Analytics - description: "YOUBORA is a business intelligence and video analytics\ - \ solution for the online video industry to maximize revenue\ - \ through understanding user behavior using actionable data.\ - \ The platform delivers high quality and reliable insights based\ - \ on real-time data, in order for your business to ensure the\ - \ delivery of flawless video and a high quality of experiences\ - \ to your users." - logos: - default: https://cdn.filepicker.io/api/file/bzmEOg5CRO2RWAVFeHb5 - mark: https://cdn.filepicker.io/api/file/lIl1q5XSRriNiYAodvnC - options: [] - isCloudEventSource: true - - id: 1QTd6JKw53 - slug: regal-voice - name: Regal Voice - categories: - - Marketing Automation - - Personalization - - SMS & Push Notifications - description: Next-gen phone marketing and sales enablement for - innovative consumer and financial services brands - logos: - default: https://public-segment-devcenter-production.s3.amazonaws.com/a3189276-1b86-4126-a31c-d1a50057b7fe.svg - mark: https://public-segment-devcenter-production.s3.amazonaws.com/e20664bd-2398-440a-a6d6-59cd348b25e2.svg - options: - - name: api-key - required: true - type: string - defaultValue: "" - description: Regal Voice API key - isCloudEventSource: true - pagination: - current: MA== - next: Mg== - totalEntries: 81 - schema: - $ref: '#/components/schemas/getSourcesCatalog_200_response' - application/vnd.segment.v1+json: - example: - data: - sourcesCatalog: - - id: 117eYCe9jH - slug: youbora - name: Youbora - categories: - - Analytics - description: "YOUBORA is a business intelligence and video analytics\ - \ solution for the online video industry to maximize revenue\ - \ through understanding user behavior using actionable data.\ - \ The platform delivers high quality and reliable insights based\ - \ on real-time data, in order for your business to ensure the\ - \ delivery of flawless video and a high quality of experiences\ - \ to your users." - logos: - default: https://cdn.filepicker.io/api/file/bzmEOg5CRO2RWAVFeHb5 - mark: https://cdn.filepicker.io/api/file/lIl1q5XSRriNiYAodvnC - options: [] - isCloudEventSource: true - - id: 1QTd6JKw53 - slug: regal-voice - name: Regal Voice - categories: - - Marketing Automation - - Personalization - - SMS & Push Notifications - description: Next-gen phone marketing and sales enablement for - innovative consumer and financial services brands - logos: - default: https://public-segment-devcenter-production.s3.amazonaws.com/a3189276-1b86-4126-a31c-d1a50057b7fe.svg - mark: https://public-segment-devcenter-production.s3.amazonaws.com/e20664bd-2398-440a-a6d6-59cd348b25e2.svg - options: - - name: api-key - required: true - type: string - defaultValue: "" - description: Regal Voice API key - isCloudEventSource: true - pagination: - current: MA== - next: Mg== - totalEntries: 81 - schema: - $ref: '#/components/schemas/getSourcesCatalog_200_response' - application/json: - example: - data: - sourcesCatalog: - - id: 117eYCe9jH - slug: youbora - name: Youbora - categories: - - Analytics - description: "YOUBORA is a business intelligence and video analytics\ - \ solution for the online video industry to maximize revenue\ - \ through understanding user behavior using actionable data.\ - \ The platform delivers high quality and reliable insights based\ - \ on real-time data, in order for your business to ensure the\ - \ delivery of flawless video and a high quality of experiences\ - \ to your users." - logos: - default: https://cdn.filepicker.io/api/file/bzmEOg5CRO2RWAVFeHb5 - mark: https://cdn.filepicker.io/api/file/lIl1q5XSRriNiYAodvnC - options: [] - isCloudEventSource: true - - id: 1QTd6JKw53 - slug: regal-voice - name: Regal Voice - categories: - - Marketing Automation - - Personalization - - SMS & Push Notifications - description: Next-gen phone marketing and sales enablement for - innovative consumer and financial services brands - logos: - default: https://public-segment-devcenter-production.s3.amazonaws.com/a3189276-1b86-4126-a31c-d1a50057b7fe.svg - mark: https://public-segment-devcenter-production.s3.amazonaws.com/e20664bd-2398-440a-a6d6-59cd348b25e2.svg - options: - - name: api-key - required: true - type: string - defaultValue: "" - description: Regal Voice API key - isCloudEventSource: true - pagination: - current: MA== - next: Mg== - totalEntries: 81 - schema: - $ref: '#/components/schemas/getSourcesCatalog_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Sources Catalog - tags: - - Catalog - x-domain-hierarchy: - - Connections - - Catalog - x-accepts: application/json - /spaces/{spaceId}: - get: - deprecated: false - description: Returns the Space by id. - operationId: getSpace - parameters: - - explode: false - in: path - name: spaceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - space: - id: 9aQ1Lj62S4bomZKLF4DPqW - name: Default Space Papi E2E - slug: default-space-papi-e2e - schema: - $ref: '#/components/schemas/getSpace_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Space - tags: - - Spaces - x-domain-hierarchy: - - Engage - - Spaces - x-accepts: application/json - /destinations/{destinationId}/subscriptions/{id}: - delete: - deprecated: false - description: Deletes an existing Destination subscription. - operationId: removeSubscriptionFromDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - explode: false - in: path - name: id - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeSubscriptionFromDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Remove Subscription from Destination - tags: - - Destinations - x-domain-hierarchy: - - Connections - - Destinations - x-accepts: application/json - get: - deprecated: false - description: Gets a Destination subscription by id. - operationId: getSubscriptionFromDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - explode: false - in: path - name: id - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - subscription: - id: bfSKRLi2V3eGQFuAaGuv2m - name: Example Subscription - actionId: jiMz7MfHNeHmUckzRnUGkU - actionSlug: someActionSlug - destinationId: fP7qoQw2HTWt9WdMr718gn - trigger: type = "track" - enabled: false - settings: {} - schema: - $ref: '#/components/schemas/getSubscriptionFromDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Subscription from Destination - tags: - - Destinations - x-domain-hierarchy: - - Connections - - Destinations - x-accepts: application/json - patch: - deprecated: false - description: Updates an existing Destination subscription. - operationId: updateSubscriptionForDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - explode: false - in: path - name: id - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - id: jur9cutEarKFw7fD65TCkq - destinationId: fP7qoQw2HTWt9WdMr718gn - input: - name: Updated name - schema: - $ref: '#/components/schemas/UpdateSubscriptionForDestinationAlphaInput' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - subscription: - id: jur9cutEarKFw7fD65TCkq - name: Updated name - actionId: jiMz7MfHNeHmUckzRnUGkU - actionSlug: someActionSlug - destinationId: fP7qoQw2HTWt9WdMr718gn - trigger: type = "track" - enabled: false - settings: {} - schema: - $ref: '#/components/schemas/updateSubscriptionForDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Update Subscription for Destination - tags: - - Destinations - x-domain-hierarchy: - - Connections - - Destinations - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /users/{userId}: - get: - deprecated: false - description: Returns a user given their id. - operationId: getUser - parameters: - - explode: false - in: path - name: userId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - user: - id: sgJDWk3K21k6LE3tLU9nRK - name: "" - email: papi@segment.com - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/getUser_200_response' - application/vnd.segment.v1beta+json: - example: - data: - user: - id: sgJDWk3K21k6LE3tLU9nRK - name: "" - email: papi@segment.com - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/getUser_200_response' - application/vnd.segment.v1+json: - example: - data: - user: - id: sgJDWk3K21k6LE3tLU9nRK - name: "" - email: papi@segment.com - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/getUser_200_response' - application/json: - example: - data: - user: - id: sgJDWk3K21k6LE3tLU9nRK - name: "" - email: papi@segment.com - permissions: - - roleId: 1WDUuRLxv84rrfCNUwvkrRtkxnS - roleName: Workspace Owner - resources: - - id: 9aQ1Lj62S4bomZKLF4DPqW - type: WORKSPACE - labels: [] - schema: - $ref: '#/components/schemas/getUser_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get User - tags: - - IAM Users - x-domain-hierarchy: - - Admin - - IAM Users - x-accepts: application/json - /catalog/warehouses/{warehouseMetadataId}: - get: - deprecated: false - description: Returns a Warehouse catalog item by its id. - operationId: getWarehouseMetadata - parameters: - - explode: false - in: path - name: warehouseMetadataId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - warehouseMetadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - schema: - $ref: '#/components/schemas/getWarehouseMetadata_200_response' - application/vnd.segment.v1beta+json: - example: - data: - warehouseMetadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - schema: - $ref: '#/components/schemas/getWarehouseMetadata_200_response' - application/vnd.segment.v1+json: - example: - data: - warehouseMetadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - schema: - $ref: '#/components/schemas/getWarehouseMetadata_200_response' - application/json: - example: - data: - warehouseMetadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - schema: - $ref: '#/components/schemas/getWarehouseMetadata_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Warehouse Metadata - tags: - - Catalog - x-domain-hierarchy: - - Connections - - Catalog - x-accepts: application/json - /catalog/warehouses: - get: - deprecated: false - description: Returns a list of all available Warehouses in the Segment catalog. - operationId: getWarehousesCatalog - parameters: - - description: |- - Required pagination params used to filter the Warehouses catalog. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - warehousesCatalog: - - id: VxcZnH5UIM - slug: azuresqldb - name: Azure SQL Database - description: Connector for Azure SQL Database - logos: - default: https://msftplayground.com/wp-content/uploads/2017/04/logoAzureSql.png - mark: "" - alt: "" - options: [] - - id: WcjBCzUGff - slug: azuresqldw - name: Azure SQL Data Warehouse - description: Connector for Azure SQL Data Warehouse - logos: - default: https://cdn.filepicker.io/api/file/VKbuWjNjQPKOnOWijFe4 - mark: https://cdn.filepicker.io/api/file/EUJvt69Q7qMqCvGrVtiu - alt: "" - options: [] - pagination: - current: MA== - next: Mg== - totalEntries: 7 - schema: - $ref: '#/components/schemas/getWarehousesCatalog_200_response' - application/vnd.segment.v1beta+json: - example: - data: - warehousesCatalog: - - id: VxcZnH5UIM - slug: azuresqldb - name: Azure SQL Database - description: Connector for Azure SQL Database - logos: - default: https://msftplayground.com/wp-content/uploads/2017/04/logoAzureSql.png - mark: "" - alt: "" - options: [] - - id: WcjBCzUGff - slug: azuresqldw - name: Azure SQL Data Warehouse - description: Connector for Azure SQL Data Warehouse - logos: - default: https://cdn.filepicker.io/api/file/VKbuWjNjQPKOnOWijFe4 - mark: https://cdn.filepicker.io/api/file/EUJvt69Q7qMqCvGrVtiu - alt: "" - options: [] - pagination: - current: MA== - next: Mg== - totalEntries: 7 - schema: - $ref: '#/components/schemas/getWarehousesCatalog_200_response' - application/vnd.segment.v1+json: - example: - data: - warehousesCatalog: - - id: VxcZnH5UIM - slug: azuresqldb - name: Azure SQL Database - description: Connector for Azure SQL Database - logos: - default: https://msftplayground.com/wp-content/uploads/2017/04/logoAzureSql.png - mark: "" - alt: "" - options: [] - - id: WcjBCzUGff - slug: azuresqldw - name: Azure SQL Data Warehouse - description: Connector for Azure SQL Data Warehouse - logos: - default: https://cdn.filepicker.io/api/file/VKbuWjNjQPKOnOWijFe4 - mark: https://cdn.filepicker.io/api/file/EUJvt69Q7qMqCvGrVtiu - alt: "" - options: [] - pagination: - current: MA== - next: Mg== - totalEntries: 7 - schema: - $ref: '#/components/schemas/getWarehousesCatalog_200_response' - application/json: - example: - data: - warehousesCatalog: - - id: VxcZnH5UIM - slug: azuresqldb - name: Azure SQL Database - description: Connector for Azure SQL Database - logos: - default: https://msftplayground.com/wp-content/uploads/2017/04/logoAzureSql.png - mark: "" - alt: "" - options: [] - - id: WcjBCzUGff - slug: azuresqldw - name: Azure SQL Data Warehouse - description: Connector for Azure SQL Data Warehouse - logos: - default: https://cdn.filepicker.io/api/file/VKbuWjNjQPKOnOWijFe4 - mark: https://cdn.filepicker.io/api/file/EUJvt69Q7qMqCvGrVtiu - alt: "" - options: [] - pagination: - current: MA== - next: Mg== - totalEntries: 7 - schema: - $ref: '#/components/schemas/getWarehousesCatalog_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Warehouses Catalog - tags: - - Catalog - x-domain-hierarchy: - - Connections - - Catalog - x-accepts: application/json - /: - get: - deprecated: false - description: Returns the Workspace associated with the token used to access - this resource. - operationId: getWorkspace - parameters: [] - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - workspace: - id: 9aQ1Lj62S4bomZKLF4DPqW - name: papi e2e - slug: papi-e2e - schema: - $ref: '#/components/schemas/getWorkspace_200_response' - application/vnd.segment.v1beta+json: - example: - data: - workspace: - id: 9aQ1Lj62S4bomZKLF4DPqW - name: papi e2e - slug: papi-e2e - schema: - $ref: '#/components/schemas/getWorkspace_200_response' - application/vnd.segment.v1+json: - example: - data: - workspace: - id: 9aQ1Lj62S4bomZKLF4DPqW - name: papi e2e - slug: papi-e2e - schema: - $ref: '#/components/schemas/getWorkspace_200_response' - application/json: - example: - data: - workspace: - id: 9aQ1Lj62S4bomZKLF4DPqW - name: papi e2e - slug: papi-e2e - schema: - $ref: '#/components/schemas/getWorkspace_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Get Workspace - tags: - - Workspaces - x-domain-hierarchy: - - General - - Workspaces - x-accepts: application/json - /audit-events: - get: - deprecated: false - description: Returns a list of Audit Trail events. - operationId: listAuditEvents - parameters: - - description: |- - Filter response to events that happened after this time. - - This parameter exists in alpha. - explode: false - in: query - name: startTime - required: false - schema: - description: Filter response to events that happened after this time. - title: startTime - type: string - style: deepObject - - description: "Filter response to events that happened before this time.\n\ - Defaults to the current time, or the end time from the pagination cursor.\n\ - \nThis parameter exists in alpha." - explode: false - in: query - name: endTime - required: false - schema: - description: "Filter response to events that happened before this time.\n\ - Defaults to the current time, or the end time from the pagination cursor." - title: endTime - type: string - style: deepObject - - description: "Filter response to events that affect a specific resource, for\ - \ example, a single Source.\n\nThis parameter exists in alpha." - explode: false - in: query - name: resourceId - required: false - schema: - description: "Filter response to events that affect a specific resource,\ - \ for example, a single Source." - title: resourceId - type: string - style: deepObject - - description: "Filter response to events that affect a specific type, for example,\ - \ Sources, Warehouses, and Tracking Plans.\n\nThis parameter exists in alpha." - explode: false - in: query - name: resourceType - required: false - schema: - description: "Filter response to events that affect a specific type, for\ - \ example, Sources, Warehouses, and Tracking Plans." - title: resourceType - type: string - style: deepObject - - description: |- - Defines the pagination parameters. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - events: - - id: events/145876976 - timestamp: 2022-03-04T21:29:22Z - type: Source Function Deleted - actor: public-api-token/TJ7z8cg6 - resourceId: 8AWE8yZRdy - resourceType: function - resourceName: Foo Func 543 - - id: events/145876978 - timestamp: 2022-03-04T21:29:22Z - type: Source Function Modified - actor: public-api-token/TJ7z8cg6 - resourceId: sfnc_tFXvS0Rs6T - resourceType: function - resourceName: displayName - pagination: - current: eyJwYWdlVG9rZW4iOiJNUT09IiwiZW5kVGltZSI6IjIwMjItMDgtMjVUMjA6MTM6MzEuMTM4WiJ9 - next: eyJwYWdlVG9rZW4iOiJNZz09IiwiZW5kVGltZSI6IjIwMjItMDgtMjVUMjA6MTM6MzEuMTM4WiJ9 - schema: - $ref: '#/components/schemas/listAuditEvents_200_response' - application/vnd.segment.v1beta+json: - example: - data: - events: - - id: events/145876976 - timestamp: 2022-03-04T21:29:22Z - type: Source Function Deleted - actor: public-api-token/TJ7z8cg6 - resourceId: 8AWE8yZRdy - resourceType: function - resourceName: Foo Func 543 - - id: events/145876978 - timestamp: 2022-03-04T21:29:22Z - type: Source Function Modified - actor: public-api-token/TJ7z8cg6 - resourceId: sfnc_tFXvS0Rs6T - resourceType: function - resourceName: displayName - pagination: - current: eyJwYWdlVG9rZW4iOiJNUT09IiwiZW5kVGltZSI6IjIwMjItMDgtMjVUMjA6MTM6MzEuNjQxWiJ9 - next: eyJwYWdlVG9rZW4iOiJNZz09IiwiZW5kVGltZSI6IjIwMjItMDgtMjVUMjA6MTM6MzEuNjQxWiJ9 - schema: - $ref: '#/components/schemas/listAuditEvents_200_response' - application/vnd.segment.v1+json: - example: - data: - events: - - id: events/145876976 - timestamp: 2022-03-04T21:29:22Z - type: Source Function Deleted - actor: public-api-token/TJ7z8cg6 - resourceId: 8AWE8yZRdy - resourceType: function - resourceName: Foo Func 543 - - id: events/145876978 - timestamp: 2022-03-04T21:29:22Z - type: Source Function Modified - actor: public-api-token/TJ7z8cg6 - resourceId: sfnc_tFXvS0Rs6T - resourceType: function - resourceName: displayName - pagination: - current: eyJwYWdlVG9rZW4iOiJNUT09IiwiZW5kVGltZSI6IjIwMjItMDgtMjVUMjA6MTM6MzIuMDE1WiJ9 - next: eyJwYWdlVG9rZW4iOiJNZz09IiwiZW5kVGltZSI6IjIwMjItMDgtMjVUMjA6MTM6MzIuMDE1WiJ9 - schema: - $ref: '#/components/schemas/listAuditEvents_200_response' - application/json: - example: - data: - events: - - id: events/145876976 - timestamp: 2022-03-04T21:29:22Z - type: Source Function Deleted - actor: public-api-token/TJ7z8cg6 - resourceId: 8AWE8yZRdy - resourceType: function - resourceName: Foo Func 543 - - id: events/145876978 - timestamp: 2022-03-04T21:29:22Z - type: Source Function Modified - actor: public-api-token/TJ7z8cg6 - resourceId: sfnc_tFXvS0Rs6T - resourceType: function - resourceName: displayName - pagination: - current: eyJwYWdlVG9rZW4iOiJNUT09IiwiZW5kVGltZSI6IjIwMjItMDgtMjVUMjA6MTM6MzIuMDE1WiJ9 - next: eyJwYWdlVG9rZW4iOiJNZz09IiwiZW5kVGltZSI6IjIwMjItMDgtMjVUMjA6MTM6MzIuMDE1WiJ9 - schema: - $ref: '#/components/schemas/listAuditEvents_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Audit Events - tags: - - Audit Trail - x-domain-hierarchy: - - Admin - - Audit Trail - x-accepts: application/json - /sources/{sourceId}/connected-destinations: - get: - deprecated: false - description: Returns a list of Destinations connected to a Source. - operationId: listConnectedDestinationsFromSource - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Required pagination params for the request. - - This parameter exists in beta. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - destinations: [] - pagination: - current: MQ== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listConnectedDestinationsFromSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - destinations: [] - pagination: - current: MQ== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listConnectedDestinationsFromSource_200_response_1' - application/vnd.segment.v1+json: - example: - data: - destinations: [] - pagination: - current: MQ== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listConnectedDestinationsFromSource_200_response_1' - application/json: - example: - data: - destinations: [] - pagination: - current: MQ== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listConnectedDestinationsFromSource_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Connected Destinations from Source - tags: - - Sources - x-domain-hierarchy: - - Connections - - Sources - x-accepts: application/json - /warehouses/{warehouseId}/connected-sources: - get: - deprecated: false - description: Returns the list of Sources that are connected to a Warehouse. - operationId: listConnectedSourcesFromWarehouse - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Defines the pagination parameters. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - sources: - - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - pagination: - current: MA== - next: MQ== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listConnectedSourcesFromWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - sources: - - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listConnectedSourcesFromWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - sources: - - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listConnectedSourcesFromWarehouse_200_response' - application/json: - example: - data: - sources: - - id: qQEHquLrjRDN9j1ByrChyn - slug: ios - name: "" - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - writeKeys: - - 3YdEudTwjouyC5WPjpbTik - metadata: - id: UBrsG9RVzw - slug: ios - name: iOS - categories: - - Mobile - description: "" - logos: - default: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - alt: https://cdn.filepicker.io/api/file/qWgSP5cpS7eeW2voq13u - options: [] - isCloudEventSource: false - settings: {} - labels: [] - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listConnectedSourcesFromWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Connected Sources from Warehouse - tags: - - Warehouses - x-domain-hierarchy: - - Connections - - Warehouses - x-accepts: application/json - /sources/{sourceId}/connected-warehouses: - get: - deprecated: false - description: Returns a list of Warehouses connected to a Source. - operationId: listConnectedWarehousesFromSource - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Required pagination params for the request. - - This parameter exists in beta. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - warehouses: - - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - - id: v1e6FCE8P9EvQmCLWpKtJ3 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: aea3c55dsz - slug: redshift - name: Redshift - description: Powered by Amazon Web Services - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/redshift-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listConnectedWarehousesFromSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - warehouses: - - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - - id: v1e6FCE8P9EvQmCLWpKtJ3 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: aea3c55dsz - slug: redshift - name: Redshift - description: Powered by Amazon Web Services - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/redshift-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listConnectedWarehousesFromSource_200_response_1' - application/vnd.segment.v1+json: - example: - data: - warehouses: - - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - - id: v1e6FCE8P9EvQmCLWpKtJ3 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: aea3c55dsz - slug: redshift - name: Redshift - description: Powered by Amazon Web Services - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/redshift-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listConnectedWarehousesFromSource_200_response_1' - application/json: - example: - data: - warehouses: - - id: kjU72LCJexvrqL7G4TMHHN - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: 55d3d3aea3c - slug: postgres - name: Postgres - description: Open source data warehouse - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/postgres-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - - id: v1e6FCE8P9EvQmCLWpKtJ3 - workspaceId: 9aQ1Lj62S4bomZKLF4DPqW - enabled: true - metadata: - id: aea3c55dsz - slug: redshift - name: Redshift - description: Powered by Amazon Web Services - logos: - default: https://d3hotuclm6if1r.cloudfront.net/logos/redshift-default.svg - mark: "" - alt: "" - options: - - name: port - required: true - type: string - - name: database - required: true - type: string - - name: hostname - required: true - type: string - - name: password - required: true - type: string - - name: username - required: true - type: string - - name: ciphertext - required: true - type: string - settings: {} - pagination: - current: MA== - totalEntries: 2 - schema: - $ref: '#/components/schemas/listConnectedWarehousesFromSource_200_response_1' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Connected Warehouses from Source - tags: - - Sources - x-domain-hierarchy: - - Connections - - Sources - x-accepts: application/json - /destinations/{destinationId}/delivery-metrics: - get: - deprecated: false - description: "Get event delivery metrics summary from a Destination.\n \ - \ \n Based on the granularity, there are restrictions on the time range you\ - \ can query:\n\n\n\n **Minute Granularity**:\n\n - Max time range: 4 hours\n\ - \n - Oldest possible start time: 48 hours in the past\n\n\n\n **Hour Granularity**:\n\ - \n - Max Time range: 1 week\n\n - Oldest possible start time: 10 days in\ - \ the past\n\n\n\n **Day Granularity**:\n\n - Max time range: 60 days\n\n\ - \ - Oldest possible start time: 60 days in the past\n \n " - operationId: listDeliveryMetricsSummaryFromDestination - parameters: - - explode: false - in: path - name: destinationId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: "The id of the Source linked to the Destination.\n\nConfig API\ - \ note: analogous to `parent`.\n\nThis parameter exists in alpha." - explode: false - in: query - name: sourceId - required: true - schema: - description: "The id of the Source linked to the Destination.\n\nConfig\ - \ API note: analogous to `parent`." - title: sourceId - type: string - style: deepObject - - description: |- - Filter events that happened after this time. - - Defaults to: - - 1 hour ago if granularity is `MINUTE`. - - 7 days ago if granularity is `HOUR`. - - 30 days ago if granularity is `DAY`. - - This parameter exists in alpha. - explode: false - in: query - name: startTime - required: false - schema: - description: |- - Filter events that happened after this time. - - Defaults to: - - 1 hour ago if granularity is `MINUTE`. - - 7 days ago if granularity is `HOUR`. - - 30 days ago if granularity is `DAY`. - title: startTime - type: string - style: deepObject - - description: |- - Filter events that happened before this time. Defaults to now if not set. - - This parameter exists in alpha. - explode: false - in: query - name: endTime - required: false - schema: - description: Filter events that happened before this time. Defaults to now - if not set. - title: endTime - type: string - style: deepObject - - description: "The granularity to filter metrics to. Either `MINUTE`, `HOUR`\ - \ or `DAY`.\n\nDefaults to `MINUTE` if not set.\n\nThis parameter exists\ - \ in alpha." - explode: false - in: query - name: granularity - required: false - schema: - description: "The granularity to filter metrics to. Either `MINUTE`, `HOUR`\ - \ or `DAY`.\n\nDefaults to `MINUTE` if not set." - enum: - - DAY - - HOUR - - MINUTE - title: granularity - type: string - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - deliveryMetricsSummary: - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationMetadataId: 54521fd725e721e32a72eebb - metrics: - - metricName: successes - total: 120 - breakdown: - - metricName: successes_on_first_attempt - value: 60 - - metricName: successes_after_retry - value: 60 - - metricName: expired - total: 0 - - metricName: discarded - total: 0 - - metricName: retried - total: 0 - - metricName: time_to_success - total: 10 - breakdown: - - metricName: time_to_success_average - value: 0 - - metricName: time_to_success_p95 - value: 0 - - metricName: time_to_first_attempt - total: 10 - breakdown: - - metricName: time_to_first_attempt_average - value: 0 - - metricName: time_to_first_attempt_p95 - value: 0 - schema: - $ref: '#/components/schemas/listDeliveryMetricsSummaryFromDestination_200_response' - application/vnd.segment.v1beta+json: - example: - data: - deliveryMetricsSummary: - sourceId: rh5BDZp6QDHvXFCkibm1pR - destinationMetadataId: 54521fd725e721e32a72eebb - metrics: - - metricName: successes - total: 120 - breakdown: - - metricName: successes_on_first_attempt - value: 60 - - metricName: successes_after_retry - value: 60 - - metricName: expired - total: 0 - - metricName: discarded - total: 0 - - metricName: retried - total: 0 - - metricName: time_to_success - total: 10 - breakdown: - - metricName: time_to_success_average - value: 0 - - metricName: time_to_success_p95 - value: 0 - - metricName: time_to_first_attempt - total: 10 - breakdown: - - metricName: time_to_first_attempt_average - value: 0 - - metricName: time_to_first_attempt_p95 - value: 0 - schema: - $ref: '#/components/schemas/listDeliveryMetricsSummaryFromDestination_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Delivery Metrics Summary from Destination - tags: - - Destinations - x-domain-hierarchy: - - Connections - - Destinations - x-accepts: application/json - /groups/{userGroupId}/invites: - get: - deprecated: false - description: Returns the emails of invitees to a user group. - operationId: listInvitesFromUserGroup - parameters: - - explode: false - in: path - name: userGroupId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Pagination for invites to the group. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - emails: [] - pagination: - current: MA== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listInvitesFromUserGroup_200_response' - application/vnd.segment.v1beta+json: - example: - data: - emails: [] - pagination: - current: MA== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listInvitesFromUserGroup_200_response' - application/vnd.segment.v1+json: - example: - data: - emails: [] - pagination: - current: MA== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listInvitesFromUserGroup_200_response' - application/json: - example: - data: - emails: [] - pagination: - current: MA== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listInvitesFromUserGroup_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Invites from User Group - tags: - - IAM Groups - x-domain-hierarchy: - - Admin - - IAM Groups - x-accepts: application/json - /roles: - get: - deprecated: false - description: Returns a list of Roles available to apply to permissions for users - and/or groups. - operationId: listRoles - parameters: - - description: |- - Pagination for roles. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - roles: - - id: 1WDUuRLxv84rrfCNUwvkrRtkxnS - name: Workspace Owner - description: "Owners have full read and edit access to everything\ - \ in the workspace, including Sources, Destinations, add-on\ - \ products, and settings. Owners have full edit access to all\ - \ Team Permissions." - - id: 1aEWAcU0fArxScocwH9xxLgW7r3 - name: Minimal Workspace Access - description: Access to view the workspace. Cannot view any sub - resources or make changes to the workspace. - pagination: - current: MA== - next: Mg== - schema: - $ref: '#/components/schemas/listRoles_200_response' - application/vnd.segment.v1beta+json: - example: - data: - roles: - - id: 1WDUuRLxv84rrfCNUwvkrRtkxnS - name: Workspace Owner - description: "Owners have full read and edit access to everything\ - \ in the workspace, including Sources, Destinations, add-on\ - \ products, and settings. Owners have full edit access to all\ - \ Team Permissions." - - id: 1aEWAcU0fArxScocwH9xxLgW7r3 - name: Minimal Workspace Access - description: Access to view the workspace. Cannot view any sub - resources or make changes to the workspace. - pagination: - current: MA== - next: Mg== - schema: - $ref: '#/components/schemas/listRoles_200_response' - application/vnd.segment.v1+json: - example: - data: - roles: - - id: 1WDUuRLxv84rrfCNUwvkrRtkxnS - name: Workspace Owner - description: "Owners have full read and edit access to everything\ - \ in the workspace, including Sources, Destinations, add-on\ - \ products, and settings. Owners have full edit access to all\ - \ Team Permissions." - - id: 1aEWAcU0fArxScocwH9xxLgW7r3 - name: Minimal Workspace Access - description: Access to view the workspace. Cannot view any sub - resources or make changes to the workspace. - pagination: - current: MA== - next: Mg== - schema: - $ref: '#/components/schemas/listRoles_200_response' - application/json: - example: - data: - roles: - - id: 1WDUuRLxv84rrfCNUwvkrRtkxnS - name: Workspace Owner - description: "Owners have full read and edit access to everything\ - \ in the workspace, including Sources, Destinations, add-on\ - \ products, and settings. Owners have full edit access to all\ - \ Team Permissions." - - id: 1aEWAcU0fArxScocwH9xxLgW7r3 - name: Minimal Workspace Access - description: Access to view the workspace. Cannot view any sub - resources or make changes to the workspace. - pagination: - current: MA== - next: Mg== - schema: - $ref: '#/components/schemas/listRoles_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Roles - tags: - - IAM Roles - x-domain-hierarchy: - - Admin - - IAM Roles - x-accepts: application/json - /tracking-plans/{trackingPlanId}/rules: - delete: - deprecated: false - description: "Deletes Tracking Plan rules.\n\n**Note**: In order to successfully\ - \ call this endpoint, the specified Workspace needs to have the Protocols\ - \ feature enabled. Please reach out to your customer success manager for more\ - \ information." - operationId: removeRulesFromTrackingPlan - parameters: - - explode: false - in: path - name: trackingPlanId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Rules to delete. - - This parameter exists in alpha. - explode: false - in: query - name: rules - required: true - schema: - description: Rules to delete. - items: - $ref: '#/components/schemas/RemoveRuleV1' - title: rules - type: array - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeRulesFromTrackingPlan_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeRulesFromTrackingPlan_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeRulesFromTrackingPlan_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeRulesFromTrackingPlan_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Remove Rules from Tracking Plan - tags: - - Tracking Plans - x-domain-hierarchy: - - Protocols - - Tracking Plans - x-accepts: application/json - get: - deprecated: false - description: "Lists Tracking Plan rules.\n\n**Note**: In order to successfully\ - \ call this endpoint, the specified Workspace needs to have the Protocols\ - \ feature enabled. Please reach out to your customer success manager for more\ - \ information.\n\n\nThe rate limit for this endpoint is 20 requests per minute,\ - \ which is lower than the default due to access pattern restrictions. Once\ - \ reached, this endpoint will respond with the 429 HTTP status code with headers\ - \ indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits)\ - \ for more information." - operationId: listRulesFromTrackingPlan - parameters: - - explode: false - in: path - name: trackingPlanId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Pagination options. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - rules: - - key: New Tracking Plan Rule - type: TRACK - version: 1 - jsonSchema: - $schema: http://json-schema.org/draft-07/schema# - type: object - properties: - context: - type: object - traits: - type: object - properties: - type: object - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - deprecatedAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - schema: - $ref: '#/components/schemas/listRulesFromTrackingPlan_200_response' - application/vnd.segment.v1beta+json: - example: - data: - rules: - - key: New Tracking Plan Rule - type: TRACK - version: 1 - jsonSchema: - $schema: http://json-schema.org/draft-07/schema# - type: object - properties: - context: - type: object - traits: - type: object - properties: - type: object - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - deprecatedAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - schema: - $ref: '#/components/schemas/listRulesFromTrackingPlan_200_response' - application/vnd.segment.v1+json: - example: - data: - rules: - - key: New Tracking Plan Rule - type: TRACK - version: 1 - jsonSchema: - $schema: http://json-schema.org/draft-07/schema# - type: object - properties: - context: - type: object - traits: - type: object - properties: - type: object - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - deprecatedAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - schema: - $ref: '#/components/schemas/listRulesFromTrackingPlan_200_response' - application/json: - example: - data: - rules: - - key: New Tracking Plan Rule - type: TRACK - version: 1 - jsonSchema: - $schema: http://json-schema.org/draft-07/schema# - type: object - properties: - context: - type: object - traits: - type: object - properties: - type: object - createdAt: 2006-01-02T15:04:05.000Z - updatedAt: 2006-01-02T15:04:05.000Z - deprecatedAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - schema: - $ref: '#/components/schemas/listRulesFromTrackingPlan_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Rules from Tracking Plan - tags: - - Tracking Plans - x-domain-hierarchy: - - Protocols - - Tracking Plans - x-accepts: application/json - patch: - deprecated: false - description: "Updates Tracking Plan rules.\n\n**Note**: In order to successfully\ - \ call this endpoint, the specified Workspace needs to have the Protocols\ - \ feature enabled. Please reach out to your customer success manager for more\ - \ information." - operationId: updateRulesInTrackingPlan - parameters: - - explode: false - in: path - name: trackingPlanId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - trackingPlanId: tp_sprout_rVGCC6WdrNxjCf6JpCHP - rules: - - key: New Rule - type: TRACK - version: 1 - jsonSchema: {} - schema: - $ref: '#/components/schemas/UpdateRulesInTrackingPlanV1Input' - application/vnd.segment.v1beta+json: - example: - trackingPlanId: tp_sprout_rVGCC6WdrNxjCf6JpCHP - rules: - - key: New Rule - type: TRACK - version: 1 - jsonSchema: {} - schema: - $ref: '#/components/schemas/UpdateRulesInTrackingPlanV1Input' - application/vnd.segment.v1+json: - example: - trackingPlanId: tp_sprout_rVGCC6WdrNxjCf6JpCHP - rules: - - key: New Rule - type: TRACK - version: 1 - jsonSchema: {} - schema: - $ref: '#/components/schemas/UpdateRulesInTrackingPlanV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/updateRulesInTrackingPlan_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/updateRulesInTrackingPlan_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/updateRulesInTrackingPlan_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/updateRulesInTrackingPlan_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Update Rules in Tracking Plan - tags: - - Tracking Plans - x-domain-hierarchy: - - Protocols - - Tracking Plans - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - put: - deprecated: false - description: "Replaces Tracking Plan rules.\n\n**Note**: In order to successfully\ - \ call this endpoint, the specified Workspace needs to have the Protocols\ - \ feature enabled. Please reach out to your customer success manager for more\ - \ information." - operationId: replaceRulesInTrackingPlan - parameters: - - explode: false - in: path - name: trackingPlanId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - trackingPlanId: tp_sprout_rVGCC6WdrNxjCf6JpCHP - rules: - - key: New Replaced Rule - type: TRACK - version: 1 - jsonSchema: {} - schema: - $ref: '#/components/schemas/ReplaceRulesInTrackingPlanV1Input' - application/vnd.segment.v1beta+json: - example: - trackingPlanId: tp_sprout_rVGCC6WdrNxjCf6JpCHP - rules: - - key: New Replaced Rule - type: TRACK - version: 1 - jsonSchema: {} - schema: - $ref: '#/components/schemas/ReplaceRulesInTrackingPlanV1Input' - application/vnd.segment.v1+json: - example: - trackingPlanId: tp_sprout_rVGCC6WdrNxjCf6JpCHP - rules: - - key: New Replaced Rule - type: TRACK - version: 1 - jsonSchema: {} - schema: - $ref: '#/components/schemas/ReplaceRulesInTrackingPlanV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/replaceRulesInTrackingPlan_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/replaceRulesInTrackingPlan_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/replaceRulesInTrackingPlan_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/replaceRulesInTrackingPlan_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Replace Rules in Tracking Plan - tags: - - Tracking Plans - x-domain-hierarchy: - - Protocols - - Tracking Plans - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /sources/{sourceId}/settings: - get: - deprecated: false - description: "Retrieves the schema configuration settings for a Source. If Protocols\ - \ is not enabled for the Source, the configurations specific to Protocols\ - \ will have default values." - operationId: listSchemaSettingsInSource - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - sourceId: qQEHquLrjRDN9j1ByrChyn - settings: - track: - allowUnplannedEvents: true - allowUnplannedEventProperties: true - allowEventOnViolations: false - allowPropertiesOnViolations: true - commonEventOnViolations: ALLOW - group: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: ALLOW - identify: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: ALLOW - forwardingBlockedEventsTo: "" - forwardingViolationsTo: "" - schema: - $ref: '#/components/schemas/listSchemaSettingsInSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - sourceId: qQEHquLrjRDN9j1ByrChyn - settings: - track: - allowUnplannedEvents: true - allowUnplannedEventProperties: true - allowEventOnViolations: false - allowPropertiesOnViolations: true - commonEventOnViolations: ALLOW - group: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: ALLOW - identify: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: ALLOW - forwardingBlockedEventsTo: "" - forwardingViolationsTo: "" - schema: - $ref: '#/components/schemas/listSchemaSettingsInSource_200_response' - application/vnd.segment.v1+json: - example: - data: - sourceId: qQEHquLrjRDN9j1ByrChyn - settings: - track: - allowUnplannedEvents: true - allowUnplannedEventProperties: true - allowEventOnViolations: false - allowPropertiesOnViolations: true - commonEventOnViolations: ALLOW - group: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: ALLOW - identify: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: ALLOW - forwardingBlockedEventsTo: "" - forwardingViolationsTo: "" - schema: - $ref: '#/components/schemas/listSchemaSettingsInSource_200_response' - application/json: - example: - data: - sourceId: qQEHquLrjRDN9j1ByrChyn - settings: - track: - allowUnplannedEvents: true - allowUnplannedEventProperties: true - allowEventOnViolations: false - allowPropertiesOnViolations: true - commonEventOnViolations: ALLOW - group: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: ALLOW - identify: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: ALLOW - forwardingBlockedEventsTo: "" - forwardingViolationsTo: "" - schema: - $ref: '#/components/schemas/listSchemaSettingsInSource_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Schema Settings in Source - tags: - - Sources - x-domain-hierarchy: - - Connections - - Sources - x-accepts: application/json - patch: - deprecated: false - description: "Updates the schema configuration for a Source. If Protocols is\ - \ not enabled for the Source, any updates to Protocols-specific configurations\ - \ will not be applied.\n\n Config API omitted fields:\n- `updateMask`\n\ - \ " - operationId: updateSchemaSettingsInSource - parameters: - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - sourceId: qQEHquLrjRDN9j1ByrChyn - group: - allowTraitsOnViolations: false - allowUnplannedTraits: false - commonEventOnViolations: ALLOW - identify: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: BLOCK - track: - allowEventOnViolations: false - allowPropertiesOnViolations: false - allowUnplannedEventProperties: false - allowUnplannedEvents: false - commonEventOnViolations: OMIT_PROPERTIES - forwardingViolationsTo: rh5BDZp6QDHvXFCkibm1pR - forwardingBlockedEventsTo: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/UpdateSchemaSettingsInSourceV1Input' - application/vnd.segment.v1beta+json: - example: - sourceId: qQEHquLrjRDN9j1ByrChyn - group: - allowTraitsOnViolations: false - allowUnplannedTraits: false - commonEventOnViolations: ALLOW - identify: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: BLOCK - track: - allowEventOnViolations: false - allowPropertiesOnViolations: false - allowUnplannedEventProperties: false - allowUnplannedEvents: false - commonEventOnViolations: OMIT_PROPERTIES - forwardingViolationsTo: rh5BDZp6QDHvXFCkibm1pR - forwardingBlockedEventsTo: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/UpdateSchemaSettingsInSourceV1Input' - application/vnd.segment.v1+json: - example: - sourceId: qQEHquLrjRDN9j1ByrChyn - group: - allowTraitsOnViolations: false - allowUnplannedTraits: false - commonEventOnViolations: ALLOW - identify: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: BLOCK - track: - allowEventOnViolations: false - allowPropertiesOnViolations: false - allowUnplannedEventProperties: false - allowUnplannedEvents: false - commonEventOnViolations: OMIT_PROPERTIES - forwardingViolationsTo: rh5BDZp6QDHvXFCkibm1pR - forwardingBlockedEventsTo: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/UpdateSchemaSettingsInSourceV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - sourceId: qQEHquLrjRDN9j1ByrChyn - settings: - track: - allowUnplannedEvents: false - allowUnplannedEventProperties: false - allowEventOnViolations: false - allowPropertiesOnViolations: false - commonEventOnViolations: OMIT_PROPERTIES - group: - allowTraitsOnViolations: false - allowUnplannedTraits: false - commonEventOnViolations: ALLOW - identify: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: BLOCK - forwardingBlockedEventsTo: rh5BDZp6QDHvXFCkibm1pR - forwardingViolationsTo: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/updateSchemaSettingsInSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - sourceId: qQEHquLrjRDN9j1ByrChyn - settings: - track: - allowUnplannedEvents: false - allowUnplannedEventProperties: false - allowEventOnViolations: false - allowPropertiesOnViolations: false - commonEventOnViolations: OMIT_PROPERTIES - group: - allowTraitsOnViolations: false - allowUnplannedTraits: false - commonEventOnViolations: ALLOW - identify: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: BLOCK - forwardingBlockedEventsTo: rh5BDZp6QDHvXFCkibm1pR - forwardingViolationsTo: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/updateSchemaSettingsInSource_200_response' - application/vnd.segment.v1+json: - example: - data: - sourceId: qQEHquLrjRDN9j1ByrChyn - settings: - track: - allowUnplannedEvents: false - allowUnplannedEventProperties: false - allowEventOnViolations: false - allowPropertiesOnViolations: false - commonEventOnViolations: OMIT_PROPERTIES - group: - allowTraitsOnViolations: false - allowUnplannedTraits: false - commonEventOnViolations: ALLOW - identify: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: BLOCK - forwardingBlockedEventsTo: rh5BDZp6QDHvXFCkibm1pR - forwardingViolationsTo: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/updateSchemaSettingsInSource_200_response' - application/json: - example: - data: - sourceId: qQEHquLrjRDN9j1ByrChyn - settings: - track: - allowUnplannedEvents: false - allowUnplannedEventProperties: false - allowEventOnViolations: false - allowPropertiesOnViolations: false - commonEventOnViolations: OMIT_PROPERTIES - group: - allowTraitsOnViolations: false - allowUnplannedTraits: false - commonEventOnViolations: ALLOW - identify: - allowTraitsOnViolations: true - allowUnplannedTraits: true - commonEventOnViolations: BLOCK - forwardingBlockedEventsTo: rh5BDZp6QDHvXFCkibm1pR - forwardingViolationsTo: rh5BDZp6QDHvXFCkibm1pR - schema: - $ref: '#/components/schemas/updateSchemaSettingsInSource_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Update Schema Settings in Source - tags: - - Sources - x-domain-hierarchy: - - Connections - - Sources - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /warehouses/{warehouseId}/connected-sources/{sourceId}/selective-syncs: - get: - deprecated: false - description: "Returns the schema for a Warehouse, including Sources, Collections,\ - \ and Properties.\n\n\nThe rate limit for this endpoint is 2 requests per\ - \ minute, which is lower than the default due to access pattern restrictions.\ - \ Once reached, this endpoint will respond with the 429 HTTP status code with\ - \ headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits)\ - \ for more information." - operationId: listSelectiveSyncsFromWarehouseAndSource - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Defines the pagination parameters. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - items: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - collection: tracks - warehouseId: 6WzNjtobBv3GjubD8wUnA6 - source: hV2lO1ZmMd - properties: - amount: - enabled: true - type: integer - lastSeenAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - context_library_name: - enabled: true - type: string - lastSeenAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTAw - totalEntries: 10 - schema: - $ref: '#/components/schemas/listSelectiveSyncsFromWarehouseAndSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - items: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - collection: tracks - warehouseId: 6WzNjtobBv3GjubD8wUnA6 - source: hV2lO1ZmMd - properties: - amount: - enabled: true - type: integer - lastSeenAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - context_library_name: - enabled: true - type: string - lastSeenAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTAw - totalEntries: 10 - schema: - $ref: '#/components/schemas/listSelectiveSyncsFromWarehouseAndSource_200_response' - application/vnd.segment.v1+json: - example: - data: - items: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - collection: tracks - warehouseId: 6WzNjtobBv3GjubD8wUnA6 - source: hV2lO1ZmMd - properties: - amount: - enabled: true - type: integer - lastSeenAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - context_library_name: - enabled: true - type: string - lastSeenAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTAw - totalEntries: 10 - schema: - $ref: '#/components/schemas/listSelectiveSyncsFromWarehouseAndSource_200_response' - application/json: - example: - data: - items: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - collection: tracks - warehouseId: 6WzNjtobBv3GjubD8wUnA6 - source: hV2lO1ZmMd - properties: - amount: - enabled: true - type: integer - lastSeenAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - context_library_name: - enabled: true - type: string - lastSeenAt: 2006-01-02T15:04:05.000Z - createdAt: 2006-01-02T15:04:05.000Z - pagination: - current: MA== - next: MTAw - totalEntries: 10 - schema: - $ref: '#/components/schemas/listSelectiveSyncsFromWarehouseAndSource_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Selective Syncs from Warehouse And Source - tags: - - Selective Sync - x-domain-hierarchy: - - Connections - - Selective Sync - x-accepts: application/json - /suppressions: - get: - deprecated: false - description: Lists all suppressions in a given Workspace. - operationId: listSuppressions - parameters: - - description: |- - Pagination parameters. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - suppressed: - - subjectType: userId - subjectIds: - - "1" - pagination: - current: MQ== - next: cmVnLTY1MDgtMDA5ODE= - schema: - $ref: '#/components/schemas/listSuppressions_200_response' - application/vnd.segment.v1beta+json: - example: - data: - suppressed: - - subjectType: userId - subjectIds: - - "1" - pagination: - current: MQ== - next: cmVnLTY1MDgtMDA5ODE= - schema: - $ref: '#/components/schemas/listSuppressions_200_response' - application/vnd.segment.v1+json: - example: - data: - suppressed: - - subjectType: userId - subjectIds: - - "1" - pagination: - current: MQ== - next: cmVnLTY1MDgtMDA5ODE= - schema: - $ref: '#/components/schemas/listSuppressions_200_response' - application/json: - example: - data: - suppressed: - - subjectType: userId - subjectIds: - - "1" - pagination: - current: MQ== - next: cmVnLTY1MDgtMDA5ODE= - schema: - $ref: '#/components/schemas/listSuppressions_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Suppressions - tags: - - Deletion and Suppression - x-domain-hierarchy: - - Connections - - Deletion and Suppression - x-accepts: application/json - /warehouses/{warehouseId}/syncs: - get: - deprecated: false - description: "Returns the overview of syncs for every Source connected to a\ - \ Warehouse.\n\n\nThe rate limit for this endpoint is 2 requests per minute,\ - \ which is lower than the default due to access pattern restrictions. Once\ - \ reached, this endpoint will respond with the 429 HTTP status code with headers\ - \ indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits)\ - \ for more information." - operationId: listSyncsFromWarehouse - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Defines the pagination parameters. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - reports: [] - pagination: - next: null - current: "" - schema: - $ref: '#/components/schemas/listSyncsFromWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - reports: [] - pagination: - next: null - current: "" - schema: - $ref: '#/components/schemas/listSyncsFromWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - reports: [] - pagination: - next: null - current: "" - schema: - $ref: '#/components/schemas/listSyncsFromWarehouse_200_response' - application/json: - example: - data: - reports: [] - pagination: - next: null - current: "" - schema: - $ref: '#/components/schemas/listSyncsFromWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Syncs from Warehouse - tags: - - Selective Sync - x-domain-hierarchy: - - Connections - - Selective Sync - x-accepts: application/json - /warehouses/{warehouseId}/connected-sources/{sourceId}/syncs: - get: - deprecated: false - description: "Returns the overview of syncs for a Source connected to a Warehouse.\n\ - \n\nThe rate limit for this endpoint is 2 requests per minute, which is lower\ - \ than the default due to access pattern restrictions. Once reached, this\ - \ endpoint will respond with the 429 HTTP status code with headers indicating\ - \ the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: listSyncsFromWarehouseAndSource - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - explode: false - in: path - name: sourceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Defines the pagination parameters. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - reports: [] - pagination: - next: null - current: "" - schema: - $ref: '#/components/schemas/listSyncsFromWarehouseAndSource_200_response' - application/vnd.segment.v1beta+json: - example: - data: - reports: [] - pagination: - next: null - current: "" - schema: - $ref: '#/components/schemas/listSyncsFromWarehouseAndSource_200_response' - application/vnd.segment.v1+json: - example: - data: - reports: [] - pagination: - next: null - current: "" - schema: - $ref: '#/components/schemas/listSyncsFromWarehouseAndSource_200_response' - application/json: - example: - data: - reports: [] - pagination: - next: null - current: "" - schema: - $ref: '#/components/schemas/listSyncsFromWarehouseAndSource_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List Syncs from Warehouse And Source - tags: - - Selective Sync - x-domain-hierarchy: - - Connections - - Selective Sync - x-accepts: application/json - /users/{userId}/groups: - get: - deprecated: false - description: Returns all groups a user belongs to. - operationId: listUserGroupsFromUser - parameters: - - explode: false - in: path - name: userId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - Pagination for groups. - - This parameter exists in alpha. - explode: false - in: query - name: pagination - required: true - schema: - $ref: '#/components/schemas/PaginationInput' - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - groups: - - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - pagination: - current: MA== - totalEntries: 1 - schema: - $ref: '#/components/schemas/listUserGroupsFromUser_200_response' - application/vnd.segment.v1beta+json: - example: - data: - groups: [] - pagination: - current: MA== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listUserGroupsFromUser_200_response' - application/vnd.segment.v1+json: - example: - data: - groups: [] - pagination: - current: MA== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listUserGroupsFromUser_200_response' - application/json: - example: - data: - groups: [] - pagination: - current: MA== - totalEntries: 0 - schema: - $ref: '#/components/schemas/listUserGroupsFromUser_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: List User Groups from User - tags: - - IAM Users - x-domain-hierarchy: - - Admin - - IAM Users - x-accepts: application/json - /destination/filters/preview: - post: - deprecated: false - description: Simulates the application of a Destination filter to a provided - JSON payload. - operationId: previewDestinationFilter - parameters: [] - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - filter: - if: type = "track" AND event = "Order Completed" - actions: - - type: ALLOW_PROPERTIES - fields: - product: - - event - - requestedFrom - payload: - type: track - event: Order Completed - product: - name: Fake mustache - requestedFrom: /products/123/checkout - referrer: www.example.com - schema: - $ref: '#/components/schemas/PreviewDestinationFilterV1Input' - application/vnd.segment.v1beta+json: - example: - filter: - if: type = "track" AND event = "Order Completed" - actions: - - type: ALLOW_PROPERTIES - fields: - product: - - event - - requestedFrom - payload: - type: track - event: Order Completed - product: - name: Fake mustache - requestedFrom: /products/123/checkout - referrer: www.example.com - schema: - $ref: '#/components/schemas/PreviewDestinationFilterV1Input' - application/vnd.segment.v1+json: - example: - filter: - if: type = "track" AND event = "Order Completed" - actions: - - type: ALLOW_PROPERTIES - fields: - product: - - event - - requestedFrom - payload: - type: track - event: Order Completed - product: - name: Fake mustache - requestedFrom: /products/123/checkout - referrer: www.example.com - schema: - $ref: '#/components/schemas/PreviewDestinationFilterV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - inputPayload: - type: track - event: Order Completed - product: - name: Fake mustache - requestedFrom: /products/123/checkout - referrer: www.example.com - result: - type: track - event: Order Completed - product: - requestedFrom: /products/123/checkout - schema: - $ref: '#/components/schemas/previewDestinationFilter_200_response' - application/vnd.segment.v1beta+json: - example: - data: - inputPayload: - type: track - event: Order Completed - product: - name: Fake mustache - requestedFrom: /products/123/checkout - referrer: www.example.com - result: - type: track - event: Order Completed - product: - requestedFrom: /products/123/checkout - schema: - $ref: '#/components/schemas/previewDestinationFilter_200_response' - application/vnd.segment.v1+json: - example: - data: - inputPayload: - type: track - event: Order Completed - product: - name: Fake mustache - requestedFrom: /products/123/checkout - referrer: www.example.com - result: - type: track - event: Order Completed - product: - requestedFrom: /products/123/checkout - schema: - $ref: '#/components/schemas/previewDestinationFilter_200_response' - application/json: - example: - data: - inputPayload: - type: track - event: Order Completed - product: - name: Fake mustache - requestedFrom: /products/123/checkout - referrer: www.example.com - result: - type: track - event: Order Completed - product: - requestedFrom: /products/123/checkout - schema: - $ref: '#/components/schemas/previewDestinationFilter_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Preview Destination Filter - tags: - - Destination Filters - x-domain-hierarchy: - - Connections - - Destination Filters - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /group/{userGroupId}/users: - delete: - deprecated: false - description: "Removes one or multiple users or invites from a user group by\ - \ email.\n\nWhen called, this endpoint may generate one or more of the following\ - \ [Audit Trail](/tag/Audit-Trail) events:\n* Group Memberships Deleted\n*\ - \ User Removed From User Group\n \n\n\nThe rate limit for this endpoint\ - \ is 60 requests per minute, which is lower than the default due to access\ - \ pattern restrictions. Once reached, this endpoint will respond with the\ - \ 429 HTTP status code with headers indicating the limit parameters. See [Rate\ - \ Limiting](/#tag/Rate-Limits) for more information." - operationId: removeUsersFromUserGroup - parameters: - - explode: false - in: path - name: userGroupId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - - description: |- - The list of emails to remove from the user group. - - This parameter exists in alpha. - explode: false - in: query - name: emails - required: true - schema: - description: The list of emails to remove from the user group. - items: - type: string - title: emails - type: array - style: deepObject - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeUsersFromUserGroup_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeUsersFromUserGroup_200_response' - application/vnd.segment.v1+json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeUsersFromUserGroup_200_response' - application/json: - example: - data: - status: SUCCESS - schema: - $ref: '#/components/schemas/removeUsersFromUserGroup_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Remove Users from User Group - tags: - - IAM Groups - x-domain-hierarchy: - - Admin - - IAM Groups - x-accepts: application/json - put: - deprecated: false - description: "Replaces the members of a user group by email.\n\nWhen called,\ - \ this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail)\ - \ events:\n* Subjects Added to Group\n* User Added To User Group\n* Group\ - \ Memberships Deleted\n \n\n\nThe rate limit for this endpoint is 60\ - \ requests per minute, which is lower than the default due to access pattern\ - \ restrictions. Once reached, this endpoint will respond with the 429 HTTP\ - \ status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits)\ - \ for more information." - operationId: replaceUsersInUserGroup - parameters: - - explode: false - in: path - name: userGroupId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - emails: - - foo@example.com - userGroupId: bBABwqbaDf2QdwTbW8bNEm - schema: - $ref: '#/components/schemas/ReplaceUsersInUserGroupV1Input' - application/vnd.segment.v1beta+json: - example: - emails: - - foo@example.com - userGroupId: bBABwqbaDf2QdwTbW8bNEm - schema: - $ref: '#/components/schemas/ReplaceUsersInUserGroupV1Input' - application/vnd.segment.v1+json: - example: - emails: - - foo@example.com - userGroupId: bBABwqbaDf2QdwTbW8bNEm - schema: - $ref: '#/components/schemas/ReplaceUsersInUserGroupV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 1 - schema: - $ref: '#/components/schemas/replaceUsersInUserGroup_200_response' - application/vnd.segment.v1beta+json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 1 - schema: - $ref: '#/components/schemas/replaceUsersInUserGroup_200_response' - application/vnd.segment.v1+json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 1 - schema: - $ref: '#/components/schemas/replaceUsersInUserGroup_200_response' - application/json: - example: - data: - userGroup: - id: bBABwqbaDf2QdwTbW8bNEm - name: PAPI Example Group - memberCount: 1 - schema: - $ref: '#/components/schemas/replaceUsersInUserGroup_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Replace Users in User Group - tags: - - IAM Groups - x-domain-hierarchy: - - Admin - - IAM Groups - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /spaces/{spaceId}/messaging-subscriptions: - put: - deprecated: false - description: "Replace Messaging Subscriptions in Spaces.\n\n\nThe rate limit\ - \ for this endpoint is 60 requests per minute, which is lower than the default\ - \ due to access pattern restrictions. Once reached, this endpoint will respond\ - \ with the 429 HTTP status code with headers indicating the limit parameters.\ - \ See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: replaceMessagingSubscriptionsInSpaces - parameters: - - explode: false - in: path - name: spaceId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - spaceId: 9aQ1Lj62S4bomZKLF4DPqW - subscriptions: - - key: test@email.com - type: EMAIL - status: DID_NOT_SUBSCRIBE - - key: pgibbonsexample.com - type: EMAIL - status: UNSUBSCRIBED - - key: +12162226233 - type: SMS - status: DID_NOT_SUBSCRIBE - - key: "11" - type: SMS - status: DID_NOT_SUBSCRIBE - schema: - $ref: '#/components/schemas/ReplaceMessagingSubscriptionsInSpacesAlphaInput' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - successes: - - key: jacob@exmple.com - type: EMAIL - status: SUBSCRIBED - - key: "2162226233" - type: PHONE - status: DID_NOT_SUBSCRIBE - failures: - - key: pgibbonsexample.com - type: EMAIL - status: UNSUBSCRIBED - errors: - - code: INVALID_EMAIL - message: Email is not valid - schema: - $ref: '#/components/schemas/replaceMessagingSubscriptionsInSpaces_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Replace Messaging Subscriptions in Spaces - tags: - - Spaces - x-domain-hierarchy: - - Engage - - Spaces - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json - /warehouses/{warehouseId}/selective-sync: - patch: - deprecated: false - description: "Configures the schema for a Warehouse, including Sources, Collections,\ - \ and Properties.\n\n\n\nWhen called, this endpoint may generate the `Storage\ - \ Destination Modified` [Audit Trail](/tag/Audit-Trail) event.\n \n\n\ - \nThe rate limit for this endpoint is 2 requests per minute, which is lower\ - \ than the default due to access pattern restrictions. Once reached, this\ - \ endpoint will respond with the 429 HTTP status code with headers indicating\ - \ the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information." - operationId: updateSelectiveSyncForWarehouse - parameters: - - explode: false - in: path - name: warehouseId - required: true - schema: - maximum: 255 - minimum: 1 - type: string - style: simple - requestBody: - content: - application/vnd.segment.v1alpha+json: - example: - warehouseId: kjU72LCJexvrqL7G4TMHHN - syncOverrides: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - enabled: true - collection: checkout_started - property: context_ip - schema: - $ref: '#/components/schemas/UpdateSelectiveSyncForWarehouseV1Input' - application/vnd.segment.v1beta+json: - example: - warehouseId: kjU72LCJexvrqL7G4TMHHN - syncOverrides: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - enabled: true - collection: checkout_started - property: context_ip - schema: - $ref: '#/components/schemas/UpdateSelectiveSyncForWarehouseV1Input' - application/vnd.segment.v1+json: - example: - warehouseId: kjU72LCJexvrqL7G4TMHHN - syncOverrides: - - sourceId: rh5BDZp6QDHvXFCkibm1pR - enabled: true - collection: checkout_started - property: context_ip - schema: - $ref: '#/components/schemas/UpdateSelectiveSyncForWarehouseV1Input' - required: true - responses: - "200": - content: - application/vnd.segment.v1alpha+json: - example: - data: - status: UPDATED - warnings: [] - schema: - $ref: '#/components/schemas/updateSelectiveSyncForWarehouse_200_response' - application/vnd.segment.v1beta+json: - example: - data: - status: UPDATED - warnings: [] - schema: - $ref: '#/components/schemas/updateSelectiveSyncForWarehouse_200_response' - application/vnd.segment.v1+json: - example: - data: - status: UPDATED - warnings: [] - schema: - $ref: '#/components/schemas/updateSelectiveSyncForWarehouse_200_response' - application/json: - example: - data: - status: UPDATED - warnings: [] - schema: - $ref: '#/components/schemas/updateSelectiveSyncForWarehouse_200_response' - description: OK - "404": - content: - application/json: - example: - errors: - - type: NotFound - message: Resource not found - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Resource not found - "422": - content: - application/json: - example: - errors: - - type: ValidationFailure - message: Validation failure - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Validation failure - "429": - content: - application/json: - example: - errors: - - type: RateLimited - message: Rate limit exceeded - schema: - $ref: '#/components/schemas/RequestErrorEnvelope' - description: Too many requests - summary: Update Selective Sync for Warehouse - tags: - - Selective Sync - x-domain-hierarchy: - - Connections - - Selective Sync - x-content-type: application/vnd.segment.v1alpha+json - x-accepts: application/json -components: - schemas: - AllowedLabelBeta: - description: Defines a label that you may apply to resources within a Workspace. - example: - description: description - value: value - key: key - properties: - key: - description: The key identifier for this label. - title: key - type: string - value: - description: The value of this label. - title: value - type: string - description: - description: A description of what this label represents. - title: description - type: string - required: - - key - - value - title: AllowedLabelBeta - type: object - AuditEventV1: - description: Represents an Audit Trail event. - example: - actor: actor - resourceId: resourceId - resourceName: resourceName - id: id - type: type - timestamp: timestamp - resourceType: resourceType - properties: - id: - description: Unique identifier for this audit trail event. - title: id - type: string - timestamp: - description: The timestamp of this event in ISO-8601 format. - title: timestamp - type: string - type: - description: The type of this event. - title: type - type: string - actor: - description: The user or API token that triggered this event. - title: actor - type: string - resourceId: - description: The identifier of the resource affected by this event. - title: resourceId - type: string - resourceType: - description: The kind of resource affected by this event. - title: resourceType - type: string - resourceName: - description: The name of the resource affected by this event. - title: resourceName - type: string - required: - - actor - - id - - resourceId - - resourceName - - resourceType - - timestamp - - type - title: AuditEventV1 - type: object - ListAuditEventsV1Input: - description: Retrieves all Audit Trail events for the current Workspace. - properties: {} - title: ListAuditEventsV1Input - type: object - ListAuditEventsV1Output: - description: Returns a list of Audit Trail events for the current Workspace. - example: - pagination: null - events: - - actor: actor - resourceId: resourceId - resourceName: resourceName - id: id - type: type - timestamp: timestamp - resourceType: resourceType - - actor: actor - resourceId: resourceId - resourceName: resourceName - id: id - type: type - timestamp: timestamp - resourceType: resourceType - properties: - events: - description: Audit trail events for the current Workspace. - items: - $ref: '#/components/schemas/AuditEventV1' - title: events - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - events - title: ListAuditEventsV1Output - type: object - ListFiltersFromDestinationV1Input: - description: Input for ListDestinationFiltersV1. - properties: {} - required: - - destinationId - title: ListFiltersFromDestinationV1Input - type: object - GetFilterInDestinationV1Input: - description: Input for GetDestinationFilterV1. - properties: {} - title: GetFilterInDestinationV1Input - type: object - RemoveFilterFromDestinationV1Input: - description: Input for DeleteDestinationFilterV1. - properties: {} - title: RemoveFilterFromDestinationV1Input - type: object - DestinationFilterActionV1: - description: Represents a Destination filter action. - example: - path: path - type: ALLOW_PROPERTIES - fields: - key: "" - percent: 0.8008281904610115 - properties: - type: - description: The kind of Transformation to apply to any matched properties. - enum: - - ALLOW_PROPERTIES - - DROP - - DROP_PROPERTIES - - SAMPLE - title: type - type: string - fields: - additionalProperties: true - description: |- - A dictionary of paths to object keys that this filter applies to. - The literal string '' represents the top level of the object. - title: fields - type: object - percent: - description: |- - A decimal between 0 and 1 used for 'sample' type events and - influences the likelihood of sampling to occur. - title: percent - type: number - path: - description: |- - The JSON path to a property within a payload object from which Segment generates a deterministic - sampling rate. - title: path - type: string - required: - - type - title: DestinationFilterActionV1 - type: object - CreateFilterForDestinationV1Input: - description: Input for CreateDestinationFilterV1. - properties: - sourceId: - description: The id of the Source associated with this filter. - title: sourceId - type: string - if: - description: The filter's condition. - title: if - type: string - actions: - description: Actions for the Destination filter. - items: - $ref: '#/components/schemas/DestinationFilterActionV1' - title: actions - type: array - title: - description: The title of the filter. - title: title - type: string - description: - description: The description of the filter. - title: description - type: string - enabled: - description: "When set to true, the Destination filter is active." - title: enabled - type: boolean - required: - - actions - - enabled - - if - title: CreateFilterForDestinationV1Input - type: object - PreviewDestinationFilterV1: - description: A simplified Destination filter that includes the if and actions - for a DestinationFilterV1. - properties: - if: - description: "A FQL statement which determines if the provided filter's\ - \ actions will apply to the provided JSON payload.\nThe literal string\ - \ \"all\" will result in this filter to all events.\nFor guidance on using\ - \ FQL, see the Segment documentation site." - title: if - type: string - actions: - description: "The filtering action to take on events that match the \"if\"\ - \ statement.\nAction types must be one of: \"drop\", \"allow_properties\"\ - , \"drop_properties\" or \"sample\"." - items: - $ref: '#/components/schemas/DestinationFilterActionV1' - title: actions - type: array - required: - - actions - - if - title: PreviewDestinationFilterV1 - type: object - PreviewDestinationFilterV1Input: - description: "Input of the Destination filter to preview.\nFor guidance on using\ - \ FQL, see the Segment documentation site." - properties: - filter: - $ref: '#/components/schemas/filter' - payload: - additionalProperties: true - description: The JSON payload to apply the filter to. - title: payload - type: object - required: - - filter - - payload - title: PreviewDestinationFilterV1Input - type: object - PreviewDestinationFilterV1Output: - description: |- - Preview output from applying the Destination filter. - Segment modifies or nullifies payloads depending on the provided filter actions. - example: - result: "" - inputPayload: - key: "" - properties: - inputPayload: - additionalProperties: true - description: The pre-filter JSON input. - title: inputPayload - type: object - result: - allOf: - - additionalProperties: {} - type: object - description: The filtered JSON output. - nullable: true - title: result - required: - - inputPayload - - result - title: PreviewDestinationFilterV1Output - type: object - DestinationFilterV1: - description: Represents a Destination filter. - example: - sourceId: sourceId - createdAt: createdAt - description: description - id: id - destinationId: destinationId - title: title - if: if - actions: - - path: path - type: ALLOW_PROPERTIES - fields: - key: "" - percent: 0.8008281904610115 - - path: path - type: ALLOW_PROPERTIES - fields: - key: "" - percent: 0.8008281904610115 - enabled: true - updatedAt: updatedAt - properties: - id: - description: The unique id of this filter. - title: id - type: string - sourceId: - description: The id of the Source associated with this filter. - title: sourceId - type: string - destinationId: - description: The id of the Destination associated with this filter. - title: destinationId - type: string - if: - description: A condition that defines whether to apply this filter to a - payload. - title: if - type: string - actions: - description: A list of actions this filter performs. - items: - $ref: '#/components/schemas/DestinationFilterActionV1' - title: actions - type: array - title: - description: A title for this filter. - title: title - type: string - description: - description: A description for this filter. - title: description - type: string - enabled: - description: "When set to true, this filter is active." - title: enabled - type: boolean - createdAt: - description: The timestamp of this filter's creation. - title: createdAt - type: string - updatedAt: - description: The timestamp of this filter's last change. - title: updatedAt - type: string - required: - - actions - - createdAt - - destinationId - - enabled - - id - - if - - sourceId - - title - - updatedAt - title: DestinationFilterV1 - type: object - ListFiltersFromDestinationV1Output: - description: Output for ListDestinationFiltersV1. - example: - pagination: null - filters: - - sourceId: sourceId - createdAt: createdAt - description: description - id: id - destinationId: destinationId - title: title - if: if - actions: - - path: path - type: ALLOW_PROPERTIES - fields: - key: "" - percent: 0.8008281904610115 - - path: path - type: ALLOW_PROPERTIES - fields: - key: "" - percent: 0.8008281904610115 - enabled: true - updatedAt: updatedAt - - sourceId: sourceId - createdAt: createdAt - description: description - id: id - destinationId: destinationId - title: title - if: if - actions: - - path: path - type: ALLOW_PROPERTIES - fields: - key: "" - percent: 0.8008281904610115 - - path: path - type: ALLOW_PROPERTIES - fields: - key: "" - percent: 0.8008281904610115 - enabled: true - updatedAt: updatedAt - properties: - filters: - description: A list of the filters that belong to the specified Destination - instance. - items: - $ref: '#/components/schemas/DestinationFilterV1' - title: filters - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - filters - - pagination - title: ListFiltersFromDestinationV1Output - type: object - GetFilterInDestinationV1Output: - description: Output for GetDestinationFiltersV1. - example: - filter: null - properties: - filter: - $ref: '#/components/schemas/filter_1' - required: - - filter - title: GetFilterInDestinationV1Output - type: object - CreateFilterForDestinationV1Output: - description: Output for CreateDestinationFiltersV1. - example: - filter: null - properties: - filter: - $ref: '#/components/schemas/filter_2' - required: - - filter - title: CreateFilterForDestinationV1Output - type: object - RemoveFilterFromDestinationV1Output: - description: Output for DeleteDestinationFilterV1. - example: - status: SUCCESS - properties: - status: - description: The status of delete operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: RemoveFilterFromDestinationV1Output - type: object - UpdateFilterForDestinationV1Input: - description: Input for UpdateDestinationFilterV1. - properties: - if: - description: The FQL if condition to update. - title: if - type: string - actions: - description: Actions for this Destination filter. - items: - $ref: '#/components/schemas/DestinationFilterActionV1' - title: actions - type: array - title: - description: The title to update. - title: title - type: string - description: - description: The description of this filter. - nullable: true - title: description - type: string - enabled: - description: "When set to true, this Destination filter is active." - title: enabled - type: boolean - title: UpdateFilterForDestinationV1Input - type: object - UpdateFilterForDestinationV1Output: - description: Output for UpdateDestinationFilterV1. - example: - filter: null - properties: - filter: - $ref: '#/components/schemas/filter_3' - required: - - filter - title: UpdateFilterForDestinationV1Output - type: object - DestinationMetadataV1: - description: "Represents a Destination within Segment.\n\nA Destination is a\ - \ target for Segment to forward data to, and represents a tool or storage\ - \ Destination." - example: - website: website - components: - - owner: PARTNER - code: code - type: ANDROID - - owner: PARTNER - code: code - type: ANDROID - supportedFeatures: null - description: description - logos: null - presets: - - name: name - actionId: actionId - trigger: trigger - fields: - key: "" - - name: name - actionId: actionId - trigger: trigger - fields: - key: "" - supportedMethods: null - previousNames: - - previousNames - - previousNames - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - id: id - categories: - - categories - - categories - supportedPlatforms: null - partnerOwned: true - actions: - - defaultTrigger: defaultTrigger - hidden: true - name: name - description: description - id: id - fields: - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - slug: slug - platform: CLOUD - - defaultTrigger: defaultTrigger - hidden: true - name: name - description: description - id: id - fields: - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - slug: slug - platform: CLOUD - slug: slug - contacts: - - role: role - isPrimary: true - name: name - email: email - - role: role - isPrimary: true - name: name - email: email - status: DEPRECATED - properties: - id: - description: "The id of the Destination metadata.\n\nConfig API note: analogous\ - \ to `name`." - title: id - type: string - name: - description: "The user-friendly name of the Destination.\n\nConfig API note:\ - \ equal to `displayName`." - title: name - type: string - description: - description: The description of the Destination. - title: description - type: string - slug: - description: The slug used to identify the Destination in the Segment app. - title: slug - type: string - logos: - $ref: '#/components/schemas/logos' - options: - description: Options configured for the Destination. - items: - $ref: '#/components/schemas/IntegrationOptionBeta' - title: options - type: array - status: - description: Support status of the Destination. - enum: - - DEPRECATED - - PRIVATE_BETA - - PRIVATE_BUILDING - - PRIVATE_SUBMITTED - - PUBLIC - - PUBLIC_BETA - - UNAVAILABLE - title: status - type: string - previousNames: - description: A list of names previously used by the Destination. - items: - type: string - title: previousNames - type: array - categories: - description: A list of categories with which the Destination is associated. - items: - type: string - title: categories - type: array - website: - description: A website URL for this Destination. - title: website - type: string - components: - description: A list of components this Destination provides. - items: - $ref: '#/components/schemas/DestinationMetadataComponentV1' - title: components - type: array - supportedFeatures: - $ref: '#/components/schemas/supportedFeatures' - supportedMethods: - $ref: '#/components/schemas/supportedMethods' - supportedPlatforms: - $ref: '#/components/schemas/supportedPlatforms' - actions: - description: Actions available for the Destination. - items: - $ref: '#/components/schemas/DestinationMetadataActionV1' - title: actions - type: array - presets: - description: Predefined Destination subscriptions that can optionally be - applied when connecting a new instance of the Destination. - items: - $ref: '#/components/schemas/DestinationMetadataSubscriptionPresetV1' - title: presets - type: array - contacts: - description: Contact info for Integration Owners. - items: - $ref: '#/components/schemas/Contact' - title: contacts - type: array - partnerOwned: - description: Partner Owned flag. - title: partnerOwned - type: boolean - required: - - actions - - categories - - components - - description - - id - - logos - - name - - options - - presets - - previousNames - - slug - - status - - supportedFeatures - - supportedMethods - - supportedPlatforms - - website - title: DestinationMetadataV1 - type: object - Contact: - description: The contact info for Integration Owners. - example: - role: role - isPrimary: true - name: name - email: email - properties: - name: - description: Name of this contact. - title: name - type: string - email: - description: Email of this contact. - title: email - type: string - role: - description: Role of this contact. - title: role - type: string - isPrimary: - description: Whether this is a primary contact. - title: isPrimary - type: boolean - required: - - email - - isPrimary - - name - - role - title: Contact - type: object - DestinationMetadataComponentV1: - description: Represents a component this Destination provides. - example: - owner: PARTNER - code: code - type: ANDROID - properties: - type: - description: The component type. - enum: - - ANDROID - - BROWSER - - IOS - - SERVER - title: type - type: string - code: - description: Link to the repository hosting the code for this component. - title: code - type: string - owner: - description: The owner of this component. Either 'SEGMENT' or 'PARTNER'. - enum: - - PARTNER - - SEGMENT - title: owner - type: string - required: - - code - - type - title: DestinationMetadataComponentV1 - type: object - DestinationMetadataMethodsV1: - description: Represents methods that a given Destination supports. - properties: - pageview: - description: Identifies if the Destination supports the `pageview` method. - title: pageview - type: boolean - identify: - description: Identifies if the Destination supports the `identify` method. - title: identify - type: boolean - alias: - description: Identifies if the Destination supports the `alias` method. - title: alias - type: boolean - track: - description: Identifies if the Destination supports the `track` method. - title: track - type: boolean - group: - description: Identifies if the Destination supports the `group` method. - title: group - type: boolean - title: DestinationMetadataMethodsV1 - type: object - DestinationMetadataPlatformsV1: - description: Represents platforms that a given Destination supports. - properties: - browser: - description: Whether this Destination supports browser events. - title: browser - type: boolean - server: - description: Whether this Destination supports server events. - title: server - type: boolean - mobile: - description: Whether this Destination supports mobile events. - title: mobile - type: boolean - title: DestinationMetadataPlatformsV1 - type: object - DestinationMetadataFeaturesV1: - description: Represents features that a given Destination supports. - properties: - cloudModeInstances: - description: "This Destination's support level for cloud mode instances.\n\ - The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent." - enum: - - "0" - - "1" - - MULTIPLE - - NONE - - SINGLE - title: cloudModeInstances - type: string - deviceModeInstances: - description: "This Destination's support level for device mode instances.\n\ - Support for multiple device mode instances is currently not planned.\n\ - The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent." - enum: - - "0" - - "1" - - NONE - - SINGLE - title: deviceModeInstances - type: string - replay: - description: Whether this Destination supports replays. - title: replay - type: boolean - browserUnbundling: - description: Whether this Destination supports browser unbundling. - title: browserUnbundling - type: boolean - browserUnbundlingPublic: - description: Whether this Destination supports public browser unbundling. - title: browserUnbundlingPublic - type: boolean - title: DestinationMetadataFeaturesV1 - type: object - DestinationMetadataActionV1: - description: "Represents an Action, a building block of behavior that can be\ - \ performed by the Destination." - example: - defaultTrigger: defaultTrigger - hidden: true - name: name - description: description - id: id - fields: - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - slug: slug - platform: CLOUD - properties: - id: - description: The primary key of the action. - title: id - type: string - slug: - description: A machine-readable key unique to the action definition. - title: slug - type: string - name: - description: A human-readable name for the action. - title: name - type: string - description: - description: A human-readable description of the action. May include Markdown. - title: description - type: string - platform: - description: The platform on which this action runs. - enum: - - CLOUD - - MOBILE - - WEB - title: platform - type: string - hidden: - description: Whether the action should be hidden. - title: hidden - type: boolean - defaultTrigger: - description: The default value used as the trigger when connecting this - action. - nullable: true - title: defaultTrigger - type: string - fields: - description: The fields expected in order to perform the action. - items: - $ref: '#/components/schemas/DestinationMetadataActionFieldV1' - title: fields - type: array - required: - - defaultTrigger - - description - - fields - - hidden - - id - - name - - platform - - slug - title: DestinationMetadataActionV1 - type: object - DestinationMetadataActionFieldV1: - description: Represents a field used in configuring an action. - example: - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - properties: - id: - description: The primary key of the field. - title: id - type: string - sortOrder: - description: The order this particular field is (used in the UI for displaying - the fields in a specified order). - title: sortOrder - type: number - fieldKey: - description: A unique machine-readable key for the field. Should ideally - match the expected key in the action\'s API request. - title: fieldKey - type: string - label: - description: A human-readable label for this value. - title: label - type: string - type: - description: The data type for this value. - enum: - - BOOLEAN - - DATETIME - - HIDDEN - - INTEGER - - NUMBER - - OBJECT - - PASSWORD - - STRING - - TEXT - title: type - type: string - description: - description: A human-readable description of this value. You can use Markdown. - title: description - type: string - placeholder: - description: An example value displayed but not saved. - title: placeholder - type: string - defaultValue: - description: A default value that is saved the first time an action is created. - title: defaultValue - required: - description: Whether this field is required. - title: required - type: boolean - multiple: - description: Whether a user can provide multiples of this field. - title: multiple - type: boolean - choices: - description: A list of machine-readable value/label pairs to populate a - static dropdown. - title: choices - dynamic: - description: "Whether this field should execute a dynamic request to fetch\ - \ choices to populate a dropdown. When true, `choices` is ignored." - title: dynamic - type: boolean - allowNull: - description: Whether this field allows null values. - title: allowNull - type: boolean - required: - - allowNull - - description - - dynamic - - fieldKey - - id - - label - - multiple - - required - - sortOrder - - type - title: DestinationMetadataActionFieldV1 - type: object - DestinationMetadataSubscriptionPresetV1: - description: Represents a set of defaults for a Destination subscription. - example: - name: name - actionId: actionId - trigger: trigger - fields: - key: "" - properties: - actionId: - description: The unique identifier for the Destination Action to trigger. - title: actionId - type: string - name: - description: The name of the subscription. - title: name - type: string - fields: - additionalProperties: true - description: The default settings for action fields. - title: fields - type: object - trigger: - description: FQL string that describes what events should trigger an action. - See https://segment.com/docs/config-api/fql/ for more information regarding - Segment's Filter Query Language (FQL). - title: trigger - type: string - required: - - actionId - - fields - - name - - trigger - title: DestinationMetadataSubscriptionPresetV1 - type: object - GetDestinationsCatalogV1Input: - description: Contains filter parameters used for loading the Destinations public - catalog. - properties: {} - required: - - pagination - title: GetDestinationsCatalogV1Input - type: object - GetDestinationsCatalogV1Output: - description: Returns a list of all Destination catalog items contained within - a given page. - example: - pagination: null - destinationsCatalog: - - website: website - components: - - owner: PARTNER - code: code - type: ANDROID - - owner: PARTNER - code: code - type: ANDROID - supportedFeatures: null - description: description - logos: null - presets: - - name: name - actionId: actionId - trigger: trigger - fields: - key: "" - - name: name - actionId: actionId - trigger: trigger - fields: - key: "" - supportedMethods: null - previousNames: - - previousNames - - previousNames - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - id: id - categories: - - categories - - categories - supportedPlatforms: null - partnerOwned: true - actions: - - defaultTrigger: defaultTrigger - hidden: true - name: name - description: description - id: id - fields: - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - slug: slug - platform: CLOUD - - defaultTrigger: defaultTrigger - hidden: true - name: name - description: description - id: id - fields: - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - slug: slug - platform: CLOUD - slug: slug - contacts: - - role: role - isPrimary: true - name: name - email: email - - role: role - isPrimary: true - name: name - email: email - status: DEPRECATED - - website: website - components: - - owner: PARTNER - code: code - type: ANDROID - - owner: PARTNER - code: code - type: ANDROID - supportedFeatures: null - description: description - logos: null - presets: - - name: name - actionId: actionId - trigger: trigger - fields: - key: "" - - name: name - actionId: actionId - trigger: trigger - fields: - key: "" - supportedMethods: null - previousNames: - - previousNames - - previousNames - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - id: id - categories: - - categories - - categories - supportedPlatforms: null - partnerOwned: true - actions: - - defaultTrigger: defaultTrigger - hidden: true - name: name - description: description - id: id - fields: - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - slug: slug - platform: CLOUD - - defaultTrigger: defaultTrigger - hidden: true - name: name - description: description - id: id - fields: - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - slug: slug - platform: CLOUD - slug: slug - contacts: - - role: role - isPrimary: true - name: name - email: email - - role: role - isPrimary: true - name: name - email: email - status: DEPRECATED - properties: - destinationsCatalog: - description: All Destination catalog items contained within the requested - page. - items: - $ref: '#/components/schemas/DestinationMetadataV1' - title: destinationsCatalog - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - destinationsCatalog - - pagination - title: GetDestinationsCatalogV1Output - type: object - GetDestinationMetadataV1Input: - description: Loads a Destination catalog item by id. - properties: {} - required: - - destinationMetadataId - title: GetDestinationMetadataV1Input - type: object - GetDestinationMetadataV1Output: - description: Returns a Destination catalog item. - example: - destinationMetadata: null - properties: - destinationMetadata: - $ref: '#/components/schemas/destinationMetadata' - required: - - destinationMetadata - title: GetDestinationMetadataV1Output - type: object - DestinationSubscription: - example: - actionSlug: actionSlug - settings: "" - name: name - actionId: actionId - id: id - trigger: trigger - destinationId: destinationId - enabled: true - properties: - id: - description: The unique identifier for the subscription. - title: id - type: string - name: - description: The name of the subscription. - title: name - type: string - actionId: - description: The unique identifier for the Destination action to trigger. - title: actionId - type: string - actionSlug: - description: The URL-friendly key for the associated Destination action. - title: actionSlug - type: string - destinationId: - description: The associated Destination instance id. - title: destinationId - type: string - enabled: - description: Is the subscription enabled. - title: enabled - type: boolean - settings: - allOf: - - $ref: '#/components/schemas/DestinationSubscriptionFields' - description: The customer settings for action fields. - title: settings - trigger: - description: FQL string that describes what events should trigger a Destination - action. - title: trigger - type: string - required: - - actionId - - actionSlug - - destinationId - - enabled - - id - - name - - settings - - trigger - title: DestinationSubscription - type: object - DestinationSubscriptionFields: - additionalProperties: {} - description: Represents settings used to configure an action subscription. - title: DestinationSubscriptionFields - type: object - ListSubscriptionsFromDestinationAlphaInput: - description: Input for ListDestinationSubscriptionsAlpha. - properties: {} - required: - - destinationId - title: ListSubscriptionsFromDestinationAlphaInput - type: object - ListSubscriptionsFromDestinationAlphaOutput: - description: Output for ListDestinationSubscriptionsAlpha. - example: - subscriptions: - - actionSlug: actionSlug - settings: "" - name: name - actionId: actionId - id: id - trigger: trigger - destinationId: destinationId - enabled: true - - actionSlug: actionSlug - settings: "" - name: name - actionId: actionId - id: id - trigger: trigger - destinationId: destinationId - enabled: true - pagination: null - properties: - subscriptions: - description: A list of Destination subscriptions. - items: - $ref: '#/components/schemas/DestinationSubscription' - title: subscriptions - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - subscriptions - title: ListSubscriptionsFromDestinationAlphaOutput - type: object - GetSubscriptionFromDestinationAlphaInput: - description: Fetches a Destination subscription. - properties: {} - required: - - destinationId - title: GetSubscriptionFromDestinationAlphaInput - type: object - GetSubscriptionFromDestinationAlphaOutput: - description: Returns a subscription for a given subscription id. - example: - subscription: null - properties: - subscription: - $ref: '#/components/schemas/subscription' - required: - - subscription - title: GetSubscriptionFromDestinationAlphaOutput - type: object - CreateDestinationSubscriptionAlphaInput: - description: The basic input parameters for creating a Destination subscription. - properties: - name: - description: A user-defined name for the subscription. - title: name - type: string - actionId: - description: The associated action id the subscription should trigger. - title: actionId - type: string - trigger: - description: The FQL statement. - title: trigger - type: string - enabled: - description: Is the subscription enabled. - title: enabled - type: boolean - settings: - allOf: - - $ref: '#/components/schemas/DestinationSubscriptionFields' - description: The fields used for configuring this action. - title: settings - required: - - actionId - - enabled - - name - - trigger - title: CreateDestinationSubscriptionAlphaInput - type: object - CreateDestinationSubscriptionAlphaOutput: - description: Returns a newly created Destination subscription. - example: - destinationSubscription: null - properties: - destinationSubscription: - $ref: '#/components/schemas/destinationSubscription' - required: - - destinationSubscription - title: CreateDestinationSubscriptionAlphaOutput - type: object - DestinationSubscriptionUpdateInput: - description: The input parameters for updating a Destination subscription. - properties: - name: - description: The user-defined name for the subscription. - title: name - type: string - trigger: - description: The fql statement. - title: trigger - type: string - enabled: - description: Is the subscription enabled. - title: enabled - type: boolean - settings: - allOf: - - $ref: '#/components/schemas/DestinationSubscriptionFields' - description: The fields used for configuring this action. - title: settings - title: DestinationSubscriptionUpdateInput - type: object - UpdateSubscriptionForDestinationAlphaInput: - description: The basic input parameters for updating a Destination subscription. - properties: - input: - $ref: '#/components/schemas/input' - required: - - destinationId - - input - title: UpdateSubscriptionForDestinationAlphaInput - type: object - UpdateSubscriptionForDestinationAlphaOutput: - description: Returns the updated Destination subscription. - example: - subscription: null - properties: - subscription: - $ref: '#/components/schemas/subscription' - required: - - subscription - title: UpdateSubscriptionForDestinationAlphaOutput - type: object - RemoveSubscriptionFromDestinationAlphaInput: - description: Deletes a Destination by id. - properties: {} - required: - - destinationId - title: RemoveSubscriptionFromDestinationAlphaInput - type: object - RemoveSubscriptionFromDestinationAlphaOutput: - description: Returns a Destination deletion flag. - example: - status: SUCCESS - properties: - status: - description: The status of the operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: RemoveSubscriptionFromDestinationAlphaOutput - type: object - ListDeliveryMetricsSummaryFromDestinationBetaInput: - description: Input to retrieve event delivery metrics summary for a Destination. - properties: {} - title: ListDeliveryMetricsSummaryFromDestinationBetaInput - type: object - ListDeliveryMetricsSummaryFromDestinationBetaOutput: - description: Output to retrieve event delivery metrics summary for a Destination. - example: - deliveryMetricsSummary: null - properties: - deliveryMetricsSummary: - $ref: '#/components/schemas/deliveryMetricsSummary' - required: - - deliveryMetricsSummary - title: ListDeliveryMetricsSummaryFromDestinationBetaOutput - type: object - DeliveryMetricsSummaryBeta: - description: Defines the summary of delivery metrics for a Destination. - properties: - sourceId: - description: "The Source id.\n\nConfig API note: analogous to `parent`." - title: sourceId - type: string - destinationMetadataId: - description: The Destination metadata id. - title: destinationMetadataId - type: string - metrics: - description: The summary of event delivery metrics for the requested Destination. - items: - $ref: '#/components/schemas/MetricBeta' - title: metrics - type: array - required: - - destinationMetadataId - - metrics - - sourceId - title: DeliveryMetricsSummaryBeta - type: object - MetricBeta: - description: The event delivery metric. - properties: - metricName: - description: The name of the metric. - title: metricName - type: string - total: - description: Number of occurrences of the metric. - title: total - type: number - breakdown: - description: Breakdown of metrics within a metric. - items: - $ref: '#/components/schemas/BreakdownBeta' - title: breakdown - type: array - required: - - metricName - - total - title: MetricBeta - type: object - BreakdownBeta: - description: The breakdown of a metric. - properties: - metricName: - description: The name of the metric. - title: metricName - type: string - value: - description: Number of occurrences of the metric. - title: value - type: number - required: - - metricName - - value - title: BreakdownBeta - type: object - DestinationV1: - description: "Business tools or apps that you can connect to the data flowing\ - \ through Segment.\n\nThis is equal to the Destination object in Config API,\ - \ with the following fields omitted:\n- catalogId\n- createTime\n- updateTime\n\ - - connectionMode." - example: - sourceId: sourceId - settings: - key: "" - metadata: null - name: name - id: id - enabled: true - properties: - id: - description: "The unique identifier of this instance of a Destination.\n\ - \nConfig API note: analogous to `name`." - title: id - type: string - name: - description: "The name of this instance of a Destination.\n\nConfig API\ - \ note: equal to `displayName`." - title: name - type: string - enabled: - description: Whether this instance of a Destination receives data. - title: enabled - type: boolean - metadata: - $ref: '#/components/schemas/metadata' - sourceId: - description: "The id of a Source connected to this instance of a Destination.\n\ - \nConfig API note: analogous to `parent`." - title: sourceId - type: string - settings: - additionalProperties: true - description: "The collection of settings associated with a Destination.\n\ - \nConfig API note: equal to `config`." - title: settings - type: object - required: - - enabled - - id - - metadata - - settings - - sourceId - title: DestinationV1 - type: object - ListDestinationsV1Input: - description: Loads all Destinations connected to the current Workspace. - properties: {} - required: - - pagination - title: ListDestinationsV1Input - type: object - ListDestinationsV1Output: - description: Returns all Destinations connected to the current Workspace. - example: - pagination: null - destinations: - - sourceId: sourceId - settings: - key: "" - metadata: null - name: name - id: id - enabled: true - - sourceId: sourceId - settings: - key: "" - metadata: null - name: name - id: id - enabled: true - properties: - destinations: - description: The list that contains the Destinations connected to the Workspace. - items: - $ref: '#/components/schemas/DestinationV1' - title: destinations - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - destinations - - pagination - title: ListDestinationsV1Output - type: object - GetDestinationV1Input: - description: Looks up a single Destination by its id. - properties: {} - required: - - destinationId - title: GetDestinationV1Input - type: object - GetDestinationV1Output: - description: Returns a single Destination by its id. - example: - destination: null - properties: - destination: - $ref: '#/components/schemas/destination' - required: - - destination - title: GetDestinationV1Output - type: object - DeleteDestinationV1Input: - description: Deletes a single Destination by its id. - properties: {} - required: - - destinationId - title: DeleteDestinationV1Input - type: object - DeleteDestinationV1Output: - description: Returns the status of a Destination deletion. - example: - status: SUCCESS - properties: - status: - description: The status of the Warehouse deletion operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteDestinationV1Output - type: object - UpdateDestinationV1Output: - description: Returns the updated Destination. - example: - destination: null - properties: - destination: - $ref: '#/components/schemas/destination_1' - required: - - destination - title: UpdateDestinationV1Output - type: object - UpdateDestinationV1Input: - description: Updates a single Destination by its id. - properties: - name: - description: "Defines the display name of the Destination.\n\nConfig API\ - \ note: equal to `displayName`." - nullable: true - title: name - type: string - enabled: - description: Whether this Destination should receive data. - title: enabled - type: boolean - settings: - additionalProperties: true - description: "An optional object that contains settings for the Destination\ - \ based on the \"required\" and \"advanced\" settings present\nin the\ - \ Destination metadata.\n\nConfig API note: equal to `config`." - title: settings - type: object - required: - - destinationId - title: UpdateDestinationV1Input - type: object - CreateDestinationV1Output: - description: Creates a new Destination. - example: - destination: null - properties: - destination: - $ref: '#/components/schemas/destination_2' - required: - - destination - title: CreateDestinationV1Output - type: object - CreateDestinationV1Input: - description: Creates a new Destination. - properties: - sourceId: - description: "The id of the Source to connect to this Destination instance.\n\ - \nConfig API note: analogous to `parent`." - title: sourceId - type: string - metadataId: - description: The id of the metadata to link to the new Destination. - title: metadataId - type: string - enabled: - description: Whether this Destination should receive data. - title: enabled - type: boolean - name: - description: "Defines the display name of the Destination.\n\nConfig API\ - \ note: equal to `displayName`." - title: name - type: string - settings: - additionalProperties: true - description: "An object that contains settings for the Destination based\ - \ on the \"required\" and \"advanced\" settings present in the\nDestination\ - \ metadata.\n\nConfig API note: equal to `config`." - title: settings - type: object - required: - - metadataId - - settings - - sourceId - title: CreateDestinationV1Input - type: object - EchoAlphaInput: - description: "EchoAlphaInput and EchoAlphaOutput are needed by unit tests in\ - \ the generated Go code.\n\nIf you change these, make sure `make clients`\ - \ works locally, and generates the Go client correctly.\nEcho request with\ - \ options." - properties: {} - title: EchoAlphaInput - type: object - EchoAlphaOutput: - description: Echo response. - example: - headers: - key: "" - method: get - message: message - properties: - method: - description: "The HTTP method used for this round-trip.\n\nCurrently, this\ - \ endpoint supports only `get` and `post` methods." - enum: - - get - - post - title: method - type: string - message: - description: The string passed in the `message` input field. - title: message - type: string - headers: - additionalProperties: true - description: The request's HTTP headers. - title: headers - type: object - required: - - headers - - message - - method - title: EchoAlphaOutput - type: object - EchoV1Input: - description: Echo request with options. - properties: {} - title: EchoV1Input - type: object - EchoV1Output: - description: Echo response. - properties: - method: - description: "The HTTP method used for this round-trip.\n\nCurrently, this\ - \ endpoint supports only `get` and `post` methods." - enum: - - get - - post - title: method - type: string - message: - description: The string passed in the `message` input field. - title: message - type: string - headers: - additionalProperties: true - description: The request's HTTP headers. - title: headers - type: object - required: - - headers - - message - - method - title: EchoV1Output - type: object - GenerateUploadURLForEdgeFunctionsAlphaInput: - description: Input for GenerateSignedUrl. - properties: {} - required: - - sourceId - title: GenerateUploadURLForEdgeFunctionsAlphaInput - type: object - GenerateUploadURLForEdgeFunctionsAlphaOutput: - description: Output for GenerateSignedUrl. - example: - uploadURL: uploadURL - properties: - uploadURL: - description: A temporary URL that can be used to upload your Edge Functions - bundle. Expires in 15 minutes. - title: uploadURL - type: string - required: - - uploadURL - title: GenerateUploadURLForEdgeFunctionsAlphaOutput - type: object - CreateEdgeFunctionsAlphaInput: - description: Input for CreateEdgeFunctions. - properties: - uploadURL: - description: The id of the Source associated with this Edge Function. - title: uploadURL - type: string - required: - - sourceId - - uploadURL - title: CreateEdgeFunctionsAlphaInput - type: object - CreateEdgeFunctionsAlphaOutput: - description: Output for CreateEdgeFunctions. - example: - edgeFunctions: null - properties: - edgeFunctions: - $ref: '#/components/schemas/edgeFunctions' - required: - - edgeFunctions - title: CreateEdgeFunctionsAlphaOutput - type: object - GetLatestFromEdgeFunctionsAlphaInput: - description: Input for GetLatestFromEdgeFunctions. - properties: {} - required: - - sourceId - title: GetLatestFromEdgeFunctionsAlphaInput - type: object - GetLatestFromEdgeFunctionsAlphaOutput: - description: Output for GetLatestFromEdgeFunctions. - example: - edgeFunctions: null - properties: - edgeFunctions: - $ref: '#/components/schemas/edgeFunctions_1' - required: - - edgeFunctions - title: GetLatestFromEdgeFunctionsAlphaOutput - type: object - DisableEdgeFunctionsAlphaInput: - description: Input for DisableEdgeFunctions. - properties: {} - required: - - sourceId - title: DisableEdgeFunctionsAlphaInput - type: object - DisableEdgeFunctionsAlphaOutput: - description: Output for DisableEdgeFunctions. - example: - edgeFunctions: null - properties: - edgeFunctions: - $ref: '#/components/schemas/edgeFunctions_1' - required: - - edgeFunctions - title: DisableEdgeFunctionsAlphaOutput - type: object - EdgeFunctionsAlpha: - description: Represents an Edge Function bundle. - properties: - id: - description: The Edge Function id. - title: id - type: string - sourceId: - description: The Source id. - title: sourceId - type: string - createdAt: - description: Creation date. - title: createdAt - type: string - createdBy: - description: Creating user's id. - title: createdBy - type: string - downloadURL: - description: The CDN URL that can be used to fetch your latest EdgeFunctions - bundle. - title: downloadURL - type: string - version: - description: Revision number associated with the latest Edge Function. - title: version - type: number - required: - - createdAt - - createdBy - - downloadURL - - id - - sourceId - - version - title: EdgeFunctionsAlpha - type: object - FunctionSettingV1: - properties: - name: - description: The name of this Function. - title: name - type: string - label: - description: The label for this Function. - title: label - type: string - description: - description: A description of this Function. - title: description - type: string - type: - description: The Function type. - enum: - - ARRAY - - BOOLEAN - - STRING - - TEXT_MAP - title: type - type: string - required: - description: Whether this Function is required. - title: required - type: boolean - sensitive: - description: Whether this Function contains sensitive information. - title: sensitive - type: boolean - required: - - description - - label - - name - - required - - sensitive - - type - title: FunctionSettingV1 - type: object - FunctionV1: - description: Represents a Function. - properties: - id: - description: An identifier for this Function. - title: id - type: string - resourceType: - description: "The Function type.\n\nConfig API note: equal to `type`." - enum: - - DESTINATION - - SOURCE - title: resourceType - type: string - createdAt: - description: The time this Function was created. - title: createdAt - type: string - createdBy: - description: The id of the user who created this Function. - title: createdBy - type: string - code: - description: The Function code. - title: code - type: string - deployedAt: - description: The time of this Function's last deployment. - nullable: true - title: deployedAt - type: string - settings: - description: The list of settings for this Function. - items: - $ref: '#/components/schemas/FunctionSettingV1' - title: settings - type: array - displayName: - description: A display name for this Function. - title: displayName - type: string - description: - description: A description for this Function. - title: description - type: string - logoUrl: - description: The URL of the logo for this Function. - title: logoUrl - type: string - previewWebhookUrl: - description: The preview webhook URL for this Function. - title: previewWebhookUrl - type: string - batchMaxCount: - description: The max count of the batch for this Function. - title: batchMaxCount - type: number - catalogId: - description: The catalog id of this Function. - title: catalogId - type: string - isLatestVersion: - description: Whether the deployment of this Function is the latest version. - title: isLatestVersion - type: boolean - title: FunctionV1 - type: object - ListFunctionItemV1: - description: Represents a Function in a list. - example: - createdAt: createdAt - catalogId: catalogId - createdBy: createdBy - displayName: displayName - description: description - id: id - logoUrl: logoUrl - resourceType: DESTINATION - properties: - id: - description: An identifier for this Function. - title: id - type: string - resourceType: - description: "The Function type.\n\nConfig API note: equal to `type`." - enum: - - DESTINATION - - SOURCE - title: resourceType - type: string - createdAt: - description: The time this Function was created. - title: createdAt - type: string - createdBy: - description: The id of the user who created this Function. - title: createdBy - type: string - displayName: - description: A display name for this Function. - title: displayName - type: string - description: - description: A description for this Function. - title: description - type: string - logoUrl: - description: The URL of the logo for this Function. - title: logoUrl - type: string - catalogId: - description: The catalog id of this Function. - title: catalogId - type: string - title: ListFunctionItemV1 - type: object - GetFunctionV1Input: - description: Gets a single Function. - properties: {} - required: - - functionId - title: GetFunctionV1Input - type: object - GetFunctionV1Output: - description: Gets a single Function. - example: - function: null - properties: - function: - $ref: '#/components/schemas/function' - required: - - function - title: GetFunctionV1Output - type: object - ListFunctionsV1Input: - description: Lists all Functions in a Workspace. - properties: {} - required: - - pagination - title: ListFunctionsV1Input - type: object - ListFunctionsV1Output: - description: Lists Functions in a Workspace. - example: - pagination: null - functions: - - createdAt: createdAt - catalogId: catalogId - createdBy: createdBy - displayName: displayName - description: description - id: id - logoUrl: logoUrl - resourceType: DESTINATION - - createdAt: createdAt - catalogId: catalogId - createdBy: createdBy - displayName: displayName - description: description - id: id - logoUrl: logoUrl - resourceType: DESTINATION - properties: - functions: - description: An array of Functions. - items: - $ref: '#/components/schemas/ListFunctionItemV1' - title: functions - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - functions - - pagination - title: ListFunctionsV1Output - type: object - CreateFunctionV1Input: - description: Creates a Function. - properties: - code: - description: The Function code. - title: code - type: string - settings: - description: The list of settings for this Function. - items: - $ref: '#/components/schemas/FunctionSettingV1' - title: settings - type: array - displayName: - description: |- - A display name for this Function. - - Note that Destination Functions append the Workspace to the display name. - title: displayName - type: string - logoUrl: - description: The URL of the logo for this Function. - title: logoUrl - type: string - resourceType: - description: "The Function type.\n\nConfig API note: equal to `type`." - enum: - - DESTINATION - - SOURCE - title: resourceType - type: string - description: - description: A description for this Function. - title: description - type: string - required: - - code - - displayName - - resourceType - title: CreateFunctionV1Input - type: object - CreateFunctionV1Output: - description: Create a Function. - example: - function: null - properties: - function: - $ref: '#/components/schemas/function_1' - required: - - function - title: CreateFunctionV1Output - type: object - DeleteFunctionV1Input: - description: Delete a single Function. - properties: {} - required: - - functionId - title: DeleteFunctionV1Input - type: object - DeleteFunctionV1Output: - description: Delete a single Function. - example: - status: SUCCESS - properties: - status: - description: The status of the operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteFunctionV1Output - type: object - UpdateFunctionV1Input: - description: Update a Function. - properties: - code: - description: The Function code. - title: code - type: string - settings: - description: The list of settings for this Function. - items: - $ref: '#/components/schemas/FunctionSettingV1' - title: settings - type: array - displayName: - description: A display name for this Function. - title: displayName - type: string - logoUrl: - description: A logo for this Function. - title: logoUrl - type: string - description: - description: A description for this Function. - title: description - type: string - required: - - functionId - title: UpdateFunctionV1Input - type: object - UpdateFunctionV1Output: - description: Create a Function. - example: - function: null - properties: - function: - $ref: '#/components/schemas/function_2' - required: - - function - title: UpdateFunctionV1Output - type: object - CreateFunctionDeploymentV1Input: - description: Updates the deployment for a Source Function instance. - properties: {} - required: - - functionId - title: CreateFunctionDeploymentV1Input - type: object - CreateFunctionDeploymentV1Output: - description: Updates the deployment for a Source Function instance. - example: - functionDeployment: - status: SUCCESS - properties: - functionDeployment: - $ref: '#/components/schemas/functionDeployment' - required: - - functionDeployment - title: CreateFunctionDeploymentV1Output - type: object - ResourceV1: - description: Represents a permission's resource. - properties: - id: - description: The id of this resource. - title: id - type: string - type: - description: The kind of resource this permission applies to. - enum: - - FUNCTION - - SOURCE - - SPACE - - WAREHOUSE - - WORKSPACE - title: type - type: string - required: - - id - - type - title: ResourceV1 - type: object - InvitePermissionV1: - description: Defines a permission to apply to the user in an invite. - properties: - roleId: - description: The id of the role. - title: roleId - type: string - resources: - description: The resources to grant the invited users access to. - items: - $ref: '#/components/schemas/ResourceV1' - title: resources - type: array - labels: - description: The labels that determine which resources to grant users access - to. - items: - $ref: '#/components/schemas/AllowedLabelBeta' - title: labels - type: array - required: - - roleId - title: InvitePermissionV1 - type: object - InviteV1: - description: Defines an invitation to join a Workspace. - properties: - email: - description: The invited user's email to attach the permissions to. - title: email - type: string - permissions: - description: The permissions to attach to the invited user. - items: - $ref: '#/components/schemas/InvitePermissionV1' - title: permissions - type: array - required: - - email - title: InviteV1 - type: object - CreateInvitesV1Input: - description: Invites a user to a Workspace with specified permissions. - properties: - invites: - description: The list of invites. - items: - $ref: '#/components/schemas/InviteV1' - title: invites - type: array - required: - - invites - title: CreateInvitesV1Input - type: object - CreateInvitesV1Output: - description: Returns the emails of the invited users. - example: - emails: - - emails - - emails - properties: - emails: - description: The list of emails invited to the Workspace. - items: - type: string - title: emails - type: array - required: - - emails - title: CreateInvitesV1Output - type: object - DeleteInvitesV1Input: - description: Removes pre-existing invitations to join a Workspace. - properties: {} - required: - - emails - title: DeleteInvitesV1Input - type: object - DeleteInvitesV1Output: - description: Returns the status of the removal operation. - example: - status: SUCCESS - properties: - status: - description: The status of the invite deletion operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteInvitesV1Output - type: object - ListInvitesV1Input: - description: Retrieves a list of existing invitations to join a Workspace. - properties: {} - required: - - pagination - title: ListInvitesV1Input - type: object - ListInvitesV1Output: - description: Returns the list of invites. - example: - pagination: null - invites: - - invites - - invites - properties: - invites: - description: The list of invites. - items: - type: string - title: invites - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - invites - - pagination - title: ListInvitesV1Output - type: object - PermissionResourceV1: - description: The most basic representation of a resource belonging to a set - of permissions. - example: - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - id: - description: The id of this resource. - title: id - type: string - type: - description: The type for this resource. - enum: - - FUNCTION - - SOURCE - - SPACE - - WAREHOUSE - - WORKSPACE - title: type - type: string - labels: - description: The labels that further refine access to this resource. Labels - are exclusive to Workspace-level permissions. - items: - $ref: '#/components/schemas/AllowedLabelBeta' - title: labels - type: array - required: - - id - - type - title: PermissionResourceV1 - type: object - PermissionV1: - description: "A registered set of permissions for a subject, extending a role\ - \ to a resource." - example: - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - roleName: - description: The name of the role associated with this permission. - title: roleName - type: string - roleId: - description: The id of the role associated with this permission. - title: roleId - type: string - resources: - description: The resources associated with this permission. - items: - $ref: '#/components/schemas/PermissionResourceV1' - title: resources - type: array - labels: - description: The labels to attach to this permission. - items: - $ref: '#/components/schemas/AllowedLabelBeta' - title: labels - type: array - required: - - resources - - roleId - - roleName - title: PermissionV1 - type: object - MinimalUserGroupV1: - description: The least amount of information needed to identify a user group. - example: - name: name - id: id - properties: - id: - description: The id of the user group. - title: id - type: string - name: - description: The name of the user group. - title: name - type: string - required: - - id - - name - title: MinimalUserGroupV1 - type: object - DeleteUsersV1Input: - description: Removes users from a Workspace. - properties: {} - required: - - userIds - title: DeleteUsersV1Input - type: object - DeleteUsersV1Output: - description: Returns the status of the removal operation. - example: - status: SUCCESS - properties: - status: - description: A flag that indicates the status of a successful deletion operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteUsersV1Output - type: object - AccessPermissionV1: - description: A permission governing access to a resource. - example: - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - roleId: - description: The id of the role that applies to this permission. - title: roleId - type: string - roleName: - description: The name of the role that applies to this permission. - title: roleName - type: string - resources: - description: The resources included with this permission. - items: - $ref: '#/components/schemas/PermissionResourceV1' - title: resources - type: array - required: - - resources - - roleId - - roleName - title: AccessPermissionV1 - type: object - PermissionInputV1: - description: "The input for a permission, associated with a resource and/or\ - \ labels." - properties: - roleId: - description: The role id of this permission. - title: roleId - type: string - resources: - description: The resources to link the selected role to. - items: - $ref: '#/components/schemas/PermissionResourceV1' - title: resources - type: array - required: - - resources - - roleId - title: PermissionInputV1 - type: object - AddPermissionsToUserV1Input: - description: Adds a list of permissions to a user. - properties: - permissions: - description: The permissions to add. - items: - $ref: '#/components/schemas/PermissionInputV1' - title: permissions - type: array - title: AddPermissionsToUserV1Input - type: object - AddPermissionsToUserV1Output: - description: "Returns the user's permissions, including the added permissions." - example: - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - permissions: - description: The new permissions. - items: - $ref: '#/components/schemas/AccessPermissionV1' - title: permissions - type: array - required: - - permissions - title: AddPermissionsToUserV1Output - type: object - ReplacePermissionsForUserV1Input: - description: Updates the list of permissions for a user. - properties: - permissions: - description: The permissions to add. - items: - $ref: '#/components/schemas/PermissionInputV1' - title: permissions - type: array - title: ReplacePermissionsForUserV1Input - type: object - ReplacePermissionsForUserV1Output: - description: "Returns the user's permissions, including the updated permissions." - example: - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - permissions: - description: The updated permissions. - items: - $ref: '#/components/schemas/AccessPermissionV1' - title: permissions - type: array - required: - - permissions - title: ReplacePermissionsForUserV1Output - type: object - ListUsersV1Input: - description: Returns a list of users with access to the Workspace. - properties: {} - required: - - pagination - title: ListUsersV1Input - type: object - ListUsersV1Output: - description: Returns the list of users. - example: - pagination: null - users: - - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - name: name - id: id - email: email - - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - name: name - id: id - email: email - properties: - users: - description: The list of users. - items: - $ref: '#/components/schemas/UserV1' - title: users - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - users - title: ListUsersV1Output - type: object - GetUserV1Input: - description: Returns a user. - properties: {} - required: - - userId - title: GetUserV1Input - type: object - GetUserV1Output: - description: Returns the user. - example: - user: null - properties: - user: - $ref: '#/components/schemas/user' - required: - - user - title: GetUserV1Output - type: object - UserV1: - description: A user belonging to a Segment Workspace. - example: - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - name: name - id: id - email: email - properties: - id: - description: "The unique identifier of this user.\n\nConfig API note: analogous\ - \ to `name`." - title: id - type: string - name: - description: The human-readable name of this user. - title: name - type: string - email: - description: The email address associated with this user. - title: email - type: string - permissions: - description: The permissions associated with this user. - items: - $ref: '#/components/schemas/PermissionV1' - title: permissions - type: array - required: - - email - - id - - name - title: UserV1 - type: object - ListUserGroupsFromUserV1Input: - description: Retrieves all user groups the user belongs to. - properties: {} - title: ListUserGroupsFromUserV1Input - type: object - ListUserGroupsFromUserV1Output: - description: Returns all user groups the user belongs to. - example: - pagination: null - groups: - - name: name - id: id - - name: name - id: id - properties: - groups: - description: The user groups that the user belongs to. - items: - $ref: '#/components/schemas/MinimalUserGroupV1' - title: groups - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - groups - - pagination - title: ListUserGroupsFromUserV1Output - type: object - ListRolesV1Input: - description: Returns a list of roles available to apply to permissions for users - in the Workspace. - properties: {} - required: - - pagination - title: ListRolesV1Input - type: object - RoleV1: - description: Represents a role. - example: - name: name - description: description - id: id - properties: - id: - description: The unique identifier of the role. - title: id - type: string - name: - description: The human-readable name of the role. - title: name - type: string - description: - description: The human-readable description of the role. - title: description - type: string - required: - - description - - id - - name - title: RoleV1 - type: object - ListRolesV1Output: - description: Returns the list of roles. - example: - pagination: null - roles: - - name: name - description: description - id: id - - name: name - description: description - id: id - properties: - roles: - description: The list of roles. - items: - $ref: '#/components/schemas/RoleV1' - title: roles - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - roles - title: ListRolesV1Output - type: object - MinimalUserV1: - description: A user belonging to a Segment Workspace. - example: - name: name - id: id - email: email - properties: - id: - description: "The unique identifier of this user.\n\nConfig API note: analogous\ - \ to `name`." - title: id - type: string - name: - description: The human-readable name of this user. - title: name - type: string - email: - description: The email address associated with this user. - title: email - type: string - required: - - email - - id - - name - title: MinimalUserV1 - type: object - CreateUserGroupV1Input: - description: "Creates a user group, used to bundle permissions for its members,\ - \ within a Workspace." - properties: - name: - description: The name of the user group to create. - title: name - type: string - required: - - name - title: CreateUserGroupV1Input - type: object - UserGroupV1: - description: A set of users with a set of shared permissions. - example: - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - memberCount: 0.8008281904610115 - name: name - id: id - properties: - memberCount: - description: The number of members in the user group. - title: memberCount - type: number - permissions: - description: The permissions associated with the user group. - items: - $ref: '#/components/schemas/PermissionV1' - title: permissions - type: array - id: - description: The id of the user group. - title: id - type: string - name: - description: The name of the user group. - title: name - type: string - required: - - id - - memberCount - - name - title: UserGroupV1 - type: object - CreateUserGroupV1Output: - description: Returns the newly created user group. - example: - userGroup: null - properties: - userGroup: - $ref: '#/components/schemas/userGroup' - required: - - userGroup - title: CreateUserGroupV1Output - type: object - AddPermissionsToUserGroupV1Input: - description: Adds a list of permissions to a user group. - properties: - permissions: - description: The permissions to add. - items: - $ref: '#/components/schemas/PermissionInputV1' - title: permissions - type: array - title: AddPermissionsToUserGroupV1Input - type: object - AddPermissionsToUserGroupV1Output: - description: "Returns the group's permissions, including the added permissions." - example: - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - permissions: - description: The updated set of permissions assigned to the user group. - items: - $ref: '#/components/schemas/AccessPermissionV1' - title: permissions - type: array - required: - - permissions - title: AddPermissionsToUserGroupV1Output - type: object - AddUsersToUserGroupV1Input: - description: Adds a list of users and invites to a user group. - properties: - emails: - description: The email addresses of the users and invites to add. - items: - type: string - title: emails - type: array - title: AddUsersToUserGroupV1Input - type: object - AddUsersToUserGroupV1Output: - description: Returns the updated user group. - example: - userGroup: null - properties: - userGroup: - $ref: '#/components/schemas/userGroup_1' - required: - - userGroup - title: AddUsersToUserGroupV1Output - type: object - DeleteUserGroupV1Input: - description: Deletes a user group with a given group id from a Workspace. - properties: {} - required: - - userGroupId - title: DeleteUserGroupV1Input - type: object - DeleteUserGroupV1Output: - description: Returns the status of the completed deletion operation. - example: - status: SUCCESS - properties: - status: - description: A flag indicating the status of a successful deletion operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteUserGroupV1Output - type: object - GetUserGroupV1Input: - description: Looks up a user group within a Workspace. - properties: {} - required: - - userGroupId - title: GetUserGroupV1Input - type: object - GetUserGroupV1Output: - description: Returns a user group with the given id. - example: - userGroup: null - properties: - userGroup: - $ref: '#/components/schemas/userGroup_2' - required: - - userGroup - title: GetUserGroupV1Output - type: object - UpdateUserGroupV1Input: - description: Updates a user group with a given id. - properties: - name: - description: The intended value to rename the user group to. - title: name - type: string - title: UpdateUserGroupV1Input - type: object - UpdateUserGroupV1Output: - description: Returns the updated user group. - example: - userGroup: null - properties: - userGroup: - $ref: '#/components/schemas/userGroup_3' - required: - - userGroup - title: UpdateUserGroupV1Output - type: object - ListInvitesFromUserGroupV1Input: - description: Looks up the invitees to a user group within a Workspace. - properties: {} - title: ListInvitesFromUserGroupV1Input - type: object - ListInvitesFromUserGroupV1Output: - description: Returns the emails of invitees to a user group with the given group - id. - example: - emails: - - emails - - emails - pagination: null - properties: - emails: - description: The emails of the invitees to the user group. - items: - type: string - title: emails - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - emails - - pagination - title: ListInvitesFromUserGroupV1Output - type: object - ReplaceUsersInUserGroupV1Input: - description: Replace a user group's list of users and invites with a new one. - properties: - emails: - description: The email addresses of the users and invites to replace. - items: - type: string - title: emails - type: array - title: ReplaceUsersInUserGroupV1Input - type: object - ReplaceUsersInUserGroupV1Output: - description: Returns the updated user group. - example: - userGroup: null - properties: - userGroup: - $ref: '#/components/schemas/userGroup_1' - required: - - userGroup - title: ReplaceUsersInUserGroupV1Output - type: object - ListUserGroupsV1Input: - description: Loads all user groups for a Workspace. - properties: {} - required: - - pagination - title: ListUserGroupsV1Input - type: object - ListUserGroupsV1Output: - description: Returns a list of user groups with the given Workspace id. - example: - userGroups: - - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - memberCount: 0.8008281904610115 - name: name - id: id - - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - memberCount: 0.8008281904610115 - name: name - id: id - pagination: null - properties: - userGroups: - description: The user group returned from the query. - items: - $ref: '#/components/schemas/UserGroupV1' - title: userGroups - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - userGroups - title: ListUserGroupsV1Output - type: object - RemoveUsersFromUserGroupV1Input: - description: Removes users or invites from a user group. - properties: {} - title: RemoveUsersFromUserGroupV1Input - type: object - RemoveUsersFromUserGroupV1Output: - description: Returns the status of the removal operation. - example: - status: SUCCESS - properties: - status: - description: The status of the user removal from user group operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: RemoveUsersFromUserGroupV1Output - type: object - ReplacePermissionsForUserGroupV1Input: - description: Updates the list of permissions for a user group. - properties: - permissions: - description: The permissions to replace with. - items: - $ref: '#/components/schemas/PermissionInputV1' - title: permissions - type: array - title: ReplacePermissionsForUserGroupV1Input - type: object - ReplacePermissionsForUserGroupV1Output: - description: "Returns the user group's permissions, including the updated permissions." - example: - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - permissions: - description: The updated permissions. - items: - $ref: '#/components/schemas/AccessPermissionV1' - title: permissions - type: array - required: - - permissions - title: ReplacePermissionsForUserGroupV1Output - type: object - ListUsersFromUserGroupV1Input: - description: Looks up the members of a user group within a Workspace. - properties: {} - title: ListUsersFromUserGroupV1Input - type: object - ListUsersFromUserGroupV1Output: - description: Returns the members of a user group with the given group id. - example: - pagination: null - users: - - name: name - id: id - email: email - - name: name - id: id - email: email - properties: - users: - description: The users of the user group. - items: - $ref: '#/components/schemas/MinimalUserV1' - title: users - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - users - title: ListUsersFromUserGroupV1Output - type: object - IntegrationOptionBeta: - description: "Describes an Integration option field required to set up a Segment\ - \ Integration such as Sources, Destinations, or\nwarehouses." - example: - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - properties: - name: - description: The name identifying this option in the context of a Segment - Integration. - title: name - type: string - type: - description: "Defines the type for this option in the schema. Types are\ - \ most commonly strings, but may also represent other\nprimitive types,\ - \ such as booleans, and numbers, as well as complex types, such as objects\ - \ and arrays." - title: type - type: string - required: - description: Whether this is a required option when setting up the Integration. - title: required - type: boolean - description: - description: An optional short text description of the field. - title: description - type: string - defaultValue: - description: An optional default value for the field. - title: defaultValue - label: - description: An optional label for this field. - title: label - type: string - required: - - name - - required - - type - title: IntegrationOptionBeta - type: object - LabelAlpha: - description: "A label lets Workspace owners assign permissions to users, and\ - \ grant these users access to groups.\n\nA Workspace owner may use labels\ - \ to grant users access to groups of resources.\n\nWhen you add a label to\ - \ a Source or Personas Spaces, any users granted access to that label gain\ - \ access to those\nresources.\n\nAll Workspaces include labels for Dev (development)\ - \ and Prod (production) environments. On top of those, Free and\nTeam plan\ - \ customers may create up to five labels.\n\nCustomers with the Enterprise\ - \ pricing package may create an unlimited number of labels." - example: - description: description - value: value - key: key - properties: - key: - description: The key that represents the name of this label. - title: key - type: string - value: - description: The value associated with the key of this label. - title: value - type: string - description: - description: An optional description of the purpose of this label. - title: description - type: string - required: - - key - - value - title: LabelAlpha - type: object - ListLabelsAlphaInput: - description: Retrieves all available labels for the current Workspace. - title: ListLabelsAlphaInput - type: object - ListLabelsAlphaOutput: - description: Returns all available labels for the current Workspace. - example: - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - labels: - description: All labels associated with the current Workspace. - items: - $ref: '#/components/schemas/LabelAlpha' - title: labels - type: array - required: - - labels - title: ListLabelsAlphaOutput - type: object - CreateLabelAlphaInput: - description: Creates a new label in the current Workspace. - properties: - label: - $ref: '#/components/schemas/label' - required: - - label - title: CreateLabelAlphaInput - type: object - CreateLabelAlphaOutput: - description: Result of creating a new label in the current Workspace. - example: - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - labels: - description: All labels associated with the current Workspace. - items: - $ref: '#/components/schemas/LabelAlpha' - title: labels - type: array - required: - - labels - title: CreateLabelAlphaOutput - type: object - DeleteLabelAlphaInput: - description: Deletes an existing label in the current Workspace. - properties: {} - required: - - key - title: DeleteLabelAlphaInput - type: object - DeleteLabelAlphaOutput: - description: Returns the status of a label deletion. - example: - status: SUCCESS - properties: - status: - description: The status of the label deletion operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteLabelAlphaOutput - type: object - AddLabelsToSourceAlphaInput: - description: Applies an existing label to an existing Source. - properties: - labels: - description: The labels to associate with a Source. - items: - $ref: '#/components/schemas/LabelAlpha' - title: labels - type: array - required: - - labels - title: AddLabelsToSourceAlphaInput - type: object - AddLabelsToSourceAlphaOutput: - description: Applies an existing label to an existing Source. - example: - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - labels: - description: All labels applied to the Source. - items: - $ref: '#/components/schemas/LabelAlpha' - title: labels - type: array - required: - - labels - title: AddLabelsToSourceAlphaOutput - type: object - ReplaceLabelsInSourceAlphaInput: - description: Replaces all labels in a Source with a list of new labels. - properties: - labels: - description: The list of labels to replace in the Source. - items: - $ref: '#/components/schemas/LabelAlpha' - title: labels - type: array - required: - - labels - title: ReplaceLabelsInSourceAlphaInput - type: object - ReplaceLabelsInSourceAlphaOutput: - description: Response from replacing a list of labels in a Source. - example: - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - labels: - description: All labels replaced in the Source. - items: - $ref: '#/components/schemas/LabelAlpha' - title: labels - type: array - required: - - labels - title: ReplaceLabelsInSourceAlphaOutput - type: object - LabelV1: - description: "A label lets Workspace owners assign permissions to users, and\ - \ grant these users access to groups.\n\nA Workspace owner may use labels\ - \ to grant users access to groups of resources.\n\nWhen you add a label to\ - \ a Source or Personas Spaces, any users granted access to that label gain\ - \ access to those\nresources.\n\nAll Workspaces include labels for Dev (development)\ - \ and Prod (production) environments. On top of those, Free and\nTeam plan\ - \ customers may create up to five labels.\n\nCustomers with the Enterprise\ - \ pricing package may create an unlimited number of labels." - example: - description: description - value: value - key: key - properties: - key: - description: The key that represents the name of this label. - title: key - type: string - value: - description: The value associated with the key of this label. - title: value - type: string - description: - description: An optional description of the purpose of this label. - title: description - type: string - required: - - key - - value - title: LabelV1 - type: object - ListLabelsV1Input: - description: Retrieves all available labels for the current Workspace. - title: ListLabelsV1Input - type: object - ListLabelsV1Output: - description: Returns all available labels for the current Workspace. - properties: - labels: - description: All labels associated with the current Workspace. - items: - $ref: '#/components/schemas/LabelV1' - title: labels - type: array - required: - - labels - title: ListLabelsV1Output - type: object - CreateLabelV1Input: - description: Creates a new label in the current Workspace. - properties: - label: - $ref: '#/components/schemas/label_1' - required: - - label - title: CreateLabelV1Input - type: object - CreateLabelV1Output: - description: Result of creating a new label in the current Workspace. - properties: - label: - $ref: '#/components/schemas/label_2' - required: - - label - title: CreateLabelV1Output - type: object - DeleteLabelV1Input: - description: Deletes an existing label in the current Workspace. - properties: {} - title: DeleteLabelV1Input - type: object - DeleteLabelV1Output: - description: Returns the status of a label deletion. - properties: - status: - description: The status of the label deletion operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteLabelV1Output - type: object - AddLabelsToSourceV1Input: - description: Applies an existing label to an existing Source. - properties: - labels: - description: The labels to associate with a Source. - items: - $ref: '#/components/schemas/LabelV1' - title: labels - type: array - title: AddLabelsToSourceV1Input - type: object - AddLabelsToSourceV1Output: - description: Applies an existing label to an existing Source. - properties: - labels: - description: All labels applied to the Source. - items: - $ref: '#/components/schemas/LabelV1' - title: labels - type: array - required: - - labels - title: AddLabelsToSourceV1Output - type: object - ReplaceLabelsInSourceV1Input: - description: Replaces all labels in a Source with a list of new labels. - properties: - labels: - description: The list of labels to replace in the Source. - items: - $ref: '#/components/schemas/LabelV1' - title: labels - type: array - title: ReplaceLabelsInSourceV1Input - type: object - ReplaceLabelsInSourceV1Output: - description: Response from replacing a list of labels in a Source. - properties: - labels: - description: All labels replaced in the Source. - items: - $ref: '#/components/schemas/LabelV1' - title: labels - type: array - required: - - labels - title: ReplaceLabelsInSourceV1Output - type: object - LogosBeta: - description: Represents a logo. - properties: - default: - description: The default URL for this logo. - title: default - type: string - mark: - description: The logo mark. - nullable: true - title: mark - type: string - alt: - description: The alternative text for this logo. - nullable: true - title: alt - type: string - required: - - default - title: LogosBeta - type: object - EventSourceV1: - description: Source represents a Segment Source. - properties: - id: - description: The id of the Source where the events came from. - title: id - type: string - name: - description: "The name of the Source, if applicable." - title: name - type: string - slug: - description: "The slug of the Source, if applicable." - title: slug - type: string - required: - - id - title: EventSourceV1 - type: object - SourceEventVolumeV1: - description: |- - SourceEventVolume represents a time series of event volume for a Workspace - broken down by the dimensions which the customer specifies (optional - parameters). - example: - total: 0.8008281904610115 - series: - - count: 6.027456183070403 - time: time - - count: 6.027456183070403 - time: time - eventName: eventName - source: null - eventType: eventType - properties: - source: - $ref: '#/components/schemas/source' - eventName: - description: "The name of the event, if applicable." - title: eventName - type: string - eventType: - description: "The event type, if applicable." - title: eventType - type: string - total: - description: The total count for all events in the requested time frame. - title: total - type: number - series: - description: |- - A list of the event counts broken down by the requested - granularity. - items: - $ref: '#/components/schemas/SourceEventVolumeDatapointV1' - title: series - type: array - required: - - series - - source - - total - title: SourceEventVolumeV1 - type: object - SourceEventVolumeDatapointV1: - description: |- - SourceEventVolumeDatapoint represents an individual timestamp/event count - pair corresponding to a window of time designated by the granularity. - example: - count: 6.027456183070403 - time: time - properties: - time: - description: |- - The timestamp that corresponds to the beginning of the window given - by the requested granularity. - title: time - type: string - count: - description: "The number of valid events Segment received in the given window,\n\ - after the events completed the validation process." - title: count - type: number - required: - - count - - time - title: SourceEventVolumeDatapointV1 - type: object - GetEventsVolumeFromWorkspaceV1Input: - description: GetEventsVolumeFromWorkspaceV1Input represents the arguments given - to the API. - properties: {} - title: GetEventsVolumeFromWorkspaceV1Input - type: object - GetEventsVolumeFromWorkspaceV1Output: - description: GetEventsVolumeFromWorkspaceV1Output represents the results given - the input query. - example: - result: - - total: 0.8008281904610115 - series: - - count: 6.027456183070403 - time: time - - count: 6.027456183070403 - time: time - eventName: eventName - source: null - eventType: eventType - - total: 0.8008281904610115 - series: - - count: 6.027456183070403 - time: time - - count: 6.027456183070403 - time: time - eventName: eventName - source: null - eventType: eventType - pagination: null - properties: - result: - description: "The resultant list of series broken down by the\ndimensions\ - \ requested over the time frame requested and ordered by the total count\ - \ of events in all series.\nNote: The limit of entries returned is 5000." - items: - $ref: '#/components/schemas/SourceEventVolumeV1' - title: result - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - result - title: GetEventsVolumeFromWorkspaceV1Output - type: object - DestinationStatusV1: - description: DestinationStatus represents status of each Destination in a stream. - example: - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - properties: - name: - title: name - type: string - id: - title: id - type: string - status: - enum: - - FAILED - - FINISHED - - INITIALIZED - - INVALID - - NOT_SUPPORTED - - PARTIAL_SUCCESS - - RUNNING - title: status - type: string - errString: - title: errString - type: string - finishedAt: - title: finishedAt - type: string - required: - - errString - - finishedAt - - id - - name - - status - title: DestinationStatusV1 - type: object - StreamStatusV1: - description: StreamStatus represents status of each stream including all the - Destinations corresponding to the stream. - example: - id: id - destinationStatus: - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - properties: - id: - title: id - type: string - destinationStatus: - items: - $ref: '#/components/schemas/DestinationStatusV1' - title: destinationStatus - type: array - required: - - destinationStatus - - id - title: StreamStatusV1 - type: object - RegulationListEntryV1: - example: - createdAt: createdAt - subjects: - - subjects - - subjects - id: id - subjectType: subjectType - status: FAILED - finishedAt: finishedAt - properties: - id: - title: id - type: string - subjectType: - title: subjectType - type: string - subjects: - items: - type: string - title: subjects - type: array - status: - enum: - - FAILED - - FINISHED - - INITIALIZED - - INVALID - - NOT_SUPPORTED - - PARTIAL_SUCCESS - - RUNNING - title: status - type: string - createdAt: - title: createdAt - type: string - finishedAt: - title: finishedAt - type: string - required: - - createdAt - - id - - status - - subjectType - - subjects - title: RegulationListEntryV1 - type: object - DeleteRegulationV1Input: - description: The input to delete a regulate request. - properties: {} - required: - - regulateId - title: DeleteRegulationV1Input - type: object - DeleteRegulationV1Output: - description: The output of the delete regulation call. - example: - status: SUCCESS - properties: - status: - description: The status of the deletion call. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteRegulationV1Output - type: object - CreateWorkspaceRegulationV1Input: - description: The input to create a Workspace regulation. - properties: - regulationType: - description: The regulation type to create. - enum: - - BULK_DELETE_ONLY - - DELETE_INTERNAL - - DELETE_ONLY - - SUPPRESS_ONLY - - SUPPRESS_WITH_DELETE - - UNSUPPRESS - title: regulationType - type: string - subjectType: - description: The subject type. Use `objectId` for Cloud Source regulations. - enum: - - OBJECT_ID - - USER_ID - title: subjectType - type: string - subjectIds: - description: "The user or object ids of the subjects to regulate.\n\nConfig\ - \ API note: equal to `parent` but allows an array." - items: - type: string - title: subjectIds - type: array - required: - - regulationType - - subjectIds - - subjectType - title: CreateWorkspaceRegulationV1Input - type: object - CreateWorkspaceRegulationV1Output: - description: The output of a create Workspace regulation call. - example: - regulateId: regulateId - properties: - regulateId: - description: The id of the created regulation. - title: regulateId - type: string - required: - - regulateId - title: CreateWorkspaceRegulationV1Output - type: object - GetRegulationV1Input: - description: The input to get a regulate request. - properties: {} - required: - - regulateId - title: GetRegulationV1Input - type: object - GetRegulationV1Output: - description: The regulate request returned. - example: - regulation: - createdAt: createdAt - id: id - streamStatus: - - id: id - destinationStatus: - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - - id: id - destinationStatus: - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - overallStatus: FAILED - workspaceId: workspaceId - finishedAt: finishedAt - properties: - regulation: - $ref: '#/components/schemas/regulation' - required: - - regulation - title: GetRegulationV1Output - type: object - ListWorkspaceRegulationsV1Input: - description: Input to list all Workspace-scoped regulations in a given Workspace. - properties: {} - title: ListWorkspaceRegulationsV1Input - type: object - ListWorkspaceRegulationsV1Output: - description: Output of all Workspace-scoped regulations in a given Workspace. - example: - pagination: null - regulations: - - createdAt: createdAt - subjects: - - subjects - - subjects - id: id - subjectType: subjectType - status: FAILED - finishedAt: finishedAt - - createdAt: createdAt - subjects: - - subjects - - subjects - id: id - subjectType: subjectType - status: FAILED - finishedAt: finishedAt - properties: - regulations: - description: List of Workspace-scoped regulations with statuses. - items: - $ref: '#/components/schemas/RegulationListEntryV1' - title: regulations - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - regulations - title: ListWorkspaceRegulationsV1Output - type: object - CreateSourceRegulationV1Input: - description: The input to create a Source-scoped regulation. - properties: - regulationType: - description: The regulation type to create. - enum: - - BULK_DELETE_ONLY - - DELETE_INTERNAL - - DELETE_ONLY - - SUPPRESS_ONLY - - SUPPRESS_WITH_DELETE - - UNSUPPRESS - title: regulationType - type: string - subjectType: - description: The subject type. - enum: - - USER_ID - title: subjectType - type: string - subjectIds: - description: "The user or object ids of the subjects to regulate.\n\nConfig\ - \ API note: equal to `parent` but allows an array." - items: - type: string - title: subjectIds - type: array - required: - - regulationType - title: CreateSourceRegulationV1Input - type: object - CreateSourceRegulationV1Output: - description: The output of a create Source regulation call. - example: - regulateId: regulateId - properties: - regulateId: - description: The id of the created regulation. - title: regulateId - type: string - required: - - regulateId - title: CreateSourceRegulationV1Output - type: object - CreateCloudSourceRegulationV1Input: - description: The input to create a Cloud Source-scoped regulation. - properties: - regulationType: - description: The regulation type to create. - enum: - - BULK_DELETE_ONLY - - DELETE_INTERNAL - - DELETE_ONLY - - SUPPRESS_ONLY - - SUPPRESS_WITH_DELETE - - UNSUPPRESS - title: regulationType - type: string - subjectType: - description: The subject type. Must be `objectId` for Cloud Sources. - enum: - - OBJECT_ID - title: subjectType - type: string - subjectIds: - description: "The user or object ids of the subjects to regulate.\n\nConfig\ - \ API note: equal to `parent` but allows an array." - items: - type: string - title: subjectIds - type: array - collection: - description: The Cloud Source collection to regulate. - title: collection - type: string - required: - - collection - - regulationType - title: CreateCloudSourceRegulationV1Input - type: object - CreateCloudSourceRegulationV1Output: - description: The output of a create Cloud Source regulation call. - example: - regulateId: regulateId - properties: - regulateId: - description: The id of the created regulation. - title: regulateId - type: string - required: - - regulateId - title: CreateCloudSourceRegulationV1Output - type: object - ListRegulationsFromSourceV1Input: - description: Input to list all Source-scoped regulations. - properties: {} - title: ListRegulationsFromSourceV1Input - type: object - ListRegulationsFromSourceV1Output: - description: Output of all Source-scoped regulations. - example: - regulations: - - createdAt: createdAt - subjects: - - subjects - - subjects - id: id - subjectType: subjectType - status: FAILED - finishedAt: finishedAt - - createdAt: createdAt - subjects: - - subjects - - subjects - id: id - subjectType: subjectType - status: FAILED - finishedAt: finishedAt - properties: - regulations: - description: List of Workspace-scoped regulations with statuses. - items: - $ref: '#/components/schemas/RegulationListEntryV1' - title: regulations - type: array - required: - - regulations - title: ListRegulationsFromSourceV1Output - type: object - ListSuppressionsV1Input: - description: The input to list suppressions for the Workspace. - properties: {} - required: - - pagination - title: ListSuppressionsV1Input - type: object - ListSuppressionsV1Output: - description: The output of a list suppressed call for a Workspace. - example: - pagination: null - suppressed: - - subjectIds: - - subjectIds - - subjectIds - subjectType: subjectType - - subjectIds: - - subjectIds - - subjectIds - subjectType: subjectType - properties: - suppressed: - description: "An array that lists the suppressions from the Workspace.\n\ - \nConfig API note: equal to `attributes`." - items: - $ref: '#/components/schemas/suppressed_inner' - title: suppressed - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - suppressed - title: ListSuppressionsV1Output - type: object - GetSourcesCatalogV1Input: - description: Filter parameters used for loading the Sources public catalog. - properties: {} - required: - - pagination - title: GetSourcesCatalogV1Input - type: object - GetSourcesCatalogV1Output: - description: Returns a list of all Source catalog items contained within a given - page. - example: - pagination: null - sourcesCatalog: - - isCloudEventSource: true - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - description: description - id: id - categories: - - categories - - categories - logos: null - slug: slug - - isCloudEventSource: true - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - description: description - id: id - categories: - - categories - - categories - logos: null - slug: slug - properties: - sourcesCatalog: - description: All Source catalog items contained within the requested page. - items: - $ref: '#/components/schemas/SourceMetadataV1' - title: sourcesCatalog - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - sourcesCatalog - title: GetSourcesCatalogV1Output - type: object - GetSourceMetadataV1Input: - description: Requests a Source catalog item by id. - properties: {} - required: - - sourceMetadataId - title: GetSourceMetadataV1Input - type: object - GetSourceMetadataV1Output: - description: Returns the Source catalog item looked up by id. - example: - sourceMetadata: null - properties: - sourceMetadata: - $ref: '#/components/schemas/sourceMetadata' - required: - - sourceMetadata - title: GetSourceMetadataV1Output - type: object - SourceMetadataV1: - description: "A website, server library, mobile SDK, or cloud application which\ - \ can send data into Segment." - example: - isCloudEventSource: true - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - description: description - id: id - categories: - - categories - - categories - logos: null - slug: slug - properties: - id: - description: "The id for this Source metadata in the Segment catalog.\n\n\ - Config API note: analogous to `name`." - title: id - type: string - name: - description: "The user-friendly name of this Source.\n\nConfig API note:\ - \ equal to `displayName`." - title: name - type: string - slug: - description: "The slug that identifies this Source in the Segment app.\n\ - \nConfig API note: equal to `name`." - title: slug - type: string - description: - description: The description of this Source. - title: description - type: string - logos: - $ref: '#/components/schemas/logos_1' - options: - description: Options for this Source. - items: - $ref: '#/components/schemas/IntegrationOptionBeta' - title: options - type: array - categories: - description: A list of categories this Source belongs to. - items: - type: string - title: categories - type: array - isCloudEventSource: - description: True if this is a Cloud Event Source. - title: isCloudEventSource - type: boolean - required: - - categories - - description - - id - - isCloudEventSource - - logos - - name - - options - - slug - title: SourceMetadataV1 - type: object - CommonSourceSettingsV1: - properties: - track: - $ref: '#/components/schemas/track' - identify: - $ref: '#/components/schemas/identify' - group: - $ref: '#/components/schemas/group' - forwardingViolationsTo: - description: SourceId to forward violations to. - title: forwardingViolationsTo - type: string - forwardingBlockedEventsTo: - description: SourceId to forward blocked events to. - title: forwardingBlockedEventsTo - type: string - title: CommonSourceSettingsV1 - type: object - TrackSourceSettingsV1: - properties: - allowUnplannedEvents: - description: "Enable to allow unplanned track events.\n\nConfig API note:\ - \ equal to `allowUnplannedTrackEvents`." - title: allowUnplannedEvents - type: boolean - allowUnplannedEventProperties: - description: "Enable to allow unplanned track event properties.\n\nConfig\ - \ API note: equal to `allowUnplannedTrackEventProperties`." - title: allowUnplannedEventProperties - type: boolean - allowEventOnViolations: - description: "Allow track event on violations.\n\nConfig API note: equal\ - \ to `allowTrackEventOnViolations`." - title: allowEventOnViolations - type: boolean - allowPropertiesOnViolations: - description: "Enable to allow track properties on violations.\n\nConfig\ - \ API note: equal to `allowTrackEventPropertiesOnViolations`." - title: allowPropertiesOnViolations - type: boolean - commonEventOnViolations: - description: "The common track event on violations.\n\nConfig API note:\ - \ equal to `commonTrackEventOnViolations`." - enum: - - ALLOW - - BLOCK - - OMIT_PROPERTIES - title: commonEventOnViolations - type: string - title: TrackSourceSettingsV1 - type: object - IdentifySourceSettingsV1: - properties: - allowUnplannedTraits: - description: "Enable to allow unplanned identify traits.\n\nConfig API note:\ - \ equal to `allowUnplannedIdentifyTraits`." - title: allowUnplannedTraits - type: boolean - allowTraitsOnViolations: - description: "Enable to allow identify traits on violations.\n\nConfig API\ - \ note: equal to `allowIdentifyTraitsOnViolations`." - title: allowTraitsOnViolations - type: boolean - commonEventOnViolations: - description: "The common identify event on violations.\n\nConfig API note:\ - \ equal to `commonIdentifyEventOnViolations`." - enum: - - ALLOW - - BLOCK - - OMIT_TRAITS - title: commonEventOnViolations - type: string - title: IdentifySourceSettingsV1 - type: object - GroupSourceSettingsV1: - properties: - allowUnplannedTraits: - description: "Enable to allow unplanned group traits.\n\nConfig API note:\ - \ equal to `allowUnplannedGroupTraits`." - title: allowUnplannedTraits - type: boolean - allowTraitsOnViolations: - description: "Enable to allow group traits on violations.\n\nConfig API\ - \ note: equal to `allowGroupTraitsOnViolations`." - title: allowTraitsOnViolations - type: boolean - commonEventOnViolations: - description: "The common group event on violations.\n\nConfig API note:\ - \ equal to `commonGroupEventOnViolations`." - enum: - - ALLOW - - BLOCK - - OMIT_TRAITS - title: commonEventOnViolations - type: string - title: GroupSourceSettingsV1 - type: object - SourceSettingsOutputV1: - description: The output of Source settings. - properties: - track: - $ref: '#/components/schemas/track' - identify: - $ref: '#/components/schemas/identify' - group: - $ref: '#/components/schemas/group' - forwardingViolationsTo: - description: SourceId to forward violations to. - title: forwardingViolationsTo - type: string - forwardingBlockedEventsTo: - description: SourceId to forward blocked events to. - title: forwardingBlockedEventsTo - type: string - title: SourceSettingsOutputV1 - type: object - ListSchemaSettingsInSourceV1Input: - description: Request the settings of a Source. - properties: {} - required: - - sourceId - title: ListSchemaSettingsInSourceV1Input - type: object - ListSchemaSettingsInSourceV1Output: - description: Returns a list of settings for the Source. - example: - sourceId: sourceId - settings: null - properties: - sourceId: - description: "Source id.\n\nConfig API note: analogous to `parent` and `name`." - title: sourceId - type: string - settings: - $ref: '#/components/schemas/settings' - required: - - settings - - sourceId - title: ListSchemaSettingsInSourceV1Output - type: object - UpdateSchemaSettingsInSourceV1Input: - description: Input to update a Source's settings. - properties: - track: - $ref: '#/components/schemas/track' - identify: - $ref: '#/components/schemas/identify' - group: - $ref: '#/components/schemas/group' - forwardingViolationsTo: - description: Source id to forward violations to. - title: forwardingViolationsTo - type: string - forwardingBlockedEventsTo: - description: Source id to forward blocked events to. - title: forwardingBlockedEventsTo - type: string - required: - - sourceId - title: UpdateSchemaSettingsInSourceV1Input - type: object - UpdateSchemaSettingsInSourceV1Output: - description: Output of the Source with updated settings. - example: - sourceId: sourceId - settings: null - properties: - sourceId: - description: "The id of the updated Source.\n\nConfig API note: analogous\ - \ to `parent` and `name`." - title: sourceId - type: string - settings: - $ref: '#/components/schemas/settings_1' - required: - - settings - - sourceId - title: UpdateSchemaSettingsInSourceV1Output - type: object - SourceAlpha: - description: Defines a data Source for Segment data. - example: - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - id: - description: "The id of the Source.\n\nConfig API note: analogous to `name`." - title: id - type: string - slug: - description: "The slug used to identify the Source in the Segment app.\n\ - \nConfig API note: equal to `name`." - title: slug - type: string - name: - description: "The name of the Source.\n\nConfig API note: equal to `displayName`." - title: name - type: string - metadata: - $ref: '#/components/schemas/metadata_1' - workspaceId: - description: "The id of the Workspace that owns the Source.\n\nConfig API\ - \ note: equal to `parent`." - title: workspaceId - type: string - enabled: - description: Enable to receive data from the Source. - title: enabled - type: boolean - writeKeys: - description: |- - The write keys used to send data from the Source. This field is left empty when the current token does not have the - 'source admin' permission. - items: - type: string - title: writeKeys - type: array - settings: - allOf: - - $ref: '#/components/schemas/SourceSettingsAlpha' - description: The settings associated with the Source. - title: settings - labels: - description: A list of labels applied to the Source. - items: - $ref: '#/components/schemas/LabelV1' - title: labels - type: array - required: - - enabled - - id - - labels - - metadata - - slug - - workspaceId - - writeKeys - title: SourceAlpha - type: object - SourceSettingsAlpha: - additionalProperties: {} - description: |- - A key-value object that contains instance-specific settings for a Source. - - The `options` field in the Source metadata defines the schema of this object. - title: SourceSettingsAlpha - type: object - ListSourcesAlphaInput: - description: Requests a list of Sources that belong to the current Workspace. - properties: {} - required: - - pagination - title: ListSourcesAlphaInput - type: object - ListSourcesAlphaOutput: - description: Returns a list of Sources that belong to the current Workspace. - example: - pagination: null - sources: - - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - sources: - description: A list of Sources that belong to the Workspace. - items: - $ref: '#/components/schemas/SourceAlpha' - title: sources - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - sources - title: ListSourcesAlphaOutput - type: object - GetSourceAlphaInput: - description: Looks up a Source by id. - properties: {} - required: - - sourceId - title: GetSourceAlphaInput - type: object - GetSourceAlphaOutput: - description: Returns a Source. - example: - source: null - properties: - source: - $ref: '#/components/schemas/source_1' - required: - - source - title: GetSourceAlphaOutput - type: object - ListConnectedWarehousesFromSourceAlphaInput: - description: Requests a list of Warehouses connected to a Source. - properties: {} - required: - - pagination - title: ListConnectedWarehousesFromSourceAlphaInput - type: object - ListConnectedWarehousesFromSourceAlphaOutput: - description: Returns a list of Warehouses connected to a Source. - example: - pagination: null - warehouses: - - settings: "" - metadata: null - id: id - enabled: true - workspaceId: workspaceId - - settings: "" - metadata: null - id: id - enabled: true - workspaceId: workspaceId - properties: - warehouses: - description: A list that contains the Warehouses connected to the Source. - items: - $ref: '#/components/schemas/WarehouseV1' - title: warehouses - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - warehouses - title: ListConnectedWarehousesFromSourceAlphaOutput - type: object - ListConnectedDestinationsFromSourceAlphaInput: - description: Requests a list of Destinations connected to a Source. - properties: {} - required: - - pagination - title: ListConnectedDestinationsFromSourceAlphaInput - type: object - ListConnectedDestinationsFromSourceAlphaOutput: - description: Returns a list of Destinations connected to a Source. - example: - pagination: null - destinations: - - sourceId: sourceId - settings: - key: "" - metadata: null - name: name - id: id - enabled: true - - sourceId: sourceId - settings: - key: "" - metadata: null - name: name - id: id - enabled: true - properties: - destinations: - description: A list that contains the Destinations connected to the Source. - items: - $ref: '#/components/schemas/DestinationV1' - title: destinations - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - destinations - - pagination - title: ListConnectedDestinationsFromSourceAlphaOutput - type: object - CreateSourceAlphaInput: - description: Create a new Source based on a set of parameters. - properties: - slug: - description: The slug by which to identify the Source in the Segment app. - title: slug - type: string - enabled: - description: Enable to allow this Source to send data. Defaults to true. - title: enabled - type: boolean - name: - description: An optional human-readable name for this Source. - title: name - type: string - metadataId: - description: |- - The id of the Source metadata from which this instance of the Source derives. - - All Source metadata is available under `/catalog/sources`. - title: metadataId - type: string - settings: - allOf: - - $ref: '#/components/schemas/SourceSettingsAlpha' - description: A key-value object that contains instance-specific settings - for the Source. - title: settings - required: - - enabled - - metadataId - - slug - title: CreateSourceAlphaInput - type: object - CreateSourceAlphaOutput: - description: Returns the newly Source. - example: - source: null - properties: - source: - $ref: '#/components/schemas/source_2' - required: - - source - title: CreateSourceAlphaOutput - type: object - DeleteSourceAlphaInput: - description: Deletes an existing Source by id. - properties: {} - required: - - sourceId - title: DeleteSourceAlphaInput - type: object - DeleteSourceAlphaOutput: - description: Returns the status of a Source deletion. - example: - status: SUCCESS - properties: - status: - description: The status of the Source deletion operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteSourceAlphaOutput - type: object - UpdateSourceAlphaInput: - description: Updates an existing Source based on a set of parameters. - properties: - name: - description: "An optional human-readable name to associate with the Source.\n\ - \nConfig API note: equal to `displayName`." - title: name - type: string - enabled: - description: Enable to allow the Source to send data. - title: enabled - type: boolean - slug: - description: "The slug that identifies the Source.\n\nConfig API note: equal\ - \ to `name`." - title: slug - type: string - settings: - allOf: - - $ref: '#/components/schemas/SourceSettingsAlpha' - description: |- - A key-value object that contains instance-specific settings for the Source. - - Different kinds of Sources require different kinds of input. The settings input for a Source comes from the - `options` object associated with this instance of a Source. - - You can find the full list of required settings by accessing the Sources catalog endpoint under `/catalog/sources`. - title: settings - required: - - sourceId - title: UpdateSourceAlphaInput - type: object - UpdateSourceAlphaOutput: - description: Returns the updated Source. - example: - source: null - properties: - source: - $ref: '#/components/schemas/source_3' - required: - - source - title: UpdateSourceAlphaOutput - type: object - SourceV1: - description: Defines a data Source for Segment data. - example: - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - id: - description: "The id of the Source.\n\nConfig API note: analogous to `name`." - title: id - type: string - slug: - description: "The slug used to identify the Source in the Segment app.\n\ - \nConfig API note: equal to `name`." - title: slug - type: string - name: - description: "The name of the Source.\n\nConfig API note: equal to `displayName`." - title: name - type: string - metadata: - $ref: '#/components/schemas/metadata_1' - workspaceId: - description: "The id of the Workspace that owns the Source.\n\nConfig API\ - \ note: equal to `parent`." - title: workspaceId - type: string - enabled: - description: Enable to receive data from the Source. - title: enabled - type: boolean - writeKeys: - description: |- - The write keys used to send data from the Source. This field is left empty when the current token does not have the - 'source admin' permission. - items: - type: string - title: writeKeys - type: array - settings: - allOf: - - $ref: '#/components/schemas/SourceSettingsV1' - description: The settings associated with the Source. - title: settings - labels: - description: A list of labels applied to the Source. - items: - $ref: '#/components/schemas/LabelV1' - title: labels - type: array - required: - - enabled - - id - - labels - - metadata - - slug - - workspaceId - - writeKeys - title: SourceV1 - type: object - SourceSettingsV1: - additionalProperties: {} - description: |- - A key-value object that contains instance-specific settings for a Source. - - The `options` field in the Source metadata defines the schema of this object. - title: SourceSettingsV1 - type: object - ListSourcesV1Input: - description: Requests a list of Sources that belong to the current Workspace. - properties: {} - required: - - pagination - title: ListSourcesV1Input - type: object - ListSourcesV1Output: - description: Returns a list of Sources that belong to the current Workspace. - properties: - sources: - description: A list of Sources that belong to the Workspace. - items: - $ref: '#/components/schemas/SourceV1' - title: sources - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - sources - title: ListSourcesV1Output - type: object - GetSourceV1Input: - description: Looks up a Source by id. - properties: {} - required: - - sourceId - title: GetSourceV1Input - type: object - GetSourceV1Output: - description: Returns a Source. - properties: - source: - $ref: '#/components/schemas/source_4' - required: - - source - title: GetSourceV1Output - type: object - ListConnectedWarehousesFromSourceV1Input: - description: Requests a list of Warehouses connected to a Source. - properties: {} - title: ListConnectedWarehousesFromSourceV1Input - type: object - ListConnectedWarehousesFromSourceV1Output: - description: Returns a list of Warehouses connected to a Source. - properties: - warehouses: - description: A list that contains the Warehouses connected to the Source. - items: - $ref: '#/components/schemas/WarehouseV1' - title: warehouses - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - warehouses - title: ListConnectedWarehousesFromSourceV1Output - type: object - ListConnectedDestinationsFromSourceV1Input: - description: Requests a list of Destinations connected to a Source. - properties: {} - title: ListConnectedDestinationsFromSourceV1Input - type: object - ListConnectedDestinationsFromSourceV1Output: - description: Returns a list of Destinations connected to a Source. - properties: - destinations: - description: A list that contains the Destinations connected to the Source. - items: - $ref: '#/components/schemas/DestinationV1' - title: destinations - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - destinations - - pagination - title: ListConnectedDestinationsFromSourceV1Output - type: object - CreateSourceV1Input: - description: Create a new Source based on a set of parameters. - properties: - slug: - description: The slug by which to identify the Source in the Segment app. - title: slug - type: string - enabled: - description: Enable to allow this Source to send data. Defaults to true. - title: enabled - type: boolean - metadataId: - description: |- - The id of the Source metadata from which this instance of the Source derives. - - All Source metadata is available under `/catalog/sources`. - title: metadataId - type: string - settings: - allOf: - - $ref: '#/components/schemas/SourceSettingsV1' - description: A key-value object that contains instance-specific settings - for the Source. - title: settings - required: - - enabled - - metadataId - - slug - title: CreateSourceV1Input - type: object - CreateSourceV1Output: - description: Returns a newly created Source. - properties: - source: - $ref: '#/components/schemas/source_5' - required: - - source - title: CreateSourceV1Output - type: object - DeleteSourceV1Input: - description: Deletes an existing Source by id. - properties: {} - required: - - sourceId - title: DeleteSourceV1Input - type: object - DeleteSourceV1Output: - description: Returns the status of a Source deletion. - properties: - status: - description: The status of the Source deletion operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteSourceV1Output - type: object - UpdateSourceV1Input: - description: Updates an existing Source based on a set of parameters. - properties: - name: - description: "An optional human-readable name to associate with the Source.\n\ - \nConfig API note: equal to `displayName`." - title: name - type: string - enabled: - description: Enable to allow the Source to send data. - title: enabled - type: boolean - slug: - description: "The slug that identifies the Source.\n\nConfig API note: equal\ - \ to `name`." - title: slug - type: string - settings: - allOf: - - $ref: '#/components/schemas/SourceSettingsV1' - description: |- - A key-value object that contains instance-specific settings for the Source. - - Different kinds of Sources require different kinds of input. The settings input for a Source comes from the - `options` object associated with this instance of a Source. - - You can find the full list of required settings by accessing the Sources catalog endpoint under `/catalog/sources`. - title: settings - required: - - sourceId - title: UpdateSourceV1Input - type: object - UpdateSourceV1Output: - description: Returns the updated Source. - properties: - source: - $ref: '#/components/schemas/source_6' - required: - - source - title: UpdateSourceV1Output - type: object - GetSpaceAlphaInput: - description: Input for the getSpaceById endpoint. - properties: {} - required: - - spaceId - title: GetSpaceAlphaInput - type: object - Space: - properties: - id: - title: id - type: string - slug: - title: slug - type: string - name: - title: name - type: string - required: - - id - - name - - slug - title: Space - type: object - GetSpaceAlphaOutput: - description: Response for the getSpaceById endpoint. - example: - space: null - properties: - space: - $ref: '#/components/schemas/space' - required: - - space - title: GetSpaceAlphaOutput - type: object - MessagesSubscriptionRequest: - properties: - key: - description: Key is the phone number or email. - title: key - type: string - type: - description: Type is communication medium used. Either EMAIL or SMS. - enum: - - EMAIL - - SMS - title: type - type: string - status: - description: "The user subscribed, unsubscribed, or on initial status." - enum: - - DID_NOT_SUBSCRIBE - - SUBSCRIBED - - UNSUBSCRIBED - title: status - type: string - required: - - key - - status - - type - title: MessagesSubscriptionRequest - type: object - ReplaceMessagingSubscriptionsInSpacesAlphaInput: - description: Input for the endpoint. - properties: - subscriptions: - description: An array of subscriptions. - items: - $ref: '#/components/schemas/MessagesSubscriptionRequest' - title: subscriptions - type: array - required: - - spaceId - - subscriptions - title: ReplaceMessagingSubscriptionsInSpacesAlphaInput - type: object - MessageSubscriptionResponseError: - example: - code: code - message: message - properties: - code: - description: Error code. - title: code - type: string - message: - description: Error message. - title: message - type: string - required: - - code - - message - title: MessageSubscriptionResponseError - type: object - MessageSubscriptionResponse: - example: - type: EMAIL - key: key - errors: - - code: code - message: message - - code: code - message: message - status: DID_NOT_SUBSCRIBE - properties: - key: - description: Key is the phone number or email. - title: key - type: string - type: - description: Type is communication medium used. Either EMAIL or SMS. - enum: - - EMAIL - - SMS - title: type - type: string - status: - description: "The user subscribed, unsubscribed, or on initial status." - enum: - - DID_NOT_SUBSCRIBE - - SUBSCRIBED - - UNSUBSCRIBED - title: status - type: string - errors: - description: Error messages. - items: - $ref: '#/components/schemas/MessageSubscriptionResponseError' - title: errors - type: array - required: - - key - - status - - type - title: MessageSubscriptionResponse - type: object - ReplaceMessagingSubscriptionsInSpacesAlphaOutput: - description: Output for the endpoint. - example: - failures: - - type: EMAIL - key: key - errors: - - code: code - message: message - - code: code - message: message - status: DID_NOT_SUBSCRIBE - - type: EMAIL - key: key - errors: - - code: code - message: message - - code: code - message: message - status: DID_NOT_SUBSCRIBE - pagination: null - successes: - - type: EMAIL - key: key - errors: - - code: code - message: message - - code: code - message: message - status: DID_NOT_SUBSCRIBE - - type: EMAIL - key: key - errors: - - code: code - message: message - - code: code - message: message - status: DID_NOT_SUBSCRIBE - properties: - successes: - description: Array of successful subscription status. - items: - $ref: '#/components/schemas/MessageSubscriptionResponse' - title: successes - type: array - failures: - description: Array of failure subscription status. - items: - $ref: '#/components/schemas/MessageSubscriptionResponse' - title: failures - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - failures - - successes - title: ReplaceMessagingSubscriptionsInSpacesAlphaOutput - type: object - GetMessagingSubscriptionSuccessResponse: - example: - type: EMAIL - key: key - status: DID_NOT_SUBSCRIBE - properties: - key: - description: Key is the phone number or email. - title: key - type: string - type: - description: Type is communication medium used. Either EMAIL or SMS. - enum: - - EMAIL - - SMS - title: type - type: string - status: - description: "The user subscribed, unsubscribed, or on initial status. This\ - \ is absent if the phone number or email is not found." - enum: - - DID_NOT_SUBSCRIBE - - SUBSCRIBED - - UNSUBSCRIBED - title: status - type: string - required: - - key - - type - title: GetMessagingSubscriptionSuccessResponse - type: object - GetMessagingSubscriptionFailureResponse: - example: - type: type - key: key - errors: - - code: code - message: message - - code: code - message: message - properties: - key: - description: Key is the phone number or email. - title: key - type: string - type: - description: This will be the exact type as given in the request. - title: type - type: string - errors: - description: "Per key errors, such as validation errors." - items: - $ref: '#/components/schemas/MessageSubscriptionResponseError' - title: errors - type: array - required: - - errors - - key - - type - title: GetMessagingSubscriptionFailureResponse - type: object - BatchQueryMessagingSubscriptionsForSpaceAlphaOutput: - description: Batch get response. - example: - failures: - - type: type - key: key - errors: - - code: code - message: message - - code: code - message: message - - type: type - key: key - errors: - - code: code - message: message - - code: code - message: message - pagination: null - successes: - - type: EMAIL - key: key - status: DID_NOT_SUBSCRIBE - - type: EMAIL - key: key - status: DID_NOT_SUBSCRIBE - errors: - - code: code - message: message - - code: code - message: message - properties: - successes: - description: Array of successful subscription status. - items: - $ref: '#/components/schemas/GetMessagingSubscriptionSuccessResponse' - title: successes - type: array - failures: - description: Validation errors due to invalid types or email/phone numbers. - items: - $ref: '#/components/schemas/GetMessagingSubscriptionFailureResponse' - title: failures - type: array - errors: - description: General errors when making the request such as invalid payload - or wrong http method errors. - items: - $ref: '#/components/schemas/MessageSubscriptionResponseError' - title: errors - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - errors - - failures - - successes - title: BatchQueryMessagingSubscriptionsForSpaceAlphaOutput - type: object - GetSubscriptionRequest: - properties: - key: - description: Key is the phone number or email. - title: key - type: string - type: - description: Type is communication medium used. Either EMAIL or SMS. - enum: - - EMAIL - - SMS - title: type - type: string - required: - - key - - type - title: GetSubscriptionRequest - type: object - BatchQueryMessagingSubscriptionsForSpaceAlphaInput: - description: Batch get request. - properties: - subscriptions: - description: A list of subscriptions to retrieve subscription status. - items: - $ref: '#/components/schemas/GetSubscriptionRequest' - title: subscriptions - type: array - required: - - spaceId - - subscriptions - title: BatchQueryMessagingSubscriptionsForSpaceAlphaInput - type: object - TrackingPlanV1: - description: Represents a Tracking Plan. - example: - createdAt: createdAt - name: name - description: description - id: id - type: LIVE - slug: slug - updatedAt: updatedAt - properties: - id: - description: "The Tracking Plan's identifier.\n\nConfig API note: analogous\ - \ to `name`." - title: id - type: string - name: - description: "The Tracking Plan's name.\n\nConfig API note: equal to `displayName`." - title: name - type: string - slug: - description: "URL-friendly slug of this Tracking Plan.\n\nConfig API note:\ - \ equal to `name`." - title: slug - type: string - description: - description: The Tracking Plan's description. - title: description - type: string - type: - description: The Tracking Plan's type. - enum: - - LIVE - - PROPERTY_LIBRARY - - RULE_LIBRARY - - TEMPLATE - title: type - type: string - updatedAt: - description: "The timestamp of the last change to the Tracking Plan.\n\n\ - Config API note: equal to `updateTime`." - title: updatedAt - type: string - createdAt: - description: "The timestamp of this Tracking Plan's creation.\n\nConfig\ - \ API note: equal to `createTime`." - title: createdAt - type: string - required: - - id - - type - title: TrackingPlanV1 - type: object - RuleV1: - description: Represents a rule from a Tracking Plan. - example: - createdAt: createdAt - jsonSchema: "" - deprecatedAt: deprecatedAt - type: COMMON - version: 0.8008281904610115 - key: key - updatedAt: updatedAt - properties: - type: - description: The type for this Tracking Plan rule. - enum: - - COMMON - - GROUP - - IDENTIFY - - PAGE - - SCREEN - - TRACK - title: type - type: string - key: - description: Key to this rule (free-form string like 'Button clicked'). - title: key - type: string - jsonSchema: - description: JSON Schema of this rule. - title: jsonSchema - version: - description: Version of this rule. - title: version - type: number - createdAt: - description: The timestamp of this rule's creation. - title: createdAt - type: string - updatedAt: - description: The timestamp of this rule's last change. - title: updatedAt - type: string - deprecatedAt: - description: The timestamp of this rule's deprecation. - title: deprecatedAt - type: string - required: - - jsonSchema - - type - - version - title: RuleV1 - type: object - UpsertRuleV1: - properties: - newKey: - description: This rule's new intended key. - title: newKey - type: string - type: - description: The type for this Tracking Plan rule. - enum: - - COMMON - - GROUP - - IDENTIFY - - PAGE - - SCREEN - - TRACK - title: type - type: string - key: - description: Key to this rule (free-form string like 'Button clicked'). - title: key - type: string - jsonSchema: - description: JSON Schema of this rule. - title: jsonSchema - version: - description: Version of this rule. - title: version - type: number - createdAt: - description: The timestamp of this rule's creation. - title: createdAt - type: string - updatedAt: - description: The timestamp of this rule's last change. - title: updatedAt - type: string - deprecatedAt: - description: The timestamp of this rule's deprecation. - title: deprecatedAt - type: string - required: - - jsonSchema - - type - - version - title: UpsertRuleV1 - type: object - RemoveRuleV1: - description: Represents the parameters needed to identify a rule on the backend-side. - properties: - type: - enum: - - COMMON - - GROUP - - IDENTIFY - - PAGE - - SCREEN - - TRACK - title: type - type: string - key: - title: key - type: string - version: - title: version - type: number - required: - - type - - version - title: RemoveRuleV1 - type: object - ListTrackingPlansV1Input: - description: Lists the Tracking Plans associated with the current Workspace. - properties: {} - title: ListTrackingPlansV1Input - type: object - GetTrackingPlanV1Input: - description: Gets a single Tracking Plan. - properties: {} - required: - - trackingPlanId - title: GetTrackingPlanV1Input - type: object - ListTrackingPlansV1Output: - description: Lists the Tracking Plans associated with the current Workspace. - example: - pagination: null - trackingPlans: - - createdAt: createdAt - name: name - description: description - id: id - type: LIVE - slug: slug - updatedAt: updatedAt - - createdAt: createdAt - name: name - description: description - id: id - type: LIVE - slug: slug - updatedAt: updatedAt - properties: - trackingPlans: - description: A paginated list of Tracking Plans. - items: - $ref: '#/components/schemas/TrackingPlanV1' - title: trackingPlans - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - trackingPlans - title: ListTrackingPlansV1Output - type: object - GetTrackingPlanV1Output: - description: Gets a single Tracking Plan. - example: - trackingPlan: null - properties: - trackingPlan: - $ref: '#/components/schemas/trackingPlan' - required: - - trackingPlan - title: GetTrackingPlanV1Output - type: object - DeleteTrackingPlanV1Input: - description: Deletes a Tracking Plan. - properties: {} - required: - - trackingPlanId - title: DeleteTrackingPlanV1Input - type: object - DeleteTrackingPlanV1Output: - description: Result of a DeleteTrackingPlan call. - example: - status: SUCCESS - properties: - status: - description: The operation status. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteTrackingPlanV1Output - type: object - CreateTrackingPlanV1Input: - description: Creates a Tracking Plan in the Workspace. - properties: - name: - description: "The Tracking Plan's name.\n\nConfig API note: equal to `displayName`." - title: name - type: string - description: - description: The Tracking Plan's description. - title: description - type: string - type: - description: The Tracking Plan's type. - enum: - - LIVE - - PROPERTY_LIBRARY - - RULE_LIBRARY - - TEMPLATE - title: type - type: string - required: - - name - - type - title: CreateTrackingPlanV1Input - type: object - CreateTrackingPlanV1Output: - description: Result of a CreateTrackingPlan call. - example: - trackingPlan: null - properties: - trackingPlan: - $ref: '#/components/schemas/trackingPlan_1' - required: - - trackingPlan - title: CreateTrackingPlanV1Output - type: object - UpdateTrackingPlanV1Input: - description: Updates the Workspace's Tracking Plan. - properties: - name: - description: "The Tracking Plan's name.\n\nConfig API note: equal to `displayName`." - title: name - type: string - description: - description: The Tracking Plan's description. - title: description - type: string - required: - - trackingPlanId - title: UpdateTrackingPlanV1Input - type: object - UpdateTrackingPlanV1Output: - description: Result of an UpdateTrackingPlan call. - example: - status: SUCCESS - properties: - status: - description: The operation status. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: UpdateTrackingPlanV1Output - type: object - ListRulesFromTrackingPlanV1Input: - description: Lists a Tracking Plan's rules. - properties: {} - title: ListRulesFromTrackingPlanV1Input - type: object - ListRulesFromTrackingPlanV1Output: - description: Lists a Tracking Plan's rules. - example: - pagination: null - rules: - - createdAt: createdAt - jsonSchema: "" - deprecatedAt: deprecatedAt - type: COMMON - version: 0.8008281904610115 - key: key - updatedAt: updatedAt - - createdAt: createdAt - jsonSchema: "" - deprecatedAt: deprecatedAt - type: COMMON - version: 0.8008281904610115 - key: key - updatedAt: updatedAt - properties: - rules: - description: Rules associated with the given Tracking Plan. - items: - $ref: '#/components/schemas/RuleV1' - title: rules - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - rules - title: ListRulesFromTrackingPlanV1Output - type: object - UpdateRulesInTrackingPlanV1Input: - description: Updates Tracking Plan rules. Non-existent rules are added. - properties: - rules: - description: Rules to update or insert. - items: - $ref: '#/components/schemas/UpsertRuleV1' - title: rules - type: array - title: UpdateRulesInTrackingPlanV1Input - type: object - RemoveRulesFromTrackingPlanV1Input: - description: Remove specified rules from a Tracking Plan. - properties: {} - title: RemoveRulesFromTrackingPlanV1Input - type: object - ReplaceRulesInTrackingPlanV1Input: - description: Replaces Tracking Plan rules. - properties: - rules: - description: Rules to replace. - items: - $ref: '#/components/schemas/RuleV1' - title: rules - type: array - title: ReplaceRulesInTrackingPlanV1Input - type: object - ReplaceRulesInTrackingPlanV1Output: - description: Replaces Tracking Plan rules. - example: - status: SUCCESS - properties: - status: - description: The operation status. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: ReplaceRulesInTrackingPlanV1Output - type: object - RemoveRulesFromTrackingPlanV1Output: - description: Remove specified rules from a Tracking Plan. - example: - status: SUCCESS - properties: - status: - description: The status of the operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: RemoveRulesFromTrackingPlanV1Output - type: object - UpdateRulesInTrackingPlanV1Output: - description: Updates Tracking Plan rules. Non-existent rules are added. - example: - status: SUCCESS - properties: - status: - description: The operation status. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: UpdateRulesInTrackingPlanV1Output - type: object - ListSourcesFromTrackingPlanV1Input: - description: Lists all Sources associated with a Tracking Plan. - properties: {} - title: ListSourcesFromTrackingPlanV1Input - type: object - ListSourcesFromTrackingPlanV1Output: - description: Lists all Sources associated with a Tracking Plan. - example: - pagination: null - sources: - - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - sources: - description: A paginated list of Sources associated with the Tracking Plan. - items: - $ref: '#/components/schemas/SourceV1' - title: sources - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - sources - title: ListSourcesFromTrackingPlanV1Output - type: object - AddSourceToTrackingPlanV1Input: - description: Connects a Source to a Tracking Plan. - properties: - sourceId: - description: "The id of the Source associated with the Tracking Plan.\n\n\ - Config API note: analogous to `sourceName`." - title: sourceId - type: string - title: AddSourceToTrackingPlanV1Input - type: object - AddSourceToTrackingPlanV1Output: - description: Connects a Source to a Tracking Plan. - example: - status: SUCCESS - properties: - status: - description: The operation status. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: AddSourceToTrackingPlanV1Output - type: object - RemoveSourceFromTrackingPlanV1Input: - description: Disconnects a Source from a Tracking Plan. - properties: {} - title: RemoveSourceFromTrackingPlanV1Input - type: object - RemoveSourceFromTrackingPlanV1Output: - description: Disconnects a Source from a Tracking Plan. - example: - status: SUCCESS - properties: - status: - description: The operation status. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: RemoveSourceFromTrackingPlanV1Output - type: object - TransformationBeta: - description: Represents a Transformation. - example: - sourceId: sourceId - newEventName: newEventName - name: name - destinationMetadataId: destinationMetadataId - id: id - if: if - enabled: true - propertyRenames: - - newName: newName - oldName: oldName - - newName: newName - oldName: oldName - properties: - id: - description: The id of the Transformation. - title: id - type: string - name: - description: The name of the Transformation. - title: name - type: string - sourceId: - description: The Source associated with the Transformation. - title: sourceId - type: string - destinationMetadataId: - description: The optional Destination metadata associated with the Transformation. - title: destinationMetadataId - type: string - enabled: - description: If the Transformation is enabled. - title: enabled - type: boolean - if: - description: "If statement ([FQL](https://segment.com/docs/config-api/fql/))\ - \ to match events.\n\nFor standard event matchers, use the following:\n\ - \ Track -\\> \"event='\\'\"\n Identify -\\> \"type='identify'\"\ - \n Group -\\> \"type='group'\"" - title: if - type: string - newEventName: - description: Optional new event name for renaming events. Works only for - 'track' event type. - title: newEventName - type: string - propertyRenames: - description: Optional array for renaming properties collected by your events. - items: - $ref: '#/components/schemas/PropertyRenameBeta' - title: propertyRenames - type: array - required: - - enabled - - id - - if - - name - - sourceId - title: TransformationBeta - type: object - PropertyRenameBeta: - example: - newName: newName - oldName: oldName - properties: - oldName: - description: The old name of the property. - title: oldName - type: string - newName: - description: The new name to rename the property. - title: newName - type: string - required: - - newName - - oldName - title: PropertyRenameBeta - type: object - GetTransformationBetaOutput: - description: The output of Transformation retrieval. - example: - transformation: null - properties: - transformation: - $ref: '#/components/schemas/transformation' - required: - - transformation - title: GetTransformationBetaOutput - type: object - GetTransformationBetaInput: - description: The input of Transformation retrieval. - properties: {} - required: - - transformationId - title: GetTransformationBetaInput - type: object - ListTransformationsBetaInput: - description: Lists the Transformations associated with the current Workspace. - properties: {} - required: - - pagination - title: ListTransformationsBetaInput - type: object - ListTransformationsBetaOutput: - description: Lists the Transformations associated with the current Workspace. - example: - pagination: null - transformations: - - sourceId: sourceId - newEventName: newEventName - name: name - destinationMetadataId: destinationMetadataId - id: id - if: if - enabled: true - propertyRenames: - - newName: newName - oldName: oldName - - newName: newName - oldName: oldName - - sourceId: sourceId - newEventName: newEventName - name: name - destinationMetadataId: destinationMetadataId - id: id - if: if - enabled: true - propertyRenames: - - newName: newName - oldName: oldName - - newName: newName - oldName: oldName - properties: - transformations: - description: A paginated list of Transformations. - items: - $ref: '#/components/schemas/TransformationBeta' - title: transformations - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - transformations - title: ListTransformationsBetaOutput - type: object - DeleteTransformationBetaInput: - description: The input of delete Transformation. - properties: {} - required: - - transformationId - title: DeleteTransformationBetaInput - type: object - DeleteTransformationBetaOutput: - description: The output of delete Transformation. - example: - status: SUCCESS - properties: - status: - description: The operation status. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteTransformationBetaOutput - type: object - UpdateTransformationBetaInput: - description: The input to update a Transformation. - properties: - name: - description: The name of the Transformation. - title: name - type: string - sourceId: - description: The optional Source to be associated with the Transformation. - title: sourceId - type: string - destinationMetadataId: - description: The optional Destination metadata to be associated with the - Transformation. - title: destinationMetadataId - type: string - enabled: - description: If the Transformation should be enabled. - title: enabled - type: boolean - if: - description: "If statement ([FQL](https://segment.com/docs/config-api/fql/))\ - \ to match events.\n\nFor standard event matchers, use the following:\n\ - \ Track -\\> \"event='\\'\"\n Identify -\\> \"type='identify'\"\ - \n Group -\\> \"type='group'\"" - title: if - type: string - newEventName: - description: Optional new event name for renaming events. Works only for - 'track' event type. - title: newEventName - type: string - propertyRenames: - description: Optional array for renaming properties collected by your events. - items: - $ref: '#/components/schemas/PropertyRenameBeta' - title: propertyRenames - type: array - required: - - transformationId - title: UpdateTransformationBetaInput - type: object - UpdateTransformationBetaOutput: - description: The output of an updated Transformation. - example: - transformation: null - properties: - transformation: - $ref: '#/components/schemas/transformation_1' - required: - - transformation - title: UpdateTransformationBetaOutput - type: object - CreateTransformationBetaInput: - description: The input to create a Transformation. - properties: - name: - description: The name of the Transformation. - title: name - type: string - sourceId: - description: The Source to be associated with the Transformation. - title: sourceId - type: string - destinationMetadataId: - description: The optional Destination metadata id to be associated with - the Transformation. - title: destinationMetadataId - type: string - enabled: - description: If the Transformation should be enabled. - title: enabled - type: boolean - if: - description: "If statement ([FQL](https://segment.com/docs/config-api/fql/))\ - \ to match events.\n\nFor standard event matchers, use the following:\n\ - \ Track -\\> \"event='\\'\"\n Identify -\\> \"type='identify'\"\ - \n Group -\\> \"type='group'\"" - title: if - type: string - newEventName: - description: Optional new event name for renaming events. Works only for - 'track' event type. - title: newEventName - type: string - propertyRenames: - description: Optional array for renaming properties collected by your events. - items: - $ref: '#/components/schemas/PropertyRenameBeta' - title: propertyRenames - type: array - required: - - enabled - - if - - name - - sourceId - title: CreateTransformationBetaInput - type: object - CreateTransformationBetaOutput: - description: The output of a created Transformation. - example: - transformation: null - properties: - transformation: - $ref: '#/components/schemas/transformation_2' - required: - - transformation - title: CreateTransformationBetaOutput - type: object - MtuSnapshotV1: - description: A snapshot of MTU metrics within the given usage period. - example: - neverIdentified: neverIdentified - identified: identified - anonymousIdentified: anonymousIdentified - anonymous: anonymous - periodStart: 0.8008281904610115 - periodEnd: 6.027456183070403 - timestamp: timestamp - properties: - periodStart: - description: "The start of the usage period, in unix time (seconds since\ - \ epoch)." - title: periodStart - type: number - periodEnd: - description: "The end of the usage period, in unix time (seconds since epoch)." - title: periodEnd - type: number - anonymous: - description: A bigint of the number of anonymous users in this snapshot. - title: anonymous - type: string - anonymousIdentified: - description: A bigint of the number of anonymous identified users in this - snapshot. - title: anonymousIdentified - type: string - identified: - description: A bigint of the number of identified users in this snapshot. - title: identified - type: string - neverIdentified: - description: A bigint of the number of never identified users in this snapshot. - title: neverIdentified - type: string - timestamp: - description: "The timestamp of this snapshot within the billing cycle, in\ - \ the ISO-8601 format." - title: timestamp - type: string - required: - - anonymous - - anonymousIdentified - - identified - - neverIdentified - - periodEnd - - periodStart - - timestamp - title: MtuSnapshotV1 - type: object - UsersPerSourceSnapshotV1: - description: A snapshot of MTU metrics for a given Source within the given usage - period. - example: - sourceId: sourceId - neverIdentified: neverIdentified - identified: identified - anonymousIdentified: anonymousIdentified - anonymous: anonymous - periodStart: 0.8008281904610115 - periodEnd: 6.027456183070403 - timestamp: timestamp - properties: - sourceId: - description: The Source id. - title: sourceId - type: string - periodStart: - description: "The start of the usage period, in unix time (seconds since\ - \ epoch)." - title: periodStart - type: number - periodEnd: - description: "The end of the usage period, in unix time (seconds since epoch)." - title: periodEnd - type: number - anonymous: - description: A bigint of the number of anonymous users in this snapshot. - title: anonymous - type: string - anonymousIdentified: - description: A bigint of the number of anonymous identified users in this - snapshot. - title: anonymousIdentified - type: string - identified: - description: A bigint of the number of identified users in this snapshot. - title: identified - type: string - neverIdentified: - description: A bigint of the number of never identified users in this snapshot. - title: neverIdentified - type: string - timestamp: - description: "The timestamp of this snapshot within the billing cycle, in\ - \ the ISO-8601 format." - title: timestamp - type: string - required: - - anonymous - - anonymousIdentified - - identified - - neverIdentified - - periodEnd - - periodStart - - sourceId - - timestamp - title: UsersPerSourceSnapshotV1 - type: object - APICallSnapshotV1: - description: A snapshot of the number of API calls for a given Workspace. - example: - apiCalls: apiCalls - timestamp: timestamp - properties: - apiCalls: - description: A bigint of the number of API calls in this snapshot. - title: apiCalls - type: string - timestamp: - description: Timestamp of this snapshot within the billing cycle in the - ISO-8601 format. - title: timestamp - type: string - required: - - apiCalls - - timestamp - title: APICallSnapshotV1 - type: object - SourceAPICallSnapshotV1: - description: A snapshot of the number of API calls for a given Source in a Workspace. - example: - sourceId: sourceId - apiCalls: apiCalls - timestamp: timestamp - properties: - sourceId: - description: The Source id. - title: sourceId - type: string - apiCalls: - description: A bigint of the number of API calls in this snapshot. - title: apiCalls - type: string - timestamp: - description: Timestamp of this snapshot within the billing cycle in the - ISO-8601 format. - title: timestamp - type: string - required: - - apiCalls - - sourceId - - timestamp - title: SourceAPICallSnapshotV1 - type: object - GetDailyWorkspaceMTUUsageV1Input: - description: Input to retrieve aggregated daily Workspace MTU in a billing period. - properties: {} - required: - - pagination - title: GetDailyWorkspaceMTUUsageV1Input - type: object - GetDailyWorkspaceMTUUsageV1Output: - description: Returns a list of daily aggregations of Workspace MTU counts. - example: - pagination: null - dailyWorkspaceMTUUsage: - - neverIdentified: neverIdentified - identified: identified - anonymousIdentified: anonymousIdentified - anonymous: anonymous - periodStart: 0.8008281904610115 - periodEnd: 6.027456183070403 - timestamp: timestamp - - neverIdentified: neverIdentified - identified: identified - anonymousIdentified: anonymousIdentified - anonymous: anonymous - periodStart: 0.8008281904610115 - periodEnd: 6.027456183070403 - timestamp: timestamp - properties: - dailyWorkspaceMTUUsage: - description: The list of daily Workspace MTU count aggregates. - items: - $ref: '#/components/schemas/MtuSnapshotV1' - title: dailyWorkspaceMTUUsage - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - dailyWorkspaceMTUUsage - - pagination - title: GetDailyWorkspaceMTUUsageV1Output - type: object - GetDailyPerSourceMTUUsageV1Input: - description: Input to retrieve aggregated daily Source level MTU in a billing - period. - properties: {} - required: - - pagination - title: GetDailyPerSourceMTUUsageV1Input - type: object - GetDailyPerSourceMTUUsageV1Output: - description: Returns a list of daily aggregations of Source level MTU counts. - example: - pagination: null - dailyPerSourceMTUUsage: - - sourceId: sourceId - neverIdentified: neverIdentified - identified: identified - anonymousIdentified: anonymousIdentified - anonymous: anonymous - periodStart: 0.8008281904610115 - periodEnd: 6.027456183070403 - timestamp: timestamp - - sourceId: sourceId - neverIdentified: neverIdentified - identified: identified - anonymousIdentified: anonymousIdentified - anonymous: anonymous - periodStart: 0.8008281904610115 - periodEnd: 6.027456183070403 - timestamp: timestamp - properties: - dailyPerSourceMTUUsage: - description: The list of daily per Source MTU count aggregates. - items: - $ref: '#/components/schemas/UsersPerSourceSnapshotV1' - title: dailyPerSourceMTUUsage - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - dailyPerSourceMTUUsage - - pagination - title: GetDailyPerSourceMTUUsageV1Output - type: object - GetDailyWorkspaceAPICallsUsageV1Input: - description: Input to retrieve aggregated daily Workspace API calls in a billing - period. - properties: {} - required: - - pagination - title: GetDailyWorkspaceAPICallsUsageV1Input - type: object - GetDailyWorkspaceAPICallsUsageV1Output: - description: Returns a list of daily aggregations of Workspace MTU counts. - example: - dailyWorkspaceAPICallsUsage: - - apiCalls: apiCalls - timestamp: timestamp - - apiCalls: apiCalls - timestamp: timestamp - pagination: null - properties: - dailyWorkspaceAPICallsUsage: - description: The list of daily Workspace API calls count aggregates. - items: - $ref: '#/components/schemas/APICallSnapshotV1' - title: dailyWorkspaceAPICallsUsage - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - dailyWorkspaceAPICallsUsage - - pagination - title: GetDailyWorkspaceAPICallsUsageV1Output - type: object - GetDailyPerSourceAPICallsUsageV1Input: - description: Input to retrieve aggregated daily Source level API calls in a - billing period. - properties: {} - required: - - pagination - title: GetDailyPerSourceAPICallsUsageV1Input - type: object - GetDailyPerSourceAPICallsUsageV1Output: - description: Returns a list of daily aggregations of Source level API calls - counts. - example: - pagination: null - dailyPerSourceAPICallsUsage: - - sourceId: sourceId - apiCalls: apiCalls - timestamp: timestamp - - sourceId: sourceId - apiCalls: apiCalls - timestamp: timestamp - properties: - dailyPerSourceAPICallsUsage: - description: The list of daily per Source API calls count aggregates. - items: - $ref: '#/components/schemas/SourceAPICallSnapshotV1' - title: dailyPerSourceAPICallsUsage - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - dailyPerSourceAPICallsUsage - - pagination - title: GetDailyPerSourceAPICallsUsageV1Output - type: object - GetWarehousesCatalogV1Input: - description: Filter parameters used for loading the Warehouses public catalog. - properties: {} - required: - - pagination - title: GetWarehousesCatalogV1Input - type: object - GetWarehousesCatalogV1Output: - description: Returns a list of all Warehouse catalog items contained within - a given page. - example: - pagination: null - warehousesCatalog: - - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - description: description - id: id - logos: null - slug: slug - - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - description: description - id: id - logos: null - slug: slug - properties: - warehousesCatalog: - description: All Warehouse catalog items contained within the requested - page. - items: - $ref: '#/components/schemas/WarehouseMetadataV1' - title: warehousesCatalog - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - warehousesCatalog - title: GetWarehousesCatalogV1Output - type: object - GetWarehouseMetadataV1Input: - description: Returns a Warehouse catalog item by id. - properties: {} - required: - - warehouseMetadataId - title: GetWarehouseMetadataV1Input - type: object - GetWarehouseMetadataV1Output: - description: Returns a Warehouse catalog item looked up by id. - example: - warehouseMetadata: null - properties: - warehouseMetadata: - $ref: '#/components/schemas/warehouseMetadata' - required: - - warehouseMetadata - title: GetWarehouseMetadataV1Output - type: object - WarehouseMetadataV1: - description: The metadata for an instance of Segment’s data Warehouse product. - example: - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - description: description - id: id - logos: null - slug: slug - properties: - id: - description: The id of this object. - title: id - type: string - name: - description: The name of this object. - title: name - type: string - slug: - description: "A human-readable, unique identifier for object." - title: slug - type: string - description: - description: "A description, in English, of this object." - title: description - type: string - logos: - $ref: '#/components/schemas/logos_2' - options: - description: The Integration options for this object. - items: - $ref: '#/components/schemas/IntegrationOptionBeta' - title: options - type: array - required: - - description - - id - - logos - - name - - options - - slug - title: WarehouseMetadataV1 - type: object - WarehouseSettingsV1: - additionalProperties: {} - description: A key-value object that contains instance-specific Warehouse settings. - title: WarehouseSettingsV1 - type: object - WarehouseV1: - description: Defines a data Warehouse used as a Destination for Segment data. - example: - settings: "" - metadata: null - id: id - enabled: true - workspaceId: workspaceId - properties: - id: - description: The id of the Warehouse. - title: id - type: string - metadata: - $ref: '#/components/schemas/metadata_2' - workspaceId: - description: The id of the Workspace that owns this Warehouse. - title: workspaceId - type: string - enabled: - description: "When set to true, this Warehouse receives data." - title: enabled - type: boolean - settings: - allOf: - - $ref: '#/components/schemas/WarehouseSettingsV1' - description: "The settings associated with this Warehouse.\n\nCommon settings\ - \ are connection-related configuration used to connect to it, for example\ - \ host, username, and port." - title: settings - required: - - enabled - - id - - metadata - - settings - - workspaceId - title: WarehouseV1 - type: object - SyncNoticeV1: - description: Represents a notice within a sync for a Source and Warehouse pair. - example: - createdAt: createdAt - level: level - message: message - properties: - level: - description: The severity of the notice. - title: level - type: string - message: - description: The human-readable message that describes the notice. - title: message - type: string - createdAt: - description: The timestamp of this sync notice's creation. - title: createdAt - type: string - required: - - createdAt - - level - - message - title: SyncNoticeV1 - type: object - SyncV1: - description: |- - Represents a sync between a Source and Warehouse. - - A sync occurs when data from a Source is loaded into a Warehouse. - example: - sourceId: sourceId - duration: 0.8008281904610115 - notices: - - createdAt: createdAt - level: level - message: message - - createdAt: createdAt - level: level - message: message - humanDuration: humanDuration - start: start - count: 6.027456183070403 - end: end - status: status - properties: - sourceId: - description: The id of the Source loaded in the sync. - title: sourceId - type: string - start: - description: The start time of the sync. - title: start - type: string - end: - description: The time the sync completed. Returns null if unfinished. - nullable: true - title: end - type: string - status: - description: The status of the sync. - title: status - type: string - duration: - description: The duration of the sync in seconds. Returns the partial duration - if the sync has not finished yet. - title: duration - type: number - humanDuration: - description: The human-readable counterpart of `duration`. - title: humanDuration - type: string - count: - description: The number of rows synced into the Warehouse. - title: count - type: number - notices: - description: Notices that contain the events that occurred during the sync. - items: - $ref: '#/components/schemas/SyncNoticeV1' - title: notices - type: array - required: - - count - - duration - - end - - humanDuration - - notices - - sourceId - - start - - status - title: SyncV1 - type: object - WarehouseSyncOverrideV1: - description: Represents the override for a Source/collection/property? path - to apply to a Warehouse. - properties: - sourceId: - description: The id of the Source this schema item applies to. - title: sourceId - type: string - collection: - description: The collection the schema item override applies to. - title: collection - type: string - enabled: - description: Enable to apply the override. - title: enabled - type: boolean - property: - description: A property within the collection to which the override applies. - title: property - type: string - required: - - enabled - - sourceId - title: WarehouseSyncOverrideV1 - type: object - WarehouseSelectiveSyncItemV1: - description: Represents an entry in the Warehouse Selective Sync schema for - a Warehouse and Source pair. - example: - sourceId: sourceId - warehouseId: warehouseId - collection: collection - properties: - key: "" - properties: - sourceId: - description: The Source id attached to this Warehouse. - title: sourceId - type: string - collection: - description: The collection within the Source. - title: collection - type: string - warehouseId: - description: The id of the Warehouse this sync belongs to. - title: warehouseId - type: string - properties: - additionalProperties: true - description: A map that contains the properties within the collection to - which the Warehouse should sync. - title: properties - type: object - required: - - collection - - properties - - sourceId - - warehouseId - title: WarehouseSelectiveSyncItemV1 - type: object - WarehouseAdvancedSyncV1: - description: Determines the time of day at which a Warehouse should sync. - properties: - hourOfDay: - description: "The hour of day for which to enable/disable a sync, between\ - \ 0 and 23." - title: hourOfDay - type: number - enabled: - description: Enable to the sync at the specified hour. - title: enabled - type: boolean - required: - - enabled - - hourOfDay - title: WarehouseAdvancedSyncV1 - type: object - AdvancedWarehouseSyncScheduleV1Input: - description: Defines the advanced sync schedule for a Warehouse. - properties: - times: - description: A list that contains the times when syncs should occur. - items: - $ref: '#/components/schemas/WarehouseAdvancedSyncV1' - title: times - type: array - timezone: - description: A TZ-database timezone for this sync schedule. - title: timezone - type: string - required: - - times - - timezone - title: AdvancedWarehouseSyncScheduleV1Input - type: object - AdvancedWarehouseSyncScheduleV1Output: - description: Defines the advanced sync schedule for a Warehouse. - properties: - times: - description: A list that contains the times when syncs should occur. - items: - $ref: '#/components/schemas/WarehouseAdvancedSyncV1' - title: times - type: array - timezone: - description: A TZ-database timezone for this sync schedule. - title: timezone - type: string - title: AdvancedWarehouseSyncScheduleV1Output - type: object - ListWarehousesV1Input: - description: Gets a list of Warehouses belonging to a Workspace. - properties: {} - required: - - pagination - title: ListWarehousesV1Input - type: object - ListWarehousesV1Output: - description: Returns a list of Warehouses that belong to a Workspace. - example: - pagination: null - warehouses: - - settings: "" - metadata: null - id: id - enabled: true - workspaceId: workspaceId - - settings: "" - metadata: null - id: id - enabled: true - workspaceId: workspaceId - properties: - warehouses: - description: A list of Warehouses that belong to the Workspace. - items: - $ref: '#/components/schemas/WarehouseV1' - title: warehouses - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - warehouses - title: ListWarehousesV1Output - type: object - GetWarehouseV1Input: - description: Looks up a Warehouse by id. - properties: {} - required: - - warehouseId - title: GetWarehouseV1Input - type: object - GetWarehouseV1Output: - description: Returns a Warehouse. - example: - warehouse: null - properties: - warehouse: - $ref: '#/components/schemas/warehouse' - required: - - warehouse - title: GetWarehouseV1Output - type: object - ListConnectedSourcesFromWarehouseV1Input: - description: Looks up the list of Sources connected to a Warehouse. - properties: {} - title: ListConnectedSourcesFromWarehouseV1Input - type: object - ListConnectedSourcesFromWarehouseV1Output: - description: Returns a list of Sources connected to a Warehouse. - example: - pagination: null - sources: - - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - sources: - description: A list that contains the Sources connected to the requested - Warehouse. - items: - $ref: '#/components/schemas/SourceV1' - title: sources - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - sources - title: ListConnectedSourcesFromWarehouseV1Output - type: object - ListSyncsFromWarehouseV1Input: - description: Requests the overview of syncs for every Source connected to this - Warehouse. - properties: {} - title: ListSyncsFromWarehouseV1Input - type: object - ListSyncsFromWarehouseV1Output: - description: Returns an overview page that contains the last syncs for a Warehouse. - example: - reports: - - sourceId: sourceId - duration: 0.8008281904610115 - notices: - - createdAt: createdAt - level: level - message: message - - createdAt: createdAt - level: level - message: message - humanDuration: humanDuration - start: start - count: 6.027456183070403 - end: end - status: status - - sourceId: sourceId - duration: 0.8008281904610115 - notices: - - createdAt: createdAt - level: level - message: message - - createdAt: createdAt - level: level - message: message - humanDuration: humanDuration - start: start - count: 6.027456183070403 - end: end - status: status - pagination: null - properties: - reports: - description: A list that contains the latest syncs for the specified Warehouse. - items: - $ref: '#/components/schemas/SyncV1' - title: reports - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - reports - title: ListSyncsFromWarehouseV1Output - type: object - ListSyncsFromWarehouseAndSourceV1Input: - description: Loads the most recent sync information for a Warehouse-source pair. - properties: {} - title: ListSyncsFromWarehouseAndSourceV1Input - type: object - ListSyncsFromWarehouseAndSourceV1Output: - description: "Returns a list that contains the most recent syncs for a Warehouse-source\ - \ pair, filtered and constrained by a given\nset of pagination parameters." - example: - reports: - - sourceId: sourceId - duration: 0.8008281904610115 - notices: - - createdAt: createdAt - level: level - message: message - - createdAt: createdAt - level: level - message: message - humanDuration: humanDuration - start: start - count: 6.027456183070403 - end: end - status: status - - sourceId: sourceId - duration: 0.8008281904610115 - notices: - - createdAt: createdAt - level: level - message: message - - createdAt: createdAt - level: level - message: message - humanDuration: humanDuration - start: start - count: 6.027456183070403 - end: end - status: status - pagination: null - properties: - reports: - description: A list that contains the latest syncs for the specified Warehouse-source - pair. - items: - $ref: '#/components/schemas/SyncV1' - title: reports - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - pagination - - reports - title: ListSyncsFromWarehouseAndSourceV1Output - type: object - AddConnectionFromSourceToWarehouseV1Input: - description: "Connects a Source to a Warehouse.\n\nPosting to this idempotent\ - \ endpoint creates a connection between the Source and Warehouse, and begins\ - \ syncing data\nfrom the Source's collections into the chosen Warehouse Destination." - properties: {} - title: AddConnectionFromSourceToWarehouseV1Input - type: object - AddConnectionFromSourceToWarehouseV1Output: - description: Response indicating whether the connection was successful. - example: - status: CONNECTED - properties: - status: - description: The status of the connection between the Source and Warehouse. - enum: - - CONNECTED - - NOT_CONNECTED - title: status - type: string - required: - - status - title: AddConnectionFromSourceToWarehouseV1Output - type: object - RemoveSourceConnectionFromWarehouseV1Input: - description: "Disconnects a Source from a Warehouse.\n\nPosting to this idempotent\ - \ endpoint removes a connection between the Source and Warehouse, and blocks\ - \ all syncing\nfrom the Source's collections into the chosen Warehouse Destination." - properties: {} - title: RemoveSourceConnectionFromWarehouseV1Input - type: object - RemoveSourceConnectionFromWarehouseV1Output: - description: Response indicating whether the disconnection was successful. - example: - status: SUCCESS - properties: - status: - description: The status of the request to disconnect the Source and Warehouse. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: RemoveSourceConnectionFromWarehouseV1Output - type: object - ListSelectiveSyncsFromWarehouseAndSourceV1Input: - description: Get the Selective Sync configuration associated with a Warehouse. - properties: {} - title: ListSelectiveSyncsFromWarehouseAndSourceV1Input - type: object - ListSelectiveSyncsFromWarehouseAndSourceV1Output: - description: Results containing the Selective Sync configuration for a Warehouse. - example: - pagination: null - items: - - sourceId: sourceId - warehouseId: warehouseId - collection: collection - properties: - key: "" - - sourceId: sourceId - warehouseId: warehouseId - collection: collection - properties: - key: "" - properties: - items: - description: "Represents a list of Source, collection, and properties synced\ - \ to the Warehouse." - items: - $ref: '#/components/schemas/WarehouseSelectiveSyncItemV1' - title: items - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - items - - pagination - title: ListSelectiveSyncsFromWarehouseAndSourceV1Output - type: object - UpdateSelectiveSyncForWarehouseV1Input: - description: Updates the schema for a Warehouse/sources pair. - properties: - syncOverrides: - description: A list of sync schema overrides to apply to this Warehouse. - items: - $ref: '#/components/schemas/WarehouseSyncOverrideV1' - title: syncOverrides - type: array - title: UpdateSelectiveSyncForWarehouseV1Input - type: object - UpdateSelectiveSyncForWarehouseV1Output: - description: Results from updating the schema for a Warehouse/source pair. - example: - warnings: - - warnings - - warnings - status: UNCHANGED - properties: - status: - description: Status of the update operation. - enum: - - UNCHANGED - - UPDATED - title: status - type: string - warnings: - description: Warnings returned by the operation. - items: - type: string - title: warnings - type: array - required: - - status - - warnings - title: UpdateSelectiveSyncForWarehouseV1Output - type: object - GetAdvancedSyncScheduleFromWarehouseV1Input: - description: Gets the advanced sync schedule for a Warehouse. - properties: {} - required: - - warehouseId - title: GetAdvancedSyncScheduleFromWarehouseV1Input - type: object - GetAdvancedSyncScheduleFromWarehouseV1Output: - description: Returns the advanced sync schedule for a Warehouse. - example: - schedule: null - enabled: true - properties: - enabled: - description: Indicates if an advanced sync schedule is enabled for this - Warehouse. - title: enabled - type: boolean - schedule: - $ref: '#/components/schemas/schedule' - required: - - enabled - title: GetAdvancedSyncScheduleFromWarehouseV1Output - type: object - ReplaceAdvancedSyncScheduleForWarehouseV1Input: - description: Replaces the advanced sync schedule for a Warehouse. - properties: - enabled: - description: Enable to turn on an advanced sync schedule for the Warehouse. - title: enabled - type: boolean - schedule: - $ref: '#/components/schemas/schedule_1' - title: ReplaceAdvancedSyncScheduleForWarehouseV1Input - type: object - ReplaceAdvancedSyncScheduleForWarehouseV1Output: - description: Returns the advanced sync schedule for a Warehouse. - example: - schedule: null - enabled: true - properties: - enabled: - description: Indicates if an advanced sync schedule is enabled for the Warehouse. - title: enabled - type: boolean - schedule: - $ref: '#/components/schemas/schedule_2' - required: - - enabled - title: ReplaceAdvancedSyncScheduleForWarehouseV1Output - type: object - CreateWarehouseV1Input: - description: Create a new Warehouse based on a set of parameters. - properties: - metadataId: - description: The Warehouse metadata to use. - title: metadataId - type: string - name: - description: An optional human-readable name for this Warehouse. - title: name - type: string - enabled: - description: Enable to allow this Warehouse to receive data. Defaults to - true. - title: enabled - type: boolean - settings: - allOf: - - $ref: '#/components/schemas/WarehouseSettingsV1' - description: |- - A key-value object that contains instance-specific settings for a Warehouse. - - Different kinds of Warehouses require different settings. The required and optional settings - for a Warehouse are described in the `options` object of the associated Warehouse metadata. - - You can find the full list of Warehouse metadata and related settings information in the - `/catalog/warehouses` endpoint. - title: settings - required: - - metadataId - - settings - title: CreateWarehouseV1Input - type: object - CreateWarehouseV1Output: - description: Returns the newly created Warehouse. - example: - warehouse: null - properties: - warehouse: - $ref: '#/components/schemas/warehouse_1' - required: - - warehouse - title: CreateWarehouseV1Output - type: object - UpdateWarehouseV1Input: - description: Updates an existing Warehouse based on a set of parameters. - properties: - name: - description: An optional human-readable name to associate with this Warehouse. - nullable: true - title: name - type: string - enabled: - description: Enable to allow this Warehouse to receive data. - title: enabled - type: boolean - settings: - allOf: - - $ref: '#/components/schemas/WarehouseSettingsV1' - description: |- - A key-value object that contains instance-specific settings for a Warehouse. - - Different kinds of Warehouses require different settings. The required and optional settings - for a Warehouse are described in the `options` object of the associated Warehouse metadata. - - You can find the full list of Warehouse metadata and related settings information in the - `/catalog/warehouses` endpoint. - title: settings - title: UpdateWarehouseV1Input - type: object - UpdateWarehouseV1Output: - description: Returns the updated Warehouse. - example: - warehouse: null - properties: - warehouse: - $ref: '#/components/schemas/warehouse_2' - required: - - warehouse - title: UpdateWarehouseV1Output - type: object - DeleteWarehouseV1Input: - description: Deletes an existing Warehouse by id. - properties: {} - required: - - warehouseId - title: DeleteWarehouseV1Input - type: object - DeleteWarehouseV1Output: - description: Returns the status of a Warehouse deletion. - example: - status: SUCCESS - properties: - status: - description: The status of the Warehouse deletion operation. - enum: - - SUCCESS - title: status - type: string - required: - - status - title: DeleteWarehouseV1Output - type: object - GetConnectionStateFromWarehouseV1Input: - description: "Verifies the connection state of a Warehouse.\n\nUse this to check\ - \ if a Warehouse is reachable, given its stored connection settings." - properties: {} - required: - - warehouseId - title: GetConnectionStateFromWarehouseV1Input - type: object - GetConnectionStateFromWarehouseV1Output: - description: Returns the status of a Warehouse connection settings after an - attempt to connect to it. - example: - connectionState: CONNECTED - properties: - connectionState: - description: Represents the status for the current connection settings. - enum: - - CONNECTED - - FAILED - title: connectionState - type: string - required: - - connectionState - title: GetConnectionStateFromWarehouseV1Output - type: object - CreateValidationInWarehouseV1Output: - description: Returns the status of a Warehouse connection settings after an - attempt to connect to it. - example: - status: CONNECTED - properties: - status: - description: Represents the status for the current connection settings. - enum: - - CONNECTED - - FAILED - title: status - type: string - required: - - status - title: CreateValidationInWarehouseV1Output - type: object - CreateValidationInWarehouseV1Input: - description: Verifies a set of Warehouse credentials by attempting to connect - to it. - properties: - metadataId: - description: The id of the Warehouse metadata type. - title: metadataId - type: string - settings: - allOf: - - $ref: '#/components/schemas/WarehouseSettingsV1' - description: The settings to check. - title: settings - required: - - metadataId - - settings - title: CreateValidationInWarehouseV1Input - type: object - WorkspaceV1: - description: An organized group of Sources and Destinations managed by a team. - properties: - id: - description: The unique identifier. - title: id - type: string - slug: - description: The URL-friendly slug. - title: slug - type: string - name: - description: The human-readable name. - title: name - type: string - required: - - id - - name - - slug - title: WorkspaceV1 - type: object - GetWorkspaceV1Input: - description: Loads the Workspace associated with the token. - title: GetWorkspaceV1Input - type: object - GetWorkspaceV1Output: - description: Represents the output of loading the Workspace. - example: - workspace: null - properties: - workspace: - $ref: '#/components/schemas/workspace' - required: - - workspace - title: GetWorkspaceV1Output - type: object - RequestError: - description: Represents any error that could have occurred while performing - a request. - properties: - type: - description: "The type for this error (validation, server, unknown, etc)." - title: type - type: string - message: - description: An error message attached to this error. - title: message - type: string - field: - description: The name of an input field from the request that triggered - this error. - title: field - type: string - data: - description: Any extra data associated with this error. - title: data - status: - description: Http status code. - title: status - type: number - required: - - type - title: RequestError - type: object - PaginationInput: - description: "Pagination parameters.\n\nEvery resource that returns a list of\ - \ items in its `Output` object may contain a `PaginationInput` in its `Input`\n\ - object. Required, though some of its fields are optional." - properties: - cursor: - description: "The page to request.\n\nAcceptable values to use here are\ - \ in PaginationOutput objects, in the `current`, `next`, and `previous`\ - \ keys.\n\nConsumers of the API must treat this value as opaque." - title: cursor - type: string - count: - description: "The number of items to retrieve in a page, between 1 and 200." - title: count - type: number - required: - - count - title: PaginationInput - type: object - PaginationOutput: - description: "Pagination metadata for a list response.\n\nResponses return this\ - \ object alongside a list of resources, which provides the necessary metadata\ - \ for manipulating a\npaginated collection. In operations that return lists,\ - \ it's always present, though some of its fields might not be." - properties: - current: - description: |- - The current cursor within a collection. - - Consumers of the API must treat this value as opaque. - title: current - type: string - next: - description: |- - A pointer to the next page. - - This does not return when you retrieve the last page. - - Consumers of the API must treat this value as opaque. - nullable: true - title: next - type: string - previous: - description: |- - A pointer to the previous page. - - This does not return when you retrieve the first page. - - Consumers of the API must treat this value as opaque. - nullable: true - title: previous - type: string - totalEntries: - description: "The total number of entries available in the collection.\n\ - \nIf calculating it impacts performance, the response may omit this field." - title: totalEntries - type: number - required: - - current - title: PaginationOutput - type: object - RequestErrorEnvelope: - description: Envelope type for RequestErrors. - properties: - errors: - items: - $ref: '#/components/schemas/RequestError' - type: array - required: - - errors - title: RequestErrorEnvelope - type: object - addConnectionFromSourceToWarehouse_200_response: - example: - data: - status: CONNECTED - properties: - data: - $ref: '#/components/schemas/AddConnectionFromSourceToWarehouseV1Output' - removeSourceConnectionFromWarehouse_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/RemoveSourceConnectionFromWarehouseV1Output' - replaceLabelsInSource_200_response: - example: - data: - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - data: - $ref: '#/components/schemas/ReplaceLabelsInSourceAlphaOutput' - replaceLabelsInSource_200_response_1: - properties: - data: - $ref: '#/components/schemas/ReplaceLabelsInSourceV1Output' - addLabelsToSource_200_response: - example: - data: - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - data: - $ref: '#/components/schemas/AddLabelsToSourceAlphaOutput' - addLabelsToSource_200_response_1: - properties: - data: - $ref: '#/components/schemas/AddLabelsToSourceV1Output' - replacePermissionsForUser_200_response: - example: - data: - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - data: - $ref: '#/components/schemas/ReplacePermissionsForUserV1Output' - addPermissionsToUser_200_response: - example: - data: - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - data: - $ref: '#/components/schemas/AddPermissionsToUserV1Output' - replacePermissionsForUserGroup_200_response: - example: - data: - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - data: - $ref: '#/components/schemas/ReplacePermissionsForUserGroupV1Output' - addPermissionsToUserGroup_200_response: - example: - data: - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - data: - $ref: '#/components/schemas/AddPermissionsToUserGroupV1Output' - listSourcesFromTrackingPlan_200_response: - example: - data: - pagination: null - sources: - - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - data: - $ref: '#/components/schemas/ListSourcesFromTrackingPlanV1Output' - addSourceToTrackingPlan_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/AddSourceToTrackingPlanV1Output' - removeSourceFromTrackingPlan_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/RemoveSourceFromTrackingPlanV1Output' - listUsersFromUserGroup_200_response: - example: - data: - pagination: null - users: - - name: name - id: id - email: email - - name: name - id: id - email: email - properties: - data: - $ref: '#/components/schemas/ListUsersFromUserGroupV1Output' - addUsersToUserGroup_200_response: - example: - data: - userGroup: null - properties: - data: - $ref: '#/components/schemas/AddUsersToUserGroupV1Output' - batchQueryMessagingSubscriptionsForSpace_200_response: - example: - data: - failures: - - type: type - key: key - errors: - - code: code - message: message - - code: code - message: message - - type: type - key: key - errors: - - code: code - message: message - - code: code - message: message - pagination: null - successes: - - type: EMAIL - key: key - status: DID_NOT_SUBSCRIBE - - type: EMAIL - key: key - status: DID_NOT_SUBSCRIBE - errors: - - code: code - message: message - - code: code - message: message - properties: - data: - $ref: '#/components/schemas/BatchQueryMessagingSubscriptionsForSpaceAlphaOutput' - createCloudSourceRegulation_200_response: - example: - data: - regulateId: regulateId - properties: - data: - $ref: '#/components/schemas/CreateCloudSourceRegulationV1Output' - listDestinations_200_response: - example: - data: - pagination: null - destinations: - - sourceId: sourceId - settings: - key: "" - metadata: null - name: name - id: id - enabled: true - - sourceId: sourceId - settings: - key: "" - metadata: null - name: name - id: id - enabled: true - properties: - data: - $ref: '#/components/schemas/ListDestinationsV1Output' - createDestination_200_response: - example: - data: - destination: null - properties: - data: - $ref: '#/components/schemas/CreateDestinationV1Output' - listSubscriptionsFromDestination_200_response: - example: - data: - subscriptions: - - actionSlug: actionSlug - settings: "" - name: name - actionId: actionId - id: id - trigger: trigger - destinationId: destinationId - enabled: true - - actionSlug: actionSlug - settings: "" - name: name - actionId: actionId - id: id - trigger: trigger - destinationId: destinationId - enabled: true - pagination: null - properties: - data: - $ref: '#/components/schemas/ListSubscriptionsFromDestinationAlphaOutput' - createDestinationSubscription_200_response: - example: - data: - destinationSubscription: null - properties: - data: - $ref: '#/components/schemas/CreateDestinationSubscriptionAlphaOutput' - createEdgeFunctions_200_response: - example: - data: - edgeFunctions: null - properties: - data: - $ref: '#/components/schemas/CreateEdgeFunctionsAlphaOutput' - listFiltersFromDestination_200_response: - example: - data: - pagination: null - filters: - - sourceId: sourceId - createdAt: createdAt - description: description - id: id - destinationId: destinationId - title: title - if: if - actions: - - path: path - type: ALLOW_PROPERTIES - fields: - key: "" - percent: 0.8008281904610115 - - path: path - type: ALLOW_PROPERTIES - fields: - key: "" - percent: 0.8008281904610115 - enabled: true - updatedAt: updatedAt - - sourceId: sourceId - createdAt: createdAt - description: description - id: id - destinationId: destinationId - title: title - if: if - actions: - - path: path - type: ALLOW_PROPERTIES - fields: - key: "" - percent: 0.8008281904610115 - - path: path - type: ALLOW_PROPERTIES - fields: - key: "" - percent: 0.8008281904610115 - enabled: true - updatedAt: updatedAt - properties: - data: - $ref: '#/components/schemas/ListFiltersFromDestinationV1Output' - createFilterForDestination_200_response: - example: - data: - filter: null - properties: - data: - $ref: '#/components/schemas/CreateFilterForDestinationV1Output' - listFunctions_200_response: - example: - data: - pagination: null - functions: - - createdAt: createdAt - catalogId: catalogId - createdBy: createdBy - displayName: displayName - description: description - id: id - logoUrl: logoUrl - resourceType: DESTINATION - - createdAt: createdAt - catalogId: catalogId - createdBy: createdBy - displayName: displayName - description: description - id: id - logoUrl: logoUrl - resourceType: DESTINATION - properties: - data: - $ref: '#/components/schemas/ListFunctionsV1Output' - createFunction_200_response: - example: - data: - function: null - properties: - data: - $ref: '#/components/schemas/CreateFunctionV1Output' - createFunctionDeployment_200_response: - example: - data: - functionDeployment: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/CreateFunctionDeploymentV1Output' - listInvites_200_response: - example: - data: - pagination: null - invites: - - invites - - invites - properties: - data: - $ref: '#/components/schemas/ListInvitesV1Output' - createInvites_200_response: - example: - data: - emails: - - emails - - emails - properties: - data: - $ref: '#/components/schemas/CreateInvitesV1Output' - deleteInvites_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/DeleteInvitesV1Output' - listLabels_200_response: - example: - data: - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - data: - $ref: '#/components/schemas/ListLabelsAlphaOutput' - listLabels_200_response_1: - properties: - data: - $ref: '#/components/schemas/ListLabelsV1Output' - createLabel_200_response: - example: - data: - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - data: - $ref: '#/components/schemas/CreateLabelAlphaOutput' - createLabel_200_response_1: - properties: - data: - $ref: '#/components/schemas/CreateLabelV1Output' - listSources_200_response: - example: - data: - pagination: null - sources: - - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - data: - $ref: '#/components/schemas/ListSourcesAlphaOutput' - listSources_200_response_1: - properties: - data: - $ref: '#/components/schemas/ListSourcesV1Output' - createSource_200_response: - example: - data: - source: null - properties: - data: - $ref: '#/components/schemas/CreateSourceAlphaOutput' - createSource_200_response_1: - properties: - data: - $ref: '#/components/schemas/CreateSourceV1Output' - listRegulationsFromSource_200_response: - example: - data: - regulations: - - createdAt: createdAt - subjects: - - subjects - - subjects - id: id - subjectType: subjectType - status: FAILED - finishedAt: finishedAt - - createdAt: createdAt - subjects: - - subjects - - subjects - id: id - subjectType: subjectType - status: FAILED - finishedAt: finishedAt - properties: - data: - $ref: '#/components/schemas/ListRegulationsFromSourceV1Output' - createSourceRegulation_200_response: - example: - data: - regulateId: regulateId - properties: - data: - $ref: '#/components/schemas/CreateSourceRegulationV1Output' - listTrackingPlans_200_response: - example: - data: - pagination: null - trackingPlans: - - createdAt: createdAt - name: name - description: description - id: id - type: LIVE - slug: slug - updatedAt: updatedAt - - createdAt: createdAt - name: name - description: description - id: id - type: LIVE - slug: slug - updatedAt: updatedAt - properties: - data: - $ref: '#/components/schemas/ListTrackingPlansV1Output' - createTrackingPlan_200_response: - example: - data: - trackingPlan: null - properties: - data: - $ref: '#/components/schemas/CreateTrackingPlanV1Output' - listTransformations_200_response: - example: - data: - pagination: null - transformations: - - sourceId: sourceId - newEventName: newEventName - name: name - destinationMetadataId: destinationMetadataId - id: id - if: if - enabled: true - propertyRenames: - - newName: newName - oldName: oldName - - newName: newName - oldName: oldName - - sourceId: sourceId - newEventName: newEventName - name: name - destinationMetadataId: destinationMetadataId - id: id - if: if - enabled: true - propertyRenames: - - newName: newName - oldName: oldName - - newName: newName - oldName: oldName - properties: - data: - $ref: '#/components/schemas/ListTransformationsBetaOutput' - createTransformation_200_response: - example: - data: - transformation: null - properties: - data: - $ref: '#/components/schemas/CreateTransformationBetaOutput' - listUserGroups_200_response: - example: - data: - userGroups: - - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - memberCount: 0.8008281904610115 - name: name - id: id - - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - memberCount: 0.8008281904610115 - name: name - id: id - pagination: null - properties: - data: - $ref: '#/components/schemas/ListUserGroupsV1Output' - createUserGroup_200_response: - example: - data: - userGroup: null - properties: - data: - $ref: '#/components/schemas/CreateUserGroupV1Output' - createValidationInWarehouse_200_response: - example: - data: - status: CONNECTED - properties: - data: - $ref: '#/components/schemas/CreateValidationInWarehouseV1Output' - listWarehouses_200_response: - example: - data: - pagination: null - warehouses: - - settings: "" - metadata: null - id: id - enabled: true - workspaceId: workspaceId - - settings: "" - metadata: null - id: id - enabled: true - workspaceId: workspaceId - properties: - data: - $ref: '#/components/schemas/ListWarehousesV1Output' - createWarehouse_200_response: - example: - data: - warehouse: null - properties: - data: - $ref: '#/components/schemas/CreateWarehouseV1Output' - listWorkspaceRegulations_200_response: - example: - data: - pagination: null - regulations: - - createdAt: createdAt - subjects: - - subjects - - subjects - id: id - subjectType: subjectType - status: FAILED - finishedAt: finishedAt - - createdAt: createdAt - subjects: - - subjects - - subjects - id: id - subjectType: subjectType - status: FAILED - finishedAt: finishedAt - properties: - data: - $ref: '#/components/schemas/ListWorkspaceRegulationsV1Output' - createWorkspaceRegulation_200_response: - example: - data: - regulateId: regulateId - properties: - data: - $ref: '#/components/schemas/CreateWorkspaceRegulationV1Output' - getDestination_200_response: - example: - data: - destination: null - properties: - data: - $ref: '#/components/schemas/GetDestinationV1Output' - deleteDestination_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/DeleteDestinationV1Output' - updateDestination_200_response: - example: - data: - destination: null - properties: - data: - $ref: '#/components/schemas/UpdateDestinationV1Output' - getFunction_200_response: - example: - data: - function: null - properties: - data: - $ref: '#/components/schemas/GetFunctionV1Output' - deleteFunction_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/DeleteFunctionV1Output' - updateFunction_200_response: - example: - data: - function: null - properties: - data: - $ref: '#/components/schemas/UpdateFunctionV1Output' - deleteLabel_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/DeleteLabelAlphaOutput' - deleteLabel_200_response_1: - properties: - data: - $ref: '#/components/schemas/DeleteLabelV1Output' - getRegulation_200_response: - example: - data: - regulation: - createdAt: createdAt - id: id - streamStatus: - - id: id - destinationStatus: - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - - id: id - destinationStatus: - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - overallStatus: FAILED - workspaceId: workspaceId - finishedAt: finishedAt - properties: - data: - $ref: '#/components/schemas/GetRegulationV1Output' - deleteRegulation_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/DeleteRegulationV1Output' - getSource_200_response: - example: - data: - source: null - properties: - data: - $ref: '#/components/schemas/GetSourceAlphaOutput' - getSource_200_response_1: - properties: - data: - $ref: '#/components/schemas/GetSourceV1Output' - deleteSource_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/DeleteSourceAlphaOutput' - deleteSource_200_response_1: - properties: - data: - $ref: '#/components/schemas/DeleteSourceV1Output' - updateSource_200_response: - example: - data: - source: null - properties: - data: - $ref: '#/components/schemas/UpdateSourceAlphaOutput' - updateSource_200_response_1: - properties: - data: - $ref: '#/components/schemas/UpdateSourceV1Output' - getTrackingPlan_200_response: - example: - data: - trackingPlan: null - properties: - data: - $ref: '#/components/schemas/GetTrackingPlanV1Output' - deleteTrackingPlan_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/DeleteTrackingPlanV1Output' - updateTrackingPlan_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/UpdateTrackingPlanV1Output' - getTransformation_200_response: - example: - data: - transformation: null - properties: - data: - $ref: '#/components/schemas/GetTransformationBetaOutput' - deleteTransformation_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/DeleteTransformationBetaOutput' - updateTransformation_200_response: - example: - data: - transformation: null - properties: - data: - $ref: '#/components/schemas/UpdateTransformationBetaOutput' - getUserGroup_200_response: - example: - data: - userGroup: null - properties: - data: - $ref: '#/components/schemas/GetUserGroupV1Output' - deleteUserGroup_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/DeleteUserGroupV1Output' - updateUserGroup_200_response: - example: - data: - userGroup: null - properties: - data: - $ref: '#/components/schemas/UpdateUserGroupV1Output' - listUsers_200_response: - example: - data: - pagination: null - users: - - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - name: name - id: id - email: email - - permissions: - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - roleId: roleId - roleName: roleName - resources: - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - id: id - type: FUNCTION - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - name: name - id: id - email: email - properties: - data: - $ref: '#/components/schemas/ListUsersV1Output' - deleteUsers_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/DeleteUsersV1Output' - getWarehouse_200_response: - example: - data: - warehouse: null - properties: - data: - $ref: '#/components/schemas/GetWarehouseV1Output' - deleteWarehouse_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/DeleteWarehouseV1Output' - updateWarehouse_200_response: - example: - data: - warehouse: null - properties: - data: - $ref: '#/components/schemas/UpdateWarehouseV1Output' - disableEdgeFunctions_200_response: - example: - data: - edgeFunctions: null - properties: - data: - $ref: '#/components/schemas/DisableEdgeFunctionsAlphaOutput' - echo_200_response: - example: - data: - headers: - key: "" - method: get - message: message - properties: - data: - $ref: '#/components/schemas/EchoAlphaOutput' - echo_200_response_1: - properties: - data: - $ref: '#/components/schemas/EchoV1Output' - generateUploadURLForEdgeFunctions_200_response: - example: - data: - uploadURL: uploadURL - properties: - data: - $ref: '#/components/schemas/GenerateUploadURLForEdgeFunctionsAlphaOutput' - getAdvancedSyncScheduleFromWarehouse_200_response: - example: - data: - schedule: null - enabled: true - properties: - data: - $ref: '#/components/schemas/GetAdvancedSyncScheduleFromWarehouseV1Output' - replaceAdvancedSyncScheduleForWarehouse_200_response: - example: - data: - schedule: null - enabled: true - properties: - data: - $ref: '#/components/schemas/ReplaceAdvancedSyncScheduleForWarehouseV1Output' - getConnectionStateFromWarehouse_200_response: - example: - data: - connectionState: CONNECTED - properties: - data: - $ref: '#/components/schemas/GetConnectionStateFromWarehouseV1Output' - getDailyPerSourceAPICallsUsage_200_response: - example: - data: - pagination: null - dailyPerSourceAPICallsUsage: - - sourceId: sourceId - apiCalls: apiCalls - timestamp: timestamp - - sourceId: sourceId - apiCalls: apiCalls - timestamp: timestamp - properties: - data: - $ref: '#/components/schemas/GetDailyPerSourceAPICallsUsageV1Output' - getDailyPerSourceMTUUsage_200_response: - example: - data: - pagination: null - dailyPerSourceMTUUsage: - - sourceId: sourceId - neverIdentified: neverIdentified - identified: identified - anonymousIdentified: anonymousIdentified - anonymous: anonymous - periodStart: 0.8008281904610115 - periodEnd: 6.027456183070403 - timestamp: timestamp - - sourceId: sourceId - neverIdentified: neverIdentified - identified: identified - anonymousIdentified: anonymousIdentified - anonymous: anonymous - periodStart: 0.8008281904610115 - periodEnd: 6.027456183070403 - timestamp: timestamp - properties: - data: - $ref: '#/components/schemas/GetDailyPerSourceMTUUsageV1Output' - getDailyWorkspaceAPICallsUsage_200_response: - example: - data: - dailyWorkspaceAPICallsUsage: - - apiCalls: apiCalls - timestamp: timestamp - - apiCalls: apiCalls - timestamp: timestamp - pagination: null - properties: - data: - $ref: '#/components/schemas/GetDailyWorkspaceAPICallsUsageV1Output' - getDailyWorkspaceMTUUsage_200_response: - example: - data: - pagination: null - dailyWorkspaceMTUUsage: - - neverIdentified: neverIdentified - identified: identified - anonymousIdentified: anonymousIdentified - anonymous: anonymous - periodStart: 0.8008281904610115 - periodEnd: 6.027456183070403 - timestamp: timestamp - - neverIdentified: neverIdentified - identified: identified - anonymousIdentified: anonymousIdentified - anonymous: anonymous - periodStart: 0.8008281904610115 - periodEnd: 6.027456183070403 - timestamp: timestamp - properties: - data: - $ref: '#/components/schemas/GetDailyWorkspaceMTUUsageV1Output' - getDestinationMetadata_200_response: - example: - data: - destinationMetadata: null - properties: - data: - $ref: '#/components/schemas/GetDestinationMetadataV1Output' - getDestinationsCatalog_200_response: - example: - data: - pagination: null - destinationsCatalog: - - website: website - components: - - owner: PARTNER - code: code - type: ANDROID - - owner: PARTNER - code: code - type: ANDROID - supportedFeatures: null - description: description - logos: null - presets: - - name: name - actionId: actionId - trigger: trigger - fields: - key: "" - - name: name - actionId: actionId - trigger: trigger - fields: - key: "" - supportedMethods: null - previousNames: - - previousNames - - previousNames - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - id: id - categories: - - categories - - categories - supportedPlatforms: null - partnerOwned: true - actions: - - defaultTrigger: defaultTrigger - hidden: true - name: name - description: description - id: id - fields: - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - slug: slug - platform: CLOUD - - defaultTrigger: defaultTrigger - hidden: true - name: name - description: description - id: id - fields: - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - slug: slug - platform: CLOUD - slug: slug - contacts: - - role: role - isPrimary: true - name: name - email: email - - role: role - isPrimary: true - name: name - email: email - status: DEPRECATED - - website: website - components: - - owner: PARTNER - code: code - type: ANDROID - - owner: PARTNER - code: code - type: ANDROID - supportedFeatures: null - description: description - logos: null - presets: - - name: name - actionId: actionId - trigger: trigger - fields: - key: "" - - name: name - actionId: actionId - trigger: trigger - fields: - key: "" - supportedMethods: null - previousNames: - - previousNames - - previousNames - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - id: id - categories: - - categories - - categories - supportedPlatforms: null - partnerOwned: true - actions: - - defaultTrigger: defaultTrigger - hidden: true - name: name - description: description - id: id - fields: - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - slug: slug - platform: CLOUD - - defaultTrigger: defaultTrigger - hidden: true - name: name - description: description - id: id - fields: - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - - fieldKey: fieldKey - defaultValue: "" - multiple: true - description: description - label: label - type: BOOLEAN - required: true - sortOrder: 0.8008281904610115 - dynamic: true - allowNull: true - id: id - placeholder: placeholder - choices: "" - slug: slug - platform: CLOUD - slug: slug - contacts: - - role: role - isPrimary: true - name: name - email: email - - role: role - isPrimary: true - name: name - email: email - status: DEPRECATED - properties: - data: - $ref: '#/components/schemas/GetDestinationsCatalogV1Output' - getEventsVolumeFromWorkspace_200_response: - example: - data: - result: - - total: 0.8008281904610115 - series: - - count: 6.027456183070403 - time: time - - count: 6.027456183070403 - time: time - eventName: eventName - source: null - eventType: eventType - - total: 0.8008281904610115 - series: - - count: 6.027456183070403 - time: time - - count: 6.027456183070403 - time: time - eventName: eventName - source: null - eventType: eventType - pagination: null - properties: - data: - $ref: '#/components/schemas/GetEventsVolumeFromWorkspaceV1Output' - getFilterInDestination_200_response: - example: - data: - filter: null - properties: - data: - $ref: '#/components/schemas/GetFilterInDestinationV1Output' - removeFilterFromDestination_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/RemoveFilterFromDestinationV1Output' - updateFilterForDestination_200_response: - example: - data: - filter: null - properties: - data: - $ref: '#/components/schemas/UpdateFilterForDestinationV1Output' - getLatestFromEdgeFunctions_200_response: - example: - data: - edgeFunctions: null - properties: - data: - $ref: '#/components/schemas/GetLatestFromEdgeFunctionsAlphaOutput' - getSourceMetadata_200_response: - example: - data: - sourceMetadata: null - properties: - data: - $ref: '#/components/schemas/GetSourceMetadataV1Output' - getSourcesCatalog_200_response: - example: - data: - pagination: null - sourcesCatalog: - - isCloudEventSource: true - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - description: description - id: id - categories: - - categories - - categories - logos: null - slug: slug - - isCloudEventSource: true - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - description: description - id: id - categories: - - categories - - categories - logos: null - slug: slug - properties: - data: - $ref: '#/components/schemas/GetSourcesCatalogV1Output' - getSpace_200_response: - example: - data: - space: null - properties: - data: - $ref: '#/components/schemas/GetSpaceAlphaOutput' - getSubscriptionFromDestination_200_response: - example: - data: - subscription: null - properties: - data: - $ref: '#/components/schemas/GetSubscriptionFromDestinationAlphaOutput' - removeSubscriptionFromDestination_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/RemoveSubscriptionFromDestinationAlphaOutput' - updateSubscriptionForDestination_200_response: - example: - data: - subscription: null - properties: - data: - $ref: '#/components/schemas/UpdateSubscriptionForDestinationAlphaOutput' - getUser_200_response: - example: - data: - user: null - properties: - data: - $ref: '#/components/schemas/GetUserV1Output' - getWarehouseMetadata_200_response: - example: - data: - warehouseMetadata: null - properties: - data: - $ref: '#/components/schemas/GetWarehouseMetadataV1Output' - getWarehousesCatalog_200_response: - example: - data: - pagination: null - warehousesCatalog: - - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - description: description - id: id - logos: null - slug: slug - - name: name - options: - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - - defaultValue: "" - name: name - description: description - label: label - type: type - required: true - description: description - id: id - logos: null - slug: slug - properties: - data: - $ref: '#/components/schemas/GetWarehousesCatalogV1Output' - getWorkspace_200_response: - example: - data: - workspace: null - properties: - data: - $ref: '#/components/schemas/GetWorkspaceV1Output' - listAuditEvents_200_response: - example: - data: - pagination: null - events: - - actor: actor - resourceId: resourceId - resourceName: resourceName - id: id - type: type - timestamp: timestamp - resourceType: resourceType - - actor: actor - resourceId: resourceId - resourceName: resourceName - id: id - type: type - timestamp: timestamp - resourceType: resourceType - properties: - data: - $ref: '#/components/schemas/ListAuditEventsV1Output' - listConnectedDestinationsFromSource_200_response: - example: - data: - pagination: null - destinations: - - sourceId: sourceId - settings: - key: "" - metadata: null - name: name - id: id - enabled: true - - sourceId: sourceId - settings: - key: "" - metadata: null - name: name - id: id - enabled: true - properties: - data: - $ref: '#/components/schemas/ListConnectedDestinationsFromSourceAlphaOutput' - listConnectedDestinationsFromSource_200_response_1: - properties: - data: - $ref: '#/components/schemas/ListConnectedDestinationsFromSourceV1Output' - listConnectedSourcesFromWarehouse_200_response: - example: - data: - pagination: null - sources: - - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - - settings: "" - metadata: null - name: name - id: id - writeKeys: - - writeKeys - - writeKeys - slug: slug - enabled: true - workspaceId: workspaceId - labels: - - description: description - value: value - key: key - - description: description - value: value - key: key - properties: - data: - $ref: '#/components/schemas/ListConnectedSourcesFromWarehouseV1Output' - listConnectedWarehousesFromSource_200_response: - example: - data: - pagination: null - warehouses: - - settings: "" - metadata: null - id: id - enabled: true - workspaceId: workspaceId - - settings: "" - metadata: null - id: id - enabled: true - workspaceId: workspaceId - properties: - data: - $ref: '#/components/schemas/ListConnectedWarehousesFromSourceAlphaOutput' - listConnectedWarehousesFromSource_200_response_1: - properties: - data: - $ref: '#/components/schemas/ListConnectedWarehousesFromSourceV1Output' - listDeliveryMetricsSummaryFromDestination_200_response: - example: - data: - deliveryMetricsSummary: null - properties: - data: - $ref: '#/components/schemas/ListDeliveryMetricsSummaryFromDestinationBetaOutput' - listInvitesFromUserGroup_200_response: - example: - data: - emails: - - emails - - emails - pagination: null - properties: - data: - $ref: '#/components/schemas/ListInvitesFromUserGroupV1Output' - listRoles_200_response: - example: - data: - pagination: null - roles: - - name: name - description: description - id: id - - name: name - description: description - id: id - properties: - data: - $ref: '#/components/schemas/ListRolesV1Output' - listRulesFromTrackingPlan_200_response: - example: - data: - pagination: null - rules: - - createdAt: createdAt - jsonSchema: "" - deprecatedAt: deprecatedAt - type: COMMON - version: 0.8008281904610115 - key: key - updatedAt: updatedAt - - createdAt: createdAt - jsonSchema: "" - deprecatedAt: deprecatedAt - type: COMMON - version: 0.8008281904610115 - key: key - updatedAt: updatedAt - properties: - data: - $ref: '#/components/schemas/ListRulesFromTrackingPlanV1Output' - replaceRulesInTrackingPlan_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/ReplaceRulesInTrackingPlanV1Output' - removeRulesFromTrackingPlan_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/RemoveRulesFromTrackingPlanV1Output' - updateRulesInTrackingPlan_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/UpdateRulesInTrackingPlanV1Output' - listSchemaSettingsInSource_200_response: - example: - data: - sourceId: sourceId - settings: null - properties: - data: - $ref: '#/components/schemas/ListSchemaSettingsInSourceV1Output' - updateSchemaSettingsInSource_200_response: - example: - data: - sourceId: sourceId - settings: null - properties: - data: - $ref: '#/components/schemas/UpdateSchemaSettingsInSourceV1Output' - listSelectiveSyncsFromWarehouseAndSource_200_response: - example: - data: - pagination: null - items: - - sourceId: sourceId - warehouseId: warehouseId - collection: collection - properties: - key: "" - - sourceId: sourceId - warehouseId: warehouseId - collection: collection - properties: - key: "" - properties: - data: - $ref: '#/components/schemas/ListSelectiveSyncsFromWarehouseAndSourceV1Output' - listSuppressions_200_response: - example: - data: - pagination: null - suppressed: - - subjectIds: - - subjectIds - - subjectIds - subjectType: subjectType - - subjectIds: - - subjectIds - - subjectIds - subjectType: subjectType - properties: - data: - $ref: '#/components/schemas/ListSuppressionsV1Output' - listSyncsFromWarehouse_200_response: - example: - data: - reports: - - sourceId: sourceId - duration: 0.8008281904610115 - notices: - - createdAt: createdAt - level: level - message: message - - createdAt: createdAt - level: level - message: message - humanDuration: humanDuration - start: start - count: 6.027456183070403 - end: end - status: status - - sourceId: sourceId - duration: 0.8008281904610115 - notices: - - createdAt: createdAt - level: level - message: message - - createdAt: createdAt - level: level - message: message - humanDuration: humanDuration - start: start - count: 6.027456183070403 - end: end - status: status - pagination: null - properties: - data: - $ref: '#/components/schemas/ListSyncsFromWarehouseV1Output' - listSyncsFromWarehouseAndSource_200_response: - example: - data: - reports: - - sourceId: sourceId - duration: 0.8008281904610115 - notices: - - createdAt: createdAt - level: level - message: message - - createdAt: createdAt - level: level - message: message - humanDuration: humanDuration - start: start - count: 6.027456183070403 - end: end - status: status - - sourceId: sourceId - duration: 0.8008281904610115 - notices: - - createdAt: createdAt - level: level - message: message - - createdAt: createdAt - level: level - message: message - humanDuration: humanDuration - start: start - count: 6.027456183070403 - end: end - status: status - pagination: null - properties: - data: - $ref: '#/components/schemas/ListSyncsFromWarehouseAndSourceV1Output' - listUserGroupsFromUser_200_response: - example: - data: - pagination: null - groups: - - name: name - id: id - - name: name - id: id - properties: - data: - $ref: '#/components/schemas/ListUserGroupsFromUserV1Output' - previewDestinationFilter_200_response: - example: - data: - result: "" - inputPayload: - key: "" - properties: - data: - $ref: '#/components/schemas/PreviewDestinationFilterV1Output' - replaceUsersInUserGroup_200_response: - example: - data: - userGroup: null - properties: - data: - $ref: '#/components/schemas/ReplaceUsersInUserGroupV1Output' - removeUsersFromUserGroup_200_response: - example: - data: - status: SUCCESS - properties: - data: - $ref: '#/components/schemas/RemoveUsersFromUserGroupV1Output' - replaceMessagingSubscriptionsInSpaces_200_response: - example: - data: - failures: - - type: EMAIL - key: key - errors: - - code: code - message: message - - code: code - message: message - status: DID_NOT_SUBSCRIBE - - type: EMAIL - key: key - errors: - - code: code - message: message - - code: code - message: message - status: DID_NOT_SUBSCRIBE - pagination: null - successes: - - type: EMAIL - key: key - errors: - - code: code - message: message - - code: code - message: message - status: DID_NOT_SUBSCRIBE - - type: EMAIL - key: key - errors: - - code: code - message: message - - code: code - message: message - status: DID_NOT_SUBSCRIBE - properties: - data: - $ref: '#/components/schemas/ReplaceMessagingSubscriptionsInSpacesAlphaOutput' - updateSelectiveSyncForWarehouse_200_response: - example: - data: - warnings: - - warnings - - warnings - status: UNCHANGED - properties: - data: - $ref: '#/components/schemas/UpdateSelectiveSyncForWarehouseV1Output' - pagination: - allOf: - - $ref: '#/components/schemas/PaginationOutput' - description: Information about the pagination of this response. - title: pagination - filter: - allOf: - - $ref: '#/components/schemas/PreviewDestinationFilterV1' - description: The filter to preview. - title: filter - filter_1: - allOf: - - $ref: '#/components/schemas/DestinationFilterV1' - description: The requested Destination filter. - title: filter - filter_2: - allOf: - - $ref: '#/components/schemas/DestinationFilterV1' - description: The newly created Destination filter. - title: filter - filter_3: - allOf: - - $ref: '#/components/schemas/DestinationFilterV1' - description: The updated Destination filter. - title: filter - logos: - allOf: - - $ref: '#/components/schemas/LogosBeta' - description: The Destination's logos. - title: logos - supportedFeatures: - allOf: - - $ref: '#/components/schemas/DestinationMetadataFeaturesV1' - description: "Features that this Destination supports.\n\nConfig API note: holds\ - \ `browserUnbundling` fields." - title: supportedFeatures - supportedMethods: - allOf: - - $ref: '#/components/schemas/DestinationMetadataMethodsV1' - description: "Methods that this Destination supports.\n\nConfig API note: equal\ - \ to `methods`." - title: supportedMethods - supportedPlatforms: - allOf: - - $ref: '#/components/schemas/DestinationMetadataPlatformsV1' - description: "Platforms from which the Destination receives events.\n\nConfig\ - \ API note: equal to `platforms`." - title: supportedPlatforms - destinationMetadata: - allOf: - - $ref: '#/components/schemas/DestinationMetadataV1' - description: The catalog item matched by id. - title: destinationMetadata - subscription: - allOf: - - $ref: '#/components/schemas/DestinationSubscription' - description: The Destination subscription. - title: subscription - destinationSubscription: - allOf: - - $ref: '#/components/schemas/DestinationSubscription' - description: The Destination subscription. - title: destinationSubscription - input: - allOf: - - $ref: '#/components/schemas/DestinationSubscriptionUpdateInput' - description: A set of valid Destination input params required for updating. - title: input - deliveryMetricsSummary: - allOf: - - $ref: '#/components/schemas/DeliveryMetricsSummaryBeta' - description: The delivery metrics summary returned. - title: deliveryMetricsSummary - metadata: - allOf: - - $ref: '#/components/schemas/DestinationMetadataV1' - description: "The metadata of the Destination of which this Destination is an\ - \ instance of. For example, Google Analytics or Amplitude." - title: metadata - destination: - allOf: - - $ref: '#/components/schemas/DestinationV1' - description: The Destination looked up. - title: destination - destination_1: - allOf: - - $ref: '#/components/schemas/DestinationV1' - description: The updated Destination. - title: destination - destination_2: - allOf: - - $ref: '#/components/schemas/DestinationV1' - description: The created Destination. - title: destination - edgeFunctions: - allOf: - - $ref: '#/components/schemas/EdgeFunctionsAlpha' - description: The created Edge Function. - title: edgeFunctions - edgeFunctions_1: - allOf: - - $ref: '#/components/schemas/EdgeFunctionsAlpha' - description: The latest version of Edge Function bundle. - title: edgeFunctions - function: - allOf: - - $ref: '#/components/schemas/FunctionV1' - description: A Function object. - nullable: true - title: function - function_1: - allOf: - - $ref: '#/components/schemas/FunctionV1' - description: A Function object. - title: function - function_2: - allOf: - - $ref: '#/components/schemas/FunctionV1' - description: The updated Function object. - title: function - functionDeployment: - description: The status of the operation. - example: - status: SUCCESS - properties: - status: - enum: - - SUCCESS - title: status - type: string - required: - - status - title: functionDeployment - type: object - user: - allOf: - - $ref: '#/components/schemas/UserV1' - description: The user object. - title: user - userGroup: - allOf: - - $ref: '#/components/schemas/UserGroupV1' - description: The newly created user group. - title: userGroup - userGroup_1: - allOf: - - $ref: '#/components/schemas/UserGroupV1' - description: The updated the user group. - title: userGroup - userGroup_2: - allOf: - - $ref: '#/components/schemas/UserGroupV1' - description: The user group returned from the query. - title: userGroup - userGroup_3: - allOf: - - $ref: '#/components/schemas/UserGroupV1' - description: The updated user group. - title: userGroup - label: - allOf: - - $ref: '#/components/schemas/LabelAlpha' - description: The new label to create in the Workspace. - title: label - label_1: - allOf: - - $ref: '#/components/schemas/LabelV1' - description: The new label to create in the Workspace. - title: label - label_2: - allOf: - - $ref: '#/components/schemas/LabelV1' - description: The newly created label. - title: label - source: - allOf: - - $ref: '#/components/schemas/EventSourceV1' - description: The Source where the events originated. - title: source - regulation: - description: The regulate request. - example: - createdAt: createdAt - id: id - streamStatus: - - id: id - destinationStatus: - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - - id: id - destinationStatus: - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - - errString: errString - name: name - id: id - status: FAILED - finishedAt: finishedAt - overallStatus: FAILED - workspaceId: workspaceId - finishedAt: finishedAt - properties: - id: - description: The id of the regulate request. - title: id - type: string - workspaceId: - description: The id of the Workspace that the regulate request belongs to. - title: workspaceId - type: string - overallStatus: - description: The current status of the regulate request. - enum: - - FAILED - - FINISHED - - INITIALIZED - - INVALID - - NOT_SUPPORTED - - PARTIAL_SUCCESS - - RUNNING - title: overallStatus - type: string - finishedAt: - description: The timestamp of when the request finished. - title: finishedAt - type: string - createdAt: - description: The timestamp of the creation of the request. - title: createdAt - type: string - streamStatus: - description: The status of each stream including all the Destinations that - correspond to the stream. - items: - $ref: '#/components/schemas/StreamStatusV1' - title: streamStatus - type: array - required: - - createdAt - - finishedAt - - id - - overallStatus - - streamStatus - - workspaceId - title: regulation - type: object - suppressed_inner: - example: - subjectIds: - - subjectIds - - subjectIds - subjectType: subjectType - properties: - subjectType: - title: subjectType - type: string - subjectIds: - items: - type: string - title: subjectIds - type: array - required: - - subjectIds - - subjectType - type: object - sourceMetadata: - allOf: - - $ref: '#/components/schemas/SourceMetadataV1' - description: The catalog item matched by id. - title: sourceMetadata - logos_1: - allOf: - - $ref: '#/components/schemas/LogosBeta' - description: The logos for this Source. - title: logos - track: - allOf: - - $ref: '#/components/schemas/TrackSourceSettingsV1' - description: Track settings. - title: track - identify: - allOf: - - $ref: '#/components/schemas/IdentifySourceSettingsV1' - description: Identify settings. - title: identify - group: - allOf: - - $ref: '#/components/schemas/GroupSourceSettingsV1' - description: Group settings. - title: group - settings: - allOf: - - $ref: '#/components/schemas/SourceSettingsOutputV1' - description: The Source settings. - title: settings - settings_1: - allOf: - - $ref: '#/components/schemas/SourceSettingsOutputV1' - description: The output of Source settings. - title: settings - metadata_1: - allOf: - - $ref: '#/components/schemas/SourceMetadataV1' - description: "The metadata for the Source.\n\nConfig API note: includes `catalogName`\ - \ and `catalogId`." - title: metadata - source_1: - allOf: - - $ref: '#/components/schemas/SourceAlpha' - description: The returned Source object. - title: source - source_2: - allOf: - - $ref: '#/components/schemas/SourceAlpha' - description: The newly created Source. - title: source - source_3: - allOf: - - $ref: '#/components/schemas/SourceAlpha' - description: The updated Source. - title: source - source_4: - allOf: - - $ref: '#/components/schemas/SourceV1' - description: The returned Source object. - title: source - source_5: - allOf: - - $ref: '#/components/schemas/SourceV1' - description: The newly created Source. - title: source - source_6: - allOf: - - $ref: '#/components/schemas/SourceV1' - description: The updated Source. - title: source - space: - allOf: - - $ref: '#/components/schemas/Space' - description: Space matching the given id. - nullable: true - title: space - trackingPlan: - allOf: - - $ref: '#/components/schemas/TrackingPlanV1' - description: The requested Tracking Plan. - title: trackingPlan - trackingPlan_1: - allOf: - - $ref: '#/components/schemas/TrackingPlanV1' - description: The created Tracking Plan. - title: trackingPlan - transformation: - allOf: - - $ref: '#/components/schemas/TransformationBeta' - description: The retrieved Transformation. - title: transformation - transformation_1: - allOf: - - $ref: '#/components/schemas/TransformationBeta' - description: The updated Transformation. - title: transformation - transformation_2: - allOf: - - $ref: '#/components/schemas/TransformationBeta' - description: The created Transformation. - title: transformation - warehouseMetadata: - allOf: - - $ref: '#/components/schemas/WarehouseMetadataV1' - description: The Warehouse catalog item. - title: warehouseMetadata - logos_2: - allOf: - - $ref: '#/components/schemas/LogosBeta' - description: Logo information for this object. - title: logos - metadata_2: - allOf: - - $ref: '#/components/schemas/WarehouseMetadataV1' - description: The metadata for the Warehouse. - title: metadata - warehouse: - allOf: - - $ref: '#/components/schemas/WarehouseV1' - description: The returned Warehouse object. - title: warehouse - schedule: - allOf: - - $ref: '#/components/schemas/AdvancedWarehouseSyncScheduleV1Output' - description: "The schedule that contains the schedule overrides for the specified\ - \ Warehouse, if enabled." - title: schedule - schedule_1: - allOf: - - $ref: '#/components/schemas/AdvancedWarehouseSyncScheduleV1Input' - description: The full sync schedule for the Warehouse. - title: schedule - schedule_2: - allOf: - - $ref: '#/components/schemas/AdvancedWarehouseSyncScheduleV1Output' - description: "The schedule that contains the overrides for the Warehouse, if\ - \ enabled." - title: schedule - warehouse_1: - allOf: - - $ref: '#/components/schemas/WarehouseV1' - description: The newly created Warehouse. - title: warehouse - warehouse_2: - allOf: - - $ref: '#/components/schemas/WarehouseV1' - description: The updated Warehouse. - title: warehouse - workspace: - allOf: - - $ref: '#/components/schemas/WorkspaceV1' - description: The Workspace. - title: workspace - securitySchemes: - token: - scheme: bearer - type: http -x-domain-hierarchy: -- name: Connections - subDomains: - - name: Warehouses - subDomains: [] - - name: Sources - subDomains: [] - - name: Deletion and Suppression - subDomains: [] - - name: Destinations - subDomains: [] - - name: Edge Functions - subDomains: [] - - name: Destination Filters - subDomains: [] - - name: Functions - subDomains: [] - - name: Selective Sync - subDomains: [] - - name: Catalog - subDomains: [] -- name: Admin - subDomains: - - name: IAM Users - subDomains: [] - - name: IAM Groups - subDomains: [] - - name: Labels - subDomains: [] - - name: Audit Trail - subDomains: [] - - name: IAM Roles - subDomains: [] -- name: Protocols - subDomains: - - name: Tracking Plans - subDomains: [] - - name: Transformations - subDomains: [] -- name: Engage - subDomains: - - name: Spaces - subDomains: [] -- name: General - subDomains: - - name: Testing - subDomains: [] - - name: Workspaces - subDomains: [] -- name: Usage - subDomains: - - name: API Calls - subDomains: [] - - name: Monthly Tracked Users - subDomains: [] -- name: Monitoring - subDomains: - - name: Events - subDomains: [] -x-tagGroups: -- name: Connections - tags: - - Warehouses - - Sources - - Deletion and Suppression - - Destinations - - Edge Functions - - Destination Filters - - Functions - - Selective Sync - - Catalog -- name: Admin - tags: - - IAM Users - - IAM Groups - - Labels - - Audit Trail - - IAM Roles -- name: Protocols - tags: - - Tracking Plans - - Transformations -- name: Engage - tags: - - Spaces -- name: General - tags: - - Testing - - Workspaces -- name: Usage - tags: - - API Calls - - Monthly Tracked Users -- name: Monitoring - tags: - - Events - diff --git a/docs/ActivationsApi.md b/docs/ActivationsApi.md new file mode 100644 index 00000000..59b7aa2c --- /dev/null +++ b/docs/ActivationsApi.md @@ -0,0 +1,486 @@ +# ActivationsApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addActivationToAudience**](ActivationsApi.md#addActivationToAudience) | **POST** /spaces/{spaceId}/audiences/{audienceId}/{connectionId}/activations | Add Activation to Audience | +| [**addDestinationToAudience**](ActivationsApi.md#addDestinationToAudience) | **POST** /spaces/{spaceId}/audiences/{audienceId}/destinations | Add Destination to Audience | +| [**getActivationFromAudience**](ActivationsApi.md#getActivationFromAudience) | **GET** /spaces/{spaceId}/audiences/{audienceId}/activations/{id} | Get Activation from Audience | +| [**listActivationsFromAudience**](ActivationsApi.md#listActivationsFromAudience) | **GET** /spaces/{spaceId}/audiences/{audienceId}/activations | List Activations from Audience | +| [**removeActivationFromAudience**](ActivationsApi.md#removeActivationFromAudience) | **DELETE** /spaces/{spaceId}/audiences/{audienceId}/activations/{id} | Remove Activation from Audience | +| [**updateActivationForAudience**](ActivationsApi.md#updateActivationForAudience) | **PATCH** /spaces/{spaceId}/audiences/{audienceId}/activations/{id} | Update Activation for Audience | + + + +## Operation: addActivationToAudience + +> AddActivationToAudience200Response addActivationToAudience(spaceId, audienceId, connectionId, addActivationToAudienceAlphaInput) + +Add Activation to Audience + +Creates Activation. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach out to your customer success manager for more information. • When called, this endpoint may generate the `Activation Created` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 10 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ActivationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ActivationsApi apiInstance = new ActivationsApi(defaultClient); + String spaceId = "spa_9aQ1Lj62S4bomZKLF4DPqW"; // String | + String audienceId = "aud_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + String connectionId = "ii_123456789"; // String | + AddActivationToAudienceAlphaInput addActivationToAudienceAlphaInput = new AddActivationToAudienceAlphaInput(); // AddActivationToAudienceAlphaInput | + try { + AddActivationToAudience200Response result = apiInstance.addActivationToAudience(spaceId, audienceId, connectionId, addActivationToAudienceAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ActivationsApi#addActivationToAudience"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **audienceId** | **String**| | | +| **connectionId** | **String**| | | +| **addActivationToAudienceAlphaInput** | [**AddActivationToAudienceAlphaInput**](AddActivationToAudienceAlphaInput.md)| | | + +### Return type + +[**AddActivationToAudience200Response**](AddActivationToAudience200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: addDestinationToAudience + +> AddDestinationToAudience200Response addDestinationToAudience(spaceId, audienceId, addDestinationToAudienceAlphaInput) + +Add Destination to Audience + +Adds a Destination to an Audience. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach out to your customer success manager for more information. • When called, this endpoint may generate the `Destination Added into Audience` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ActivationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ActivationsApi apiInstance = new ActivationsApi(defaultClient); + String spaceId = "spa_9aQ1Lj62S4bomZKLF4DPqW"; // String | + String audienceId = "aud_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + AddDestinationToAudienceAlphaInput addDestinationToAudienceAlphaInput = new AddDestinationToAudienceAlphaInput(); // AddDestinationToAudienceAlphaInput | + try { + AddDestinationToAudience200Response result = apiInstance.addDestinationToAudience(spaceId, audienceId, addDestinationToAudienceAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ActivationsApi#addDestinationToAudience"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **audienceId** | **String**| | | +| **addDestinationToAudienceAlphaInput** | [**AddDestinationToAudienceAlphaInput**](AddDestinationToAudienceAlphaInput.md)| | | + +### Return type + +[**AddDestinationToAudience200Response**](AddDestinationToAudience200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getActivationFromAudience + +> GetActivationFromAudience200Response getActivationFromAudience(spaceId, audienceId, id, workspaceId) + +Get Activation from Audience + +Gets a single Activation by id. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ActivationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ActivationsApi apiInstance = new ActivationsApi(defaultClient); + String spaceId = "spa_9aQ1Lj62S4bomZKLF4DPqW"; // String | + String audienceId = "aud_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + String id = "act_987654321"; // String | + String workspaceId = "LF4DPqW"; // String | The workspace id This parameter exists in alpha. + try { + GetActivationFromAudience200Response result = apiInstance.getActivationFromAudience(spaceId, audienceId, id, workspaceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ActivationsApi#getActivationFromAudience"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **audienceId** | **String**| | | +| **id** | **String**| | | +| **workspaceId** | **String**| The workspace id This parameter exists in alpha. | | + +### Return type + +[**GetActivationFromAudience200Response**](GetActivationFromAudience200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listActivationsFromAudience + +> ListActivationsFromAudience200Response listActivationsFromAudience(spaceId, audienceId, workspaceId, pagination) + +List Activations from Audience + +Lists all Activations. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ActivationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ActivationsApi apiInstance = new ActivationsApi(defaultClient); + String spaceId = "spa_9aQ1Lj62S4bomZKLF4DPqW"; // String | + String audienceId = "aud_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + String workspaceId = "LF4DPqW"; // String | The workspace id This parameter exists in alpha. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Optional pagination. This parameter exists in alpha. + try { + ListActivationsFromAudience200Response result = apiInstance.listActivationsFromAudience(spaceId, audienceId, workspaceId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ActivationsApi#listActivationsFromAudience"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **audienceId** | **String**| | | +| **workspaceId** | **String**| The workspace id This parameter exists in alpha. | | +| **pagination** | [**PaginationInput**](.md)| Optional pagination. This parameter exists in alpha. | [optional] | + +### Return type + +[**ListActivationsFromAudience200Response**](ListActivationsFromAudience200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: removeActivationFromAudience + +> RemoveActivationFromAudience200Response removeActivationFromAudience(spaceId, audienceId, id, workspaceId) + +Remove Activation from Audience + +Deletes an Activation. The rate limit for this endpoint is 10 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ActivationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ActivationsApi apiInstance = new ActivationsApi(defaultClient); + String spaceId = "spa_9aQ1Lj62S4bomZKLF4DPqW"; // String | + String audienceId = "aud_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + String id = "act_987654321"; // String | + String workspaceId = "LF4DPqW"; // String | The workspace id This parameter exists in alpha. + try { + RemoveActivationFromAudience200Response result = apiInstance.removeActivationFromAudience(spaceId, audienceId, id, workspaceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ActivationsApi#removeActivationFromAudience"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **audienceId** | **String**| | | +| **id** | **String**| | | +| **workspaceId** | **String**| The workspace id This parameter exists in alpha. | | + +### Return type + +[**RemoveActivationFromAudience200Response**](RemoveActivationFromAudience200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateActivationForAudience + +> UpdateActivationForAudience200Response updateActivationForAudience(spaceId, audienceId, id, updateActivationForAudienceAlphaInput) + +Update Activation for Audience + +Updates an Activation. The rate limit for this endpoint is 10 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ActivationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ActivationsApi apiInstance = new ActivationsApi(defaultClient); + String spaceId = "spa_9aQ1Lj62S4bomZKLF4DPqW"; // String | + String audienceId = "aud_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + String id = "act_987654321"; // String | + UpdateActivationForAudienceAlphaInput updateActivationForAudienceAlphaInput = new UpdateActivationForAudienceAlphaInput(); // UpdateActivationForAudienceAlphaInput | + try { + UpdateActivationForAudience200Response result = apiInstance.updateActivationForAudience(spaceId, audienceId, id, updateActivationForAudienceAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ActivationsApi#updateActivationForAudience"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **audienceId** | **String**| | | +| **id** | **String**| | | +| **updateActivationForAudienceAlphaInput** | [**UpdateActivationForAudienceAlphaInput**](UpdateActivationForAudienceAlphaInput.md)| | | + +### Return type + +[**UpdateActivationForAudience200Response**](UpdateActivationForAudience200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/ApiCallsApi.md b/docs/ApiCallsApi.md new file mode 100644 index 00000000..b2531c71 --- /dev/null +++ b/docs/ApiCallsApi.md @@ -0,0 +1,160 @@ +# ApiCallsApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getDailyPerSourceAPICallsUsage**](ApiCallsApi.md#getDailyPerSourceAPICallsUsage) | **GET** /usage/api-calls/sources/daily | Get Daily Per Source API Calls Usage | +| [**getDailyWorkspaceAPICallsUsage**](ApiCallsApi.md#getDailyWorkspaceAPICallsUsage) | **GET** /usage/api-calls/daily | Get Daily Workspace API Calls Usage | + + + +## Operation: getDailyPerSourceAPICallsUsage + +> GetDailyPerSourceAPICallsUsage200Response getDailyPerSourceAPICallsUsage(period, pagination) + +Get Daily Per Source API Calls Usage + +Provides daily cumulative per-source API call counts for a usage period. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ApiCallsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ApiCallsApi apiInstance = new ApiCallsApi(defaultClient); + String period = "2021-02-01"; // String | The start of the usage month in the ISO-8601 format. This parameter exists in v1. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination input for per Source API calls counts. This parameter exists in v1. + try { + GetDailyPerSourceAPICallsUsage200Response result = apiInstance.getDailyPerSourceAPICallsUsage(period, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ApiCallsApi#getDailyPerSourceAPICallsUsage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **period** | **String**| The start of the usage month in the ISO-8601 format. This parameter exists in v1. | | +| **pagination** | [**PaginationInput**](.md)| Pagination input for per Source API calls counts. This parameter exists in v1. | [optional] | + +### Return type + +[**GetDailyPerSourceAPICallsUsage200Response**](GetDailyPerSourceAPICallsUsage200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getDailyWorkspaceAPICallsUsage + +> GetDailyWorkspaceAPICallsUsage200Response getDailyWorkspaceAPICallsUsage(period, pagination) + +Get Daily Workspace API Calls Usage + +Provides daily cumulative API call counts for a usage period. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ApiCallsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ApiCallsApi apiInstance = new ApiCallsApi(defaultClient); + String period = "2021-02-01"; // String | The start of the usage month in the ISO-8601 format. This parameter exists in v1. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination input for Workspace API call counts. This parameter exists in v1. + try { + GetDailyWorkspaceAPICallsUsage200Response result = apiInstance.getDailyWorkspaceAPICallsUsage(period, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ApiCallsApi#getDailyWorkspaceAPICallsUsage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **period** | **String**| The start of the usage month in the ISO-8601 format. This parameter exists in v1. | | +| **pagination** | [**PaginationInput**](.md)| Pagination input for Workspace API call counts. This parameter exists in v1. | [optional] | + +### Return type + +[**GetDailyWorkspaceAPICallsUsage200Response**](GetDailyWorkspaceAPICallsUsage200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/AudiencesApi.md b/docs/AudiencesApi.md new file mode 100644 index 00000000..3ba7eb23 --- /dev/null +++ b/docs/AudiencesApi.md @@ -0,0 +1,784 @@ +# AudiencesApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createAudience**](AudiencesApi.md#createAudience) | **POST** /spaces/{spaceId}/audiences | Create Audience | +| [**createAudiencePreview**](AudiencesApi.md#createAudiencePreview) | **POST** /spaces/{spaceId}/audiences/previews | Create Audience Preview | +| [**getAudience**](AudiencesApi.md#getAudience) | **GET** /spaces/{spaceId}/audiences/{id} | Get Audience | +| [**getAudiencePreview**](AudiencesApi.md#getAudiencePreview) | **GET** /spaces/{spaceId}/audiences/previews/{id} | Get Audience Preview | +| [**getAudienceScheduleFromSpaceAndAudience**](AudiencesApi.md#getAudienceScheduleFromSpaceAndAudience) | **GET** /spaces/{spaceId}/audiences/{id}/schedules/{scheduleId} | Get Audience Schedule from Space And Audience | +| [**listAudienceConsumersFromSpaceAndAudience**](AudiencesApi.md#listAudienceConsumersFromSpaceAndAudience) | **GET** /spaces/{spaceId}/audiences/{id}/audience-references | List Audience Consumers from Space And Audience | +| [**listAudienceSchedulesFromSpaceAndAudience**](AudiencesApi.md#listAudienceSchedulesFromSpaceAndAudience) | **GET** /spaces/{spaceId}/audiences/{id}/schedules | List Audience Schedules from Space And Audience | +| [**listAudiences**](AudiencesApi.md#listAudiences) | **GET** /spaces/{spaceId}/audiences | List Audiences | +| [**removeAudienceFromSpace**](AudiencesApi.md#removeAudienceFromSpace) | **DELETE** /spaces/{spaceId}/audiences/{id} | Remove Audience from Space | +| [**updateAudienceForSpace**](AudiencesApi.md#updateAudienceForSpace) | **PATCH** /spaces/{spaceId}/audiences/{id} | Update Audience for Space | + + + +## Operation: createAudience + +> CreateAudience200Response createAudience(spaceId, createAudienceAlphaInput) + +Create Audience + +Creates Audience. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach out to your customer success manager for more information. • When called, this endpoint may generate the `Audience Created` event in the [audit trail](/tag/Audit-Trail). Note: The definition for an Audience created using the API is not editable through the Segment App. The rate limit for this endpoint is 10 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.AudiencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + AudiencesApi apiInstance = new AudiencesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + CreateAudienceAlphaInput createAudienceAlphaInput = new CreateAudienceAlphaInput(); // CreateAudienceAlphaInput | + try { + CreateAudience200Response result = apiInstance.createAudience(spaceId, createAudienceAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AudiencesApi#createAudience"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **createAudienceAlphaInput** | [**CreateAudienceAlphaInput**](CreateAudienceAlphaInput.md)| | | + +### Return type + +[**CreateAudience200Response**](CreateAudience200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createAudiencePreview + +> CreateAudiencePreview200Response createAudiencePreview(spaceId, createAudiencePreviewAlphaInput) + +Create Audience Preview + +Previews Audience. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach out to your customer success manager for more information. • When called, this endpoint may generate the `Audience Preview Created` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 5 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. This endpoint also has a rate limit of 700 requests per month per spaceId, which is lower than the default due to access pattern restrictions. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.AudiencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + AudiencesApi apiInstance = new AudiencesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + CreateAudiencePreviewAlphaInput createAudiencePreviewAlphaInput = new CreateAudiencePreviewAlphaInput(); // CreateAudiencePreviewAlphaInput | + try { + CreateAudiencePreview200Response result = apiInstance.createAudiencePreview(spaceId, createAudiencePreviewAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AudiencesApi#createAudiencePreview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **createAudiencePreviewAlphaInput** | [**CreateAudiencePreviewAlphaInput**](CreateAudiencePreviewAlphaInput.md)| | | + +### Return type + +[**CreateAudiencePreview200Response**](CreateAudiencePreview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getAudience + +> GetAudience200Response getAudience(spaceId, id, include) + +Get Audience + +Returns the Audience by id and spaceId. Supports including audience schedules via `?include=schedules`. • This endpoint is in **Beta** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 100 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.AudiencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + AudiencesApi apiInstance = new AudiencesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + String id = "aud_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + String include = "schedules"; // String | Additional resource to include, support schedules only. This parameter exists in alpha. + try { + GetAudience200Response result = apiInstance.getAudience(spaceId, id, include); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AudiencesApi#getAudience"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **id** | **String**| | | +| **include** | **String**| Additional resource to include, support schedules only. This parameter exists in alpha. | [optional] [enum: schedules] | + +### Return type + +[**GetAudience200Response**](GetAudience200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getAudiencePreview + +> GetAudiencePreview200Response getAudiencePreview(spaceId, id) + +Get Audience Preview + +Reads the results of an audience preview. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 100 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.AudiencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + AudiencesApi apiInstance = new AudiencesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + String id = "2yKFfGeS62yzGxQSAieVOvsPOha-compute_preview_execution-dws3UdTNsppL5dRGsagFpP-compute_preview_execution"; // String | + try { + GetAudiencePreview200Response result = apiInstance.getAudiencePreview(spaceId, id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AudiencesApi#getAudiencePreview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **id** | **String**| | | + +### Return type + +[**GetAudiencePreview200Response**](GetAudiencePreview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getAudienceScheduleFromSpaceAndAudience + +> GetAudienceScheduleFromSpaceAndAudience200Response getAudienceScheduleFromSpaceAndAudience(spaceId, id, scheduleId) + +Get Audience Schedule from Space And Audience + +Returns the schedule for the given audience and scheduleId. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.AudiencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + AudiencesApi apiInstance = new AudiencesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + String id = "aud_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + String scheduleId = "sch_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + try { + GetAudienceScheduleFromSpaceAndAudience200Response result = apiInstance.getAudienceScheduleFromSpaceAndAudience(spaceId, id, scheduleId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AudiencesApi#getAudienceScheduleFromSpaceAndAudience"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **id** | **String**| | | +| **scheduleId** | **String**| | | + +### Return type + +[**GetAudienceScheduleFromSpaceAndAudience200Response**](GetAudienceScheduleFromSpaceAndAudience200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listAudienceConsumersFromSpaceAndAudience + +> ListAudienceConsumersFromSpaceAndAudience200Response listAudienceConsumersFromSpaceAndAudience(spaceId, id, pagination, search, sort) + +List Audience Consumers from Space And Audience + +Returns the list of consumers for the given audience. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 25 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.AudiencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + AudiencesApi apiInstance = new AudiencesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + String id = "aud_0ujsswThIGTUYm2K8FjOOfXtY1K"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Information about the pagination of this response. [See pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) for more info. This parameter exists in alpha. + ListAudienceSearchInput search = new ListAudienceSearchInput(); // ListAudienceSearchInput | Optional search criteria This parameter exists in alpha. + ListAudienceConsumersSortInput sort = new ListAudienceConsumersSortInput(); // ListAudienceConsumersSortInput | Optional sort criteria This parameter exists in alpha. + try { + ListAudienceConsumersFromSpaceAndAudience200Response result = apiInstance.listAudienceConsumersFromSpaceAndAudience(spaceId, id, pagination, search, sort); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AudiencesApi#listAudienceConsumersFromSpaceAndAudience"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **id** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Information about the pagination of this response. [See pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) for more info. This parameter exists in alpha. | [optional] | +| **search** | [**ListAudienceSearchInput**](.md)| Optional search criteria This parameter exists in alpha. | [optional] | +| **sort** | [**ListAudienceConsumersSortInput**](.md)| Optional sort criteria This parameter exists in alpha. | [optional] | + +### Return type + +[**ListAudienceConsumersFromSpaceAndAudience200Response**](ListAudienceConsumersFromSpaceAndAudience200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listAudienceSchedulesFromSpaceAndAudience + +> ListAudienceSchedulesFromSpaceAndAudience200Response listAudienceSchedulesFromSpaceAndAudience(spaceId, id) + +List Audience Schedules from Space And Audience + +Returns the list of schedules for the given audience. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.AudiencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + AudiencesApi apiInstance = new AudiencesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + String id = "aud_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + try { + ListAudienceSchedulesFromSpaceAndAudience200Response result = apiInstance.listAudienceSchedulesFromSpaceAndAudience(spaceId, id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AudiencesApi#listAudienceSchedulesFromSpaceAndAudience"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **id** | **String**| | | + +### Return type + +[**ListAudienceSchedulesFromSpaceAndAudience200Response**](ListAudienceSchedulesFromSpaceAndAudience200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listAudiences + +> ListAudiences200Response listAudiences(spaceId, search, pagination, include) + +List Audiences + +Returns Audiences by spaceId. Supports including audience schedules via `?include=schedules`. • This endpoint is in **Beta** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 25 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.AudiencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + AudiencesApi apiInstance = new AudiencesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + ListAudienceSearchInput search = new ListAudienceSearchInput(); // ListAudienceSearchInput | Optional search criteria This parameter exists in alpha. + ListAudiencesPaginationInput pagination = new ListAudiencesPaginationInput(); // ListAudiencesPaginationInput | Information about the pagination of this response. [See pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) for more info. This parameter exists in alpha. + String include = "schedules"; // String | Additional resource to include, support schedules only. This parameter exists in alpha. + try { + ListAudiences200Response result = apiInstance.listAudiences(spaceId, search, pagination, include); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AudiencesApi#listAudiences"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **search** | [**ListAudienceSearchInput**](.md)| Optional search criteria This parameter exists in alpha. | [optional] | +| **pagination** | [**ListAudiencesPaginationInput**](.md)| Information about the pagination of this response. [See pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) for more info. This parameter exists in alpha. | [optional] | +| **include** | **String**| Additional resource to include, support schedules only. This parameter exists in alpha. | [optional] [enum: schedules] | + +### Return type + +[**ListAudiences200Response**](ListAudiences200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: removeAudienceFromSpace + +> RemoveAudienceFromSpace200Response removeAudienceFromSpace(spaceId, id) + +Remove Audience from Space + +Deletes an Audience by id and spaceId. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach out to your customer success manager for more information. • When called, this endpoint may generate the `Audience Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 20 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.AudiencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + AudiencesApi apiInstance = new AudiencesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + String id = "aud_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + try { + RemoveAudienceFromSpace200Response result = apiInstance.removeAudienceFromSpace(spaceId, id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AudiencesApi#removeAudienceFromSpace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **id** | **String**| | | + +### Return type + +[**RemoveAudienceFromSpace200Response**](RemoveAudienceFromSpace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateAudienceForSpace + +> UpdateAudienceForSpace200Response updateAudienceForSpace(spaceId, id, updateAudienceForSpaceAlphaInput) + +Update Audience for Space + +Updates the Audience. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach out to your customer success manager for more information. • When called, this endpoint may generate the `Audience Modified` event in the [audit trail](/tag/Audit-Trail). • Note that when an Audience is updated, the Audience will be locked from future edits until the changes have been incorporated. You can find more information [in the Segment docs](https://segment-docs.netlify.app/docs/engage/audiences/#editing-realtime-audiences-and-traits). Note: The definition for an Audience updated using the API is not editable through the Segment App. The rate limit for this endpoint is 10 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.AudiencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + AudiencesApi apiInstance = new AudiencesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + String id = "aud_0ujsszwN8NRY24YaXiTIE2VWDTS"; // String | + UpdateAudienceForSpaceAlphaInput updateAudienceForSpaceAlphaInput = new UpdateAudienceForSpaceAlphaInput(); // UpdateAudienceForSpaceAlphaInput | + try { + UpdateAudienceForSpace200Response result = apiInstance.updateAudienceForSpace(spaceId, id, updateAudienceForSpaceAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AudiencesApi#updateAudienceForSpace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **id** | **String**| | | +| **updateAudienceForSpaceAlphaInput** | [**UpdateAudienceForSpaceAlphaInput**](UpdateAudienceForSpaceAlphaInput.md)| | | + +### Return type + +[**UpdateAudienceForSpace200Response**](UpdateAudienceForSpace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/AuditTrailApi.md b/docs/AuditTrailApi.md new file mode 100644 index 00000000..5f0c7be3 --- /dev/null +++ b/docs/AuditTrailApi.md @@ -0,0 +1,90 @@ +# AuditTrailApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**listAuditEvents**](AuditTrailApi.md#listAuditEvents) | **GET** /audit-events | List Audit Events | + + + +## Operation: listAuditEvents + +> ListAuditEvents200Response listAuditEvents(startTime, endTime, resourceId, resourceType, pagination) + +List Audit Events + +Returns a list of Audit Trail events. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.AuditTrailApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + AuditTrailApi apiInstance = new AuditTrailApi(defaultClient); + String startTime = "startTime_example"; // String | Filter response to events that happened after this time. This parameter exists in v1. + String endTime = "endTime_example"; // String | Filter response to events that happened before this time. Defaults to the current time, or the end time from the pagination cursor. This parameter exists in v1. + String resourceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | Filter response to events that affect a specific resource, for example, a single Source. This parameter exists in v1. + String resourceType = "resourceType_example"; // String | Filter response to events that affect a specific type, for example, Sources, Warehouses, and Tracking Plans. This parameter exists in v1. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Defines the pagination parameters. This parameter exists in v1. + try { + ListAuditEvents200Response result = apiInstance.listAuditEvents(startTime, endTime, resourceId, resourceType, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AuditTrailApi#listAuditEvents"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **startTime** | **String**| Filter response to events that happened after this time. This parameter exists in v1. | [optional] | +| **endTime** | **String**| Filter response to events that happened before this time. Defaults to the current time, or the end time from the pagination cursor. This parameter exists in v1. | [optional] | +| **resourceId** | **String**| Filter response to events that affect a specific resource, for example, a single Source. This parameter exists in v1. | [optional] | +| **resourceType** | **String**| Filter response to events that affect a specific type, for example, Sources, Warehouses, and Tracking Plans. This parameter exists in v1. | [optional] | +| **pagination** | [**PaginationInput**](.md)| Defines the pagination parameters. This parameter exists in v1. | [optional] | + +### Return type + +[**ListAuditEvents200Response**](ListAuditEvents200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/CatalogApi.md b/docs/CatalogApi.md new file mode 100644 index 00000000..e46f09d2 --- /dev/null +++ b/docs/CatalogApi.md @@ -0,0 +1,452 @@ +# CatalogApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getDestinationMetadata**](CatalogApi.md#getDestinationMetadata) | **GET** /catalog/destinations/{destinationMetadataId} | Get Destination Metadata | +| [**getDestinationsCatalog**](CatalogApi.md#getDestinationsCatalog) | **GET** /catalog/destinations | Get Destinations Catalog | +| [**getSourceMetadata**](CatalogApi.md#getSourceMetadata) | **GET** /catalog/sources/{sourceMetadataId} | Get Source Metadata | +| [**getSourcesCatalog**](CatalogApi.md#getSourcesCatalog) | **GET** /catalog/sources | Get Sources Catalog | +| [**getWarehouseMetadata**](CatalogApi.md#getWarehouseMetadata) | **GET** /catalog/warehouses/{warehouseMetadataId} | Get Warehouse Metadata | +| [**getWarehousesCatalog**](CatalogApi.md#getWarehousesCatalog) | **GET** /catalog/warehouses | Get Warehouses Catalog | + + + +## Operation: getDestinationMetadata + +> GetDestinationMetadata200Response getDestinationMetadata(destinationMetadataId) + +Get Destination Metadata + +Returns a Destination catalog item by its id. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.CatalogApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + CatalogApi apiInstance = new CatalogApi(defaultClient); + String destinationMetadataId = "54521fd525e721e32a72ee91"; // String | + try { + GetDestinationMetadata200Response result = apiInstance.getDestinationMetadata(destinationMetadataId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CatalogApi#getDestinationMetadata"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationMetadataId** | **String**| | | + +### Return type + +[**GetDestinationMetadata200Response**](GetDestinationMetadata200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getDestinationsCatalog + +> GetDestinationsCatalog200Response getDestinationsCatalog(pagination) + +Get Destinations Catalog + +Returns a list of all available Destinations in the Segment catalog. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.CatalogApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + CatalogApi apiInstance = new CatalogApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Required pagination parameters used to filter the Destinations catalog. This parameter exists in v1. + try { + GetDestinationsCatalog200Response result = apiInstance.getDestinationsCatalog(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CatalogApi#getDestinationsCatalog"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Required pagination parameters used to filter the Destinations catalog. This parameter exists in v1. | [optional] | + +### Return type + +[**GetDestinationsCatalog200Response**](GetDestinationsCatalog200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getSourceMetadata + +> GetSourceMetadata200Response getSourceMetadata(sourceMetadataId) + +Get Source Metadata + +Returns a Source catalog item by its id. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.CatalogApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + CatalogApi apiInstance = new CatalogApi(defaultClient); + String sourceMetadataId = "1bow82lmk"; // String | + try { + GetSourceMetadata200Response result = apiInstance.getSourceMetadata(sourceMetadataId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CatalogApi#getSourceMetadata"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceMetadataId** | **String**| | | + +### Return type + +[**GetSourceMetadata200Response**](GetSourceMetadata200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getSourcesCatalog + +> GetSourcesCatalog200Response getSourcesCatalog(pagination) + +Get Sources Catalog + +Returns a list of all available Sources in the Segment catalog. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.CatalogApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + CatalogApi apiInstance = new CatalogApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Defines the pagination parameters. This parameter exists in v1. + try { + GetSourcesCatalog200Response result = apiInstance.getSourcesCatalog(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CatalogApi#getSourcesCatalog"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Defines the pagination parameters. This parameter exists in v1. | [optional] | + +### Return type + +[**GetSourcesCatalog200Response**](GetSourcesCatalog200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getWarehouseMetadata + +> GetWarehouseMetadata200Response getWarehouseMetadata(warehouseMetadataId) + +Get Warehouse Metadata + +Returns a Warehouse catalog item by its id. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.CatalogApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + CatalogApi apiInstance = new CatalogApi(defaultClient); + String warehouseMetadataId = "55d3d3aea3c"; // String | + try { + GetWarehouseMetadata200Response result = apiInstance.getWarehouseMetadata(warehouseMetadataId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CatalogApi#getWarehouseMetadata"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseMetadataId** | **String**| | | + +### Return type + +[**GetWarehouseMetadata200Response**](GetWarehouseMetadata200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getWarehousesCatalog + +> GetWarehousesCatalog200Response getWarehousesCatalog(pagination) + +Get Warehouses Catalog + +Returns a list of all available Warehouses in the Segment catalog. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.CatalogApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + CatalogApi apiInstance = new CatalogApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Optional pagination params used to filter the Warehouses catalog. This parameter exists in v1. + try { + GetWarehousesCatalog200Response result = apiInstance.getWarehousesCatalog(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CatalogApi#getWarehousesCatalog"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Optional pagination params used to filter the Warehouses catalog. This parameter exists in v1. | [optional] | + +### Return type + +[**GetWarehousesCatalog200Response**](GetWarehousesCatalog200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/ComputedTraitsApi.md b/docs/ComputedTraitsApi.md new file mode 100644 index 00000000..1a06180a --- /dev/null +++ b/docs/ComputedTraitsApi.md @@ -0,0 +1,390 @@ +# ComputedTraitsApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createComputedTrait**](ComputedTraitsApi.md#createComputedTrait) | **POST** /spaces/{spaceId}/computed-traits | Create Computed Trait | +| [**getComputedTrait**](ComputedTraitsApi.md#getComputedTrait) | **GET** /spaces/{spaceId}/computed-traits/{id} | Get Computed Trait | +| [**listComputedTraits**](ComputedTraitsApi.md#listComputedTraits) | **GET** /spaces/{spaceId}/computed-traits | List Computed Traits | +| [**removeComputedTraitFromSpace**](ComputedTraitsApi.md#removeComputedTraitFromSpace) | **DELETE** /spaces/{spaceId}/computed-traits/{id} | Remove Computed Trait from Space | +| [**updateComputedTraitForSpace**](ComputedTraitsApi.md#updateComputedTraitForSpace) | **PATCH** /spaces/{spaceId}/computed-traits/{id} | Update Computed Trait for Space | + + + +## Operation: createComputedTrait + +> CreateComputedTrait200Response createComputedTrait(spaceId, createComputedTraitAlphaInput) + +Create Computed Trait + +Creates a Computed Trait • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Computed Trait feature enabled. Please reach out to your customer success manager for more information. • When called, this endpoint may generate the `Computed Trait Created` event in the [audit trail](/tag/Audit-Trail). Note: The definition for a Computed Trait created using the API is not editable through the Segment App. The rate limit for this endpoint is 10 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ComputedTraitsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ComputedTraitsApi apiInstance = new ComputedTraitsApi(defaultClient); + String spaceId = "spaceId"; // String | + CreateComputedTraitAlphaInput createComputedTraitAlphaInput = new CreateComputedTraitAlphaInput(); // CreateComputedTraitAlphaInput | + try { + CreateComputedTrait200Response result = apiInstance.createComputedTrait(spaceId, createComputedTraitAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ComputedTraitsApi#createComputedTrait"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **createComputedTraitAlphaInput** | [**CreateComputedTraitAlphaInput**](CreateComputedTraitAlphaInput.md)| | | + +### Return type + +[**CreateComputedTrait200Response**](CreateComputedTrait200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getComputedTrait + +> GetComputedTrait200Response getComputedTrait(spaceId, id) + +Get Computed Trait + +Returns the Computed Trait by id and spaceId • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Computed Trait feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 100 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ComputedTraitsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ComputedTraitsApi apiInstance = new ComputedTraitsApi(defaultClient); + String spaceId = "spaceId"; // String | + String id = "id"; // String | + try { + GetComputedTrait200Response result = apiInstance.getComputedTrait(spaceId, id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ComputedTraitsApi#getComputedTrait"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **id** | **String**| | | + +### Return type + +[**GetComputedTrait200Response**](GetComputedTrait200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listComputedTraits + +> ListComputedTraits200Response listComputedTraits(spaceId, pagination) + +List Computed Traits + +Returns Computed Traits by spaceId. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Computed Trait feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 25 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ComputedTraitsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ComputedTraitsApi apiInstance = new ComputedTraitsApi(defaultClient); + String spaceId = "spaceId"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Information about the pagination of this response. [See pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) for more info. This parameter exists in alpha. + try { + ListComputedTraits200Response result = apiInstance.listComputedTraits(spaceId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ComputedTraitsApi#listComputedTraits"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Information about the pagination of this response. [See pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) for more info. This parameter exists in alpha. | [optional] | + +### Return type + +[**ListComputedTraits200Response**](ListComputedTraits200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: removeComputedTraitFromSpace + +> RemoveComputedTraitFromSpace200Response removeComputedTraitFromSpace(spaceId, id) + +Remove Computed Trait from Space + +Deletes a Computed Trait by id and spaceId. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Computed Trait feature enabled. Please reach out to your customer success manager for more information. • When called, this endpoint may generate the `Computed Trait Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 20 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ComputedTraitsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ComputedTraitsApi apiInstance = new ComputedTraitsApi(defaultClient); + String spaceId = "spaceId"; // String | + String id = "id"; // String | + try { + RemoveComputedTraitFromSpace200Response result = apiInstance.removeComputedTraitFromSpace(spaceId, id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ComputedTraitsApi#removeComputedTraitFromSpace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **id** | **String**| | | + +### Return type + +[**RemoveComputedTraitFromSpace200Response**](RemoveComputedTraitFromSpace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateComputedTraitForSpace + +> UpdateComputedTraitForSpace200Response updateComputedTraitForSpace(spaceId, id, updateComputedTraitForSpaceAlphaInput) + +Update Computed Trait for Space + +Updates the Computed Trait. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Computed Trait feature enabled. Please reach out to your customer success manager for more information. • When called, this endpoint may generate the `Computed Trait Modified` event in the [audit trail](/tag/Audit-Trail). • Note that when a Computed Trait is updated, the Computed Trait will be locked from future edits until the changes have been incorporated. You can find more information [in the Segment docs](https://segment-docs.netlify.app/docs/unify/traits/computed-traits/#editing-realtime-traits). Note: The definition for a Computed Trait updated using the API is not editable through the Segment App. The rate limit for this endpoint is 10 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ComputedTraitsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ComputedTraitsApi apiInstance = new ComputedTraitsApi(defaultClient); + String spaceId = "spaceId"; // String | + String id = "id"; // String | + UpdateComputedTraitForSpaceAlphaInput updateComputedTraitForSpaceAlphaInput = new UpdateComputedTraitForSpaceAlphaInput(); // UpdateComputedTraitForSpaceAlphaInput | + try { + UpdateComputedTraitForSpace200Response result = apiInstance.updateComputedTraitForSpace(spaceId, id, updateComputedTraitForSpaceAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ComputedTraitsApi#updateComputedTraitForSpace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **id** | **String**| | | +| **updateComputedTraitForSpaceAlphaInput** | [**UpdateComputedTraitForSpaceAlphaInput**](UpdateComputedTraitForSpaceAlphaInput.md)| | | + +### Return type + +[**UpdateComputedTraitForSpace200Response**](UpdateComputedTraitForSpace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/CustomerInsightsApi.md b/docs/CustomerInsightsApi.md new file mode 100644 index 00000000..891b717e --- /dev/null +++ b/docs/CustomerInsightsApi.md @@ -0,0 +1,82 @@ +# CustomerInsightsApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createDownload**](CustomerInsightsApi.md#createDownload) | **POST** /customer-insights/download | Create Download | + + + +## Operation: createDownload + +> CreateDownload200Response createDownload(createDownloadAlphaInput) + +Create Download + +Create Customer Insights Presigned URLsThe rate limit for this endpoint is 120 requests per day per workspaceId, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.CustomerInsightsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + CustomerInsightsApi apiInstance = new CustomerInsightsApi(defaultClient); + CreateDownloadAlphaInput createDownloadAlphaInput = new CreateDownloadAlphaInput(); // CreateDownloadAlphaInput | + try { + CreateDownload200Response result = apiInstance.createDownload(createDownloadAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CustomerInsightsApi#createDownload"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createDownloadAlphaInput** | [**CreateDownloadAlphaInput**](CreateDownloadAlphaInput.md)| | | + +### Return type + +[**CreateDownload200Response**](CreateDownload200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/DbtApi.md b/docs/DbtApi.md new file mode 100644 index 00000000..08513d9f --- /dev/null +++ b/docs/DbtApi.md @@ -0,0 +1,82 @@ +# DbtApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createDbtModelSyncTrigger**](DbtApi.md#createDbtModelSyncTrigger) | **POST** /dbt-model-syncs/trigger | Create Dbt Model Sync Trigger | + + + +## Operation: createDbtModelSyncTrigger + +> CreateDbtModelSyncTrigger200Response createDbtModelSyncTrigger(createDbtModelSyncTriggerInput) + +Create Dbt Model Sync Trigger + +Creates a trigger for a new dbt model sync for a Source. The rate limit for this endpoint is 10 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DbtApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DbtApi apiInstance = new DbtApi(defaultClient); + CreateDbtModelSyncTriggerInput createDbtModelSyncTriggerInput = new CreateDbtModelSyncTriggerInput(); // CreateDbtModelSyncTriggerInput | + try { + CreateDbtModelSyncTrigger200Response result = apiInstance.createDbtModelSyncTrigger(createDbtModelSyncTriggerInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DbtApi#createDbtModelSyncTrigger"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createDbtModelSyncTriggerInput** | [**CreateDbtModelSyncTriggerInput**](CreateDbtModelSyncTriggerInput.md)| | | + +### Return type + +[**CreateDbtModelSyncTrigger200Response**](CreateDbtModelSyncTrigger200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1beta+json +- **Accept**: application/vnd.segment.v1beta+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/DeletionAndSuppressionApi.md b/docs/DeletionAndSuppressionApi.md new file mode 100644 index 00000000..0409b8fa --- /dev/null +++ b/docs/DeletionAndSuppressionApi.md @@ -0,0 +1,614 @@ +# DeletionAndSuppressionApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createCloudSourceRegulation**](DeletionAndSuppressionApi.md#createCloudSourceRegulation) | **POST** /regulations/cloudsources/{sourceId} | Create Cloud Source Regulation | +| [**createSourceRegulation**](DeletionAndSuppressionApi.md#createSourceRegulation) | **POST** /regulations/sources/{sourceId} | Create Source Regulation | +| [**createWorkspaceRegulation**](DeletionAndSuppressionApi.md#createWorkspaceRegulation) | **POST** /regulations | Create Workspace Regulation | +| [**deleteRegulation**](DeletionAndSuppressionApi.md#deleteRegulation) | **DELETE** /regulations/{regulateId} | Delete Regulation | +| [**getRegulation**](DeletionAndSuppressionApi.md#getRegulation) | **GET** /regulations/{regulateId} | Get Regulation | +| [**listRegulationsFromSource**](DeletionAndSuppressionApi.md#listRegulationsFromSource) | **GET** /regulations/sources/{sourceId} | List Regulations from Source | +| [**listSuppressions**](DeletionAndSuppressionApi.md#listSuppressions) | **GET** /suppressions | List Suppressions | +| [**listWorkspaceRegulations**](DeletionAndSuppressionApi.md#listWorkspaceRegulations) | **GET** /regulations | List Workspace Regulations | + + + +## Operation: createCloudSourceRegulation + +> CreateCloudSourceRegulation200Response createCloudSourceRegulation(sourceId, createCloudSourceRegulationV1Input) + +Create Cloud Source Regulation + +Creates a Source-scoped regulation. Please Note: Suppression rules at the Workspace level take precedence over those at the Source level. If a user has been suppressed at the Workspace level, any attempt to un-suppress at the Source level is not supported and the processing of the request will fail in Segment Config API omitted fields: - `attributes`, - `userAgent` + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeletionAndSuppressionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeletionAndSuppressionApi apiInstance = new DeletionAndSuppressionApi(defaultClient); + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | + CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input = new CreateCloudSourceRegulationV1Input(); // CreateCloudSourceRegulationV1Input | + try { + CreateCloudSourceRegulation200Response result = apiInstance.createCloudSourceRegulation(sourceId, createCloudSourceRegulationV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeletionAndSuppressionApi#createCloudSourceRegulation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | +| **createCloudSourceRegulationV1Input** | [**CreateCloudSourceRegulationV1Input**](CreateCloudSourceRegulationV1Input.md)| | | + +### Return type + +[**CreateCloudSourceRegulation200Response**](CreateCloudSourceRegulation200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createSourceRegulation + +> CreateSourceRegulation200Response createSourceRegulation(sourceId, createSourceRegulationV1Input) + +Create Source Regulation + +Creates a Source-scoped regulation. Please Note: Suppression rules at the Workspace level take precedence over those at the Source level. If a user has been suppressed at the Workspace level, any attempt to un-suppress at the Source level is not supported and the processing of the request will fail in Segment • When called, this endpoint may generate the `Source Regulation Created` event in the [audit trail](/tag/Audit-Trail). Config API omitted fields: - `attributes`, - `userAgent` + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeletionAndSuppressionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeletionAndSuppressionApi apiInstance = new DeletionAndSuppressionApi(defaultClient); + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | + CreateSourceRegulationV1Input createSourceRegulationV1Input = new CreateSourceRegulationV1Input(); // CreateSourceRegulationV1Input | + try { + CreateSourceRegulation200Response result = apiInstance.createSourceRegulation(sourceId, createSourceRegulationV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeletionAndSuppressionApi#createSourceRegulation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | +| **createSourceRegulationV1Input** | [**CreateSourceRegulationV1Input**](CreateSourceRegulationV1Input.md)| | | + +### Return type + +[**CreateSourceRegulation200Response**](CreateSourceRegulation200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createWorkspaceRegulation + +> CreateWorkspaceRegulation200Response createWorkspaceRegulation(createWorkspaceRegulationV1Input) + +Create Workspace Regulation + +Creates a Workspace-scoped regulation. • When called, this endpoint may generate the `Workspace Regulation Created` event in the [audit trail](/tag/Audit-Trail). Config API omitted fields: - `attributes`, - `userAgent` + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeletionAndSuppressionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeletionAndSuppressionApi apiInstance = new DeletionAndSuppressionApi(defaultClient); + CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input = new CreateWorkspaceRegulationV1Input(); // CreateWorkspaceRegulationV1Input | + try { + CreateWorkspaceRegulation200Response result = apiInstance.createWorkspaceRegulation(createWorkspaceRegulationV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeletionAndSuppressionApi#createWorkspaceRegulation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createWorkspaceRegulationV1Input** | [**CreateWorkspaceRegulationV1Input**](CreateWorkspaceRegulationV1Input.md)| | | + +### Return type + +[**CreateWorkspaceRegulation200Response**](CreateWorkspaceRegulation200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteRegulation + +> DeleteRegulation200Response deleteRegulation(regulateId) + +Delete Regulation + +Deletes a regulation from the Workspace. The regulation must be in the initialized state to be deleted. • When called, this endpoint may generate the `Regulation Deleted` event in the [audit trail](/tag/Audit-Trail). **DEPRECATED**: this endpoint has been deprecated according to the guidelines, and may experience reduced SLA guarantees. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeletionAndSuppressionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeletionAndSuppressionApi apiInstance = new DeletionAndSuppressionApi(defaultClient); + String regulateId = "1qJkfE1tpwvQcklImGksLN629wn"; // String | + try { + DeleteRegulation200Response result = apiInstance.deleteRegulation(regulateId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeletionAndSuppressionApi#deleteRegulation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **regulateId** | **String**| | | + +### Return type + +[**DeleteRegulation200Response**](DeleteRegulation200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getRegulation + +> GetRegulation200Response getRegulation(regulateId) + +Get Regulation + +Gets a regulation from the Workspace. Config API omitted fields: - `parent` + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeletionAndSuppressionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeletionAndSuppressionApi apiInstance = new DeletionAndSuppressionApi(defaultClient); + String regulateId = "1qJkfE1tpwvQcklImGksLN629wn"; // String | + try { + GetRegulation200Response result = apiInstance.getRegulation(regulateId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeletionAndSuppressionApi#getRegulation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **regulateId** | **String**| | | + +### Return type + +[**GetRegulation200Response**](GetRegulation200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listRegulationsFromSource + +> ListRegulationsFromSource200Response listRegulationsFromSource(sourceId, status, regulationTypes, pagination) + +List Regulations from Source + +Lists all Source-scoped regulations. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeletionAndSuppressionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeletionAndSuppressionApi apiInstance = new DeletionAndSuppressionApi(defaultClient); + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | + String status = "FAILED"; // String | The status on which to filter returned regulations. This parameter exists in v1. + List regulationTypes = Arrays.asList(); // List | The regulation types on which to filter returned regulations. This parameter exists in v1. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination parameters. This parameter exists in v1. + try { + ListRegulationsFromSource200Response result = apiInstance.listRegulationsFromSource(sourceId, status, regulationTypes, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeletionAndSuppressionApi#listRegulationsFromSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | +| **status** | **String**| The status on which to filter returned regulations. This parameter exists in v1. | [optional] [enum: FAILED, FINISHED, INITIALIZED, INVALID, NOT_SUPPORTED, PARTIAL_SUCCESS, RUNNING] | +| **regulationTypes** | [**List<String>**](String.md)| The regulation types on which to filter returned regulations. This parameter exists in v1. | [optional] [enum: DELETE_ARCHIVE_ONLY, DELETE_INTERNAL, DELETE_ONLY, SUPPRESS_ONLY, SUPPRESS_WITH_DELETE, SUPPRESS_WITH_DELETE_INTERNAL, UNSUPPRESS] | +| **pagination** | [**PaginationInput**](.md)| Pagination parameters. This parameter exists in v1. | [optional] | + +### Return type + +[**ListRegulationsFromSource200Response**](ListRegulationsFromSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listSuppressions + +> ListSuppressions200Response listSuppressions(pagination) + +List Suppressions + +Lists all suppressions in a given Workspace. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeletionAndSuppressionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeletionAndSuppressionApi apiInstance = new DeletionAndSuppressionApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination parameters. This parameter exists in v1. + try { + ListSuppressions200Response result = apiInstance.listSuppressions(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeletionAndSuppressionApi#listSuppressions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Pagination parameters. This parameter exists in v1. | [optional] | + +### Return type + +[**ListSuppressions200Response**](ListSuppressions200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listWorkspaceRegulations + +> ListWorkspaceRegulations200Response listWorkspaceRegulations(status, regulationTypes, pagination) + +List Workspace Regulations + +Lists all Workspace-scoped regulations. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeletionAndSuppressionApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeletionAndSuppressionApi apiInstance = new DeletionAndSuppressionApi(defaultClient); + String status = "FAILED"; // String | The status on which to filter the returned regulations. This parameter exists in v1. + List regulationTypes = Arrays.asList(); // List | The regulation types on which to filter returned regulations. This parameter exists in v1. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination parameters. This parameter exists in v1. + try { + ListWorkspaceRegulations200Response result = apiInstance.listWorkspaceRegulations(status, regulationTypes, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeletionAndSuppressionApi#listWorkspaceRegulations"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | **String**| The status on which to filter the returned regulations. This parameter exists in v1. | [optional] [enum: FAILED, FINISHED, INITIALIZED, INVALID, NOT_SUPPORTED, PARTIAL_SUCCESS, RUNNING] | +| **regulationTypes** | [**List<String>**](String.md)| The regulation types on which to filter returned regulations. This parameter exists in v1. | [optional] [enum: DELETE_INTERNAL, DELETE_ONLY, SUPPRESS_ONLY, SUPPRESS_WITH_DELETE, SUPPRESS_WITH_DELETE_INTERNAL, UNSUPPRESS] | +| **pagination** | [**PaginationInput**](.md)| Pagination parameters. This parameter exists in v1. | [optional] | + +### Return type + +[**ListWorkspaceRegulations200Response**](ListWorkspaceRegulations200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/DeliveryOverviewApi.md b/docs/DeliveryOverviewApi.md new file mode 100644 index 00000000..dc4089a6 --- /dev/null +++ b/docs/DeliveryOverviewApi.md @@ -0,0 +1,530 @@ +# DeliveryOverviewApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getEgressFailedMetricsFromDeliveryOverview**](DeliveryOverviewApi.md#getEgressFailedMetricsFromDeliveryOverview) | **GET** /delivery-overview/failed-delivery | Get Egress Failed Metrics from Delivery Overview | +| [**getEgressSuccessMetricsFromDeliveryOverview**](DeliveryOverviewApi.md#getEgressSuccessMetricsFromDeliveryOverview) | **GET** /delivery-overview/successful-delivery | Get Egress Success Metrics from Delivery Overview | +| [**getFilteredAtDestinationMetricsFromDeliveryOverview**](DeliveryOverviewApi.md#getFilteredAtDestinationMetricsFromDeliveryOverview) | **GET** /delivery-overview/filtered-at-destination | Get Filtered At Destination Metrics from Delivery Overview | +| [**getFilteredAtSourceMetricsFromDeliveryOverview**](DeliveryOverviewApi.md#getFilteredAtSourceMetricsFromDeliveryOverview) | **GET** /delivery-overview/filtered-at-source | Get Filtered At Source Metrics from Delivery Overview | +| [**getIngressFailedMetricsFromDeliveryOverview**](DeliveryOverviewApi.md#getIngressFailedMetricsFromDeliveryOverview) | **GET** /delivery-overview/failed-on-ingest | Get Ingress Failed Metrics from Delivery Overview | +| [**getIngressSuccessMetricsFromDeliveryOverview**](DeliveryOverviewApi.md#getIngressSuccessMetricsFromDeliveryOverview) | **GET** /delivery-overview/successfully-received | Get Ingress Success Metrics from Delivery Overview | + + + +## Operation: getEgressFailedMetricsFromDeliveryOverview + +> GetEgressFailedMetricsFromDeliveryOverview200Response getEgressFailedMetricsFromDeliveryOverview(sourceId, destinationConfigId, startTime, endTime, groupBy, granularity, filter, pagination) + +Get Egress Failed Metrics from Delivery Overview + +Get events that failed to be delivered to Destination. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeliveryOverviewApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeliveryOverviewApi apiInstance = new DeliveryOverviewApi(defaultClient); + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | The sourceId for the Workspace. This parameter exists in beta. + String destinationConfigId = "fP7qoQw2HTWt9WdMr718gn"; // String | The id tied to a Workspace Destination. This parameter exists in beta. + String startTime = "2024-01-01T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. + String endTime = "2024-01-03T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. + List groupBy = Arrays.asList(); // List | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and `spaceId`. This parameter exists in beta. + String granularity = "DAY"; // String | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. + DeliveryOverviewDestinationFilterBy filter = new DeliveryOverviewDestinationFilterBy(); // DeliveryOverviewDestinationFilterBy | An optional filter for `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and/or `spaceId` that can be applied in addition to a `group By`. This parameter exists in beta. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Params to specify the page cursor and count. This parameter exists in beta. + try { + GetEgressFailedMetricsFromDeliveryOverview200Response result = apiInstance.getEgressFailedMetricsFromDeliveryOverview(sourceId, destinationConfigId, startTime, endTime, groupBy, granularity, filter, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeliveryOverviewApi#getEgressFailedMetricsFromDeliveryOverview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| The sourceId for the Workspace. This parameter exists in beta. | | +| **destinationConfigId** | **String**| The id tied to a Workspace Destination. This parameter exists in beta. | | +| **startTime** | **String**| The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. | | +| **endTime** | **String**| The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. | | +| **groupBy** | [**List<String>**](String.md)| A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and `spaceId`. This parameter exists in beta. | [optional] | +| **granularity** | **String**| The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. | [enum: DAY, HOUR, MINUTE] | +| **filter** | [**DeliveryOverviewDestinationFilterBy**](.md)| An optional filter for `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and/or `spaceId` that can be applied in addition to a `group By`. This parameter exists in beta. | [optional] | +| **pagination** | [**PaginationInput**](.md)| Params to specify the page cursor and count. This parameter exists in beta. | [optional] | + +### Return type + +[**GetEgressFailedMetricsFromDeliveryOverview200Response**](GetEgressFailedMetricsFromDeliveryOverview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1beta+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getEgressSuccessMetricsFromDeliveryOverview + +> GetEgressFailedMetricsFromDeliveryOverview200Response getEgressSuccessMetricsFromDeliveryOverview(sourceId, destinationConfigId, startTime, endTime, groupBy, granularity, filter, pagination) + +Get Egress Success Metrics from Delivery Overview + +Get events successfully delivered to Destination. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeliveryOverviewApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeliveryOverviewApi apiInstance = new DeliveryOverviewApi(defaultClient); + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | The sourceId for the Workspace. This parameter exists in beta. + String destinationConfigId = "fP7qoQw2HTWt9WdMr718gn"; // String | The id tied to a Workspace Destination. This parameter exists in beta. + String startTime = "2024-01-01T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. + String endTime = "2024-01-03T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. + List groupBy = Arrays.asList(); // List | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and `spaceId`. This parameter exists in beta. + String granularity = "DAY"; // String | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. + DeliveryOverviewDestinationFilterBy filter = new DeliveryOverviewDestinationFilterBy(); // DeliveryOverviewDestinationFilterBy | An optional filter for `event Name`, `event Type`, `discard Reason`, `appVersion`, `subscription Id`, `activationId`, `audienceId`, or `spaceId` that can be applied in addition to a `group By`. If you would like to view retry attempts for a successful delivery, you can filter `discard Reason` from `successes.attempt.1` through `successes.attempt.10`. This parameter exists in beta. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Params to specify the page cursor and count. This parameter exists in beta. + try { + GetEgressFailedMetricsFromDeliveryOverview200Response result = apiInstance.getEgressSuccessMetricsFromDeliveryOverview(sourceId, destinationConfigId, startTime, endTime, groupBy, granularity, filter, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeliveryOverviewApi#getEgressSuccessMetricsFromDeliveryOverview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| The sourceId for the Workspace. This parameter exists in beta. | | +| **destinationConfigId** | **String**| The id tied to a Workspace Destination. This parameter exists in beta. | | +| **startTime** | **String**| The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. | | +| **endTime** | **String**| The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. | | +| **groupBy** | [**List<String>**](String.md)| A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and `spaceId`. This parameter exists in beta. | [optional] | +| **granularity** | **String**| The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. | [enum: DAY, HOUR, MINUTE] | +| **filter** | [**DeliveryOverviewDestinationFilterBy**](.md)| An optional filter for `event Name`, `event Type`, `discard Reason`, `appVersion`, `subscription Id`, `activationId`, `audienceId`, or `spaceId` that can be applied in addition to a `group By`. If you would like to view retry attempts for a successful delivery, you can filter `discard Reason` from `successes.attempt.1` through `successes.attempt.10`. This parameter exists in beta. | [optional] | +| **pagination** | [**PaginationInput**](.md)| Params to specify the page cursor and count. This parameter exists in beta. | [optional] | + +### Return type + +[**GetEgressFailedMetricsFromDeliveryOverview200Response**](GetEgressFailedMetricsFromDeliveryOverview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1beta+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getFilteredAtDestinationMetricsFromDeliveryOverview + +> GetEgressFailedMetricsFromDeliveryOverview200Response getFilteredAtDestinationMetricsFromDeliveryOverview(sourceId, destinationConfigId, startTime, endTime, groupBy, granularity, filter, pagination) + +Get Filtered At Destination Metrics from Delivery Overview + +Get events that were filtered at Destination. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeliveryOverviewApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeliveryOverviewApi apiInstance = new DeliveryOverviewApi(defaultClient); + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | The sourceId for the Workspace. This parameter exists in beta. + String destinationConfigId = "fP7qoQw2HTWt9WdMr718gn"; // String | The id tied to a Workspace Destination. This parameter exists in beta. + String startTime = "2024-01-01T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. + String endTime = "2024-01-03T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. + List groupBy = Arrays.asList(); // List | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and `spaceId`. This parameter exists in beta. + String granularity = "DAY"; // String | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. + DeliveryOverviewDestinationFilterBy filter = new DeliveryOverviewDestinationFilterBy(); // DeliveryOverviewDestinationFilterBy | An optional filter for `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and/or `spaceId` that can be applied in addition to a `group By`. This parameter exists in beta. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Params to specify the page cursor and count. This parameter exists in beta. + try { + GetEgressFailedMetricsFromDeliveryOverview200Response result = apiInstance.getFilteredAtDestinationMetricsFromDeliveryOverview(sourceId, destinationConfigId, startTime, endTime, groupBy, granularity, filter, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeliveryOverviewApi#getFilteredAtDestinationMetricsFromDeliveryOverview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| The sourceId for the Workspace. This parameter exists in beta. | | +| **destinationConfigId** | **String**| The id tied to a Workspace Destination. This parameter exists in beta. | | +| **startTime** | **String**| The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. | | +| **endTime** | **String**| The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. | | +| **groupBy** | [**List<String>**](String.md)| A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and `spaceId`. This parameter exists in beta. | [optional] | +| **granularity** | **String**| The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. | [enum: DAY, HOUR, MINUTE] | +| **filter** | [**DeliveryOverviewDestinationFilterBy**](.md)| An optional filter for `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and/or `spaceId` that can be applied in addition to a `group By`. This parameter exists in beta. | [optional] | +| **pagination** | [**PaginationInput**](.md)| Params to specify the page cursor and count. This parameter exists in beta. | [optional] | + +### Return type + +[**GetEgressFailedMetricsFromDeliveryOverview200Response**](GetEgressFailedMetricsFromDeliveryOverview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1beta+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getFilteredAtSourceMetricsFromDeliveryOverview + +> GetEgressFailedMetricsFromDeliveryOverview200Response getFilteredAtSourceMetricsFromDeliveryOverview(sourceId, startTime, endTime, groupBy, granularity, filter, pagination) + +Get Filtered At Source Metrics from Delivery Overview + +Get events that were filtered at Source. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeliveryOverviewApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeliveryOverviewApi apiInstance = new DeliveryOverviewApi(defaultClient); + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | The sourceId for the Workspace. This parameter exists in beta. + String startTime = "2024-01-01T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. + String endTime = "2024-01-03T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. + List groupBy = Arrays.asList(); // List | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, and `app Version`. This parameter exists in beta. + String granularity = "DAY"; // String | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. + DeliveryOverviewSourceFilterBy filter = new DeliveryOverviewSourceFilterBy(); // DeliveryOverviewSourceFilterBy | An optional filter for `event Name`, `event Type`, `discard Reason`, and/or `app Version` that can be applied in addition to a `group By`. This parameter exists in beta. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Optional params to specify the page cursor and count. This parameter exists in beta. + try { + GetEgressFailedMetricsFromDeliveryOverview200Response result = apiInstance.getFilteredAtSourceMetricsFromDeliveryOverview(sourceId, startTime, endTime, groupBy, granularity, filter, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeliveryOverviewApi#getFilteredAtSourceMetricsFromDeliveryOverview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| The sourceId for the Workspace. This parameter exists in beta. | | +| **startTime** | **String**| The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. | | +| **endTime** | **String**| The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. | | +| **groupBy** | [**List<String>**](String.md)| A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, and `app Version`. This parameter exists in beta. | [optional] | +| **granularity** | **String**| The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. | [enum: DAY, HOUR, MINUTE] | +| **filter** | [**DeliveryOverviewSourceFilterBy**](.md)| An optional filter for `event Name`, `event Type`, `discard Reason`, and/or `app Version` that can be applied in addition to a `group By`. This parameter exists in beta. | [optional] | +| **pagination** | [**PaginationInput**](.md)| Optional params to specify the page cursor and count. This parameter exists in beta. | [optional] | + +### Return type + +[**GetEgressFailedMetricsFromDeliveryOverview200Response**](GetEgressFailedMetricsFromDeliveryOverview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1beta+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getIngressFailedMetricsFromDeliveryOverview + +> GetEgressFailedMetricsFromDeliveryOverview200Response getIngressFailedMetricsFromDeliveryOverview(sourceId, startTime, endTime, groupBy, granularity, filter, pagination) + +Get Ingress Failed Metrics from Delivery Overview + +Get events that failed on ingest. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeliveryOverviewApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeliveryOverviewApi apiInstance = new DeliveryOverviewApi(defaultClient); + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | The sourceId for the Workspace. This parameter exists in beta. + String startTime = "2024-01-01T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. + String endTime = "2024-01-03T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. + List groupBy = Arrays.asList(); // List | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, and/or `appVersion`. This parameter exists in beta. + String granularity = "DAY"; // String | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. + DeliveryOverviewSourceFilterBy filter = new DeliveryOverviewSourceFilterBy(); // DeliveryOverviewSourceFilterBy | An optional filter for `event Name`, `event Type`, `discard Reason`, and/or `app Version` that can be applied in addition to a `group By`. This parameter exists in beta. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Optional params to specify the page cursor and count. This parameter exists in beta. + try { + GetEgressFailedMetricsFromDeliveryOverview200Response result = apiInstance.getIngressFailedMetricsFromDeliveryOverview(sourceId, startTime, endTime, groupBy, granularity, filter, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeliveryOverviewApi#getIngressFailedMetricsFromDeliveryOverview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| The sourceId for the Workspace. This parameter exists in beta. | | +| **startTime** | **String**| The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. | | +| **endTime** | **String**| The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. | | +| **groupBy** | [**List<String>**](String.md)| A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, and/or `appVersion`. This parameter exists in beta. | [optional] | +| **granularity** | **String**| The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. | [enum: DAY, HOUR, MINUTE] | +| **filter** | [**DeliveryOverviewSourceFilterBy**](.md)| An optional filter for `event Name`, `event Type`, `discard Reason`, and/or `app Version` that can be applied in addition to a `group By`. This parameter exists in beta. | [optional] | +| **pagination** | [**PaginationInput**](.md)| Optional params to specify the page cursor and count. This parameter exists in beta. | [optional] | + +### Return type + +[**GetEgressFailedMetricsFromDeliveryOverview200Response**](GetEgressFailedMetricsFromDeliveryOverview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1beta+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getIngressSuccessMetricsFromDeliveryOverview + +> GetEgressFailedMetricsFromDeliveryOverview200Response getIngressSuccessMetricsFromDeliveryOverview(sourceId, startTime, endTime, groupBy, granularity, filter, pagination) + +Get Ingress Success Metrics from Delivery Overview + +Get events that were successfully received by Segment. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DeliveryOverviewApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DeliveryOverviewApi apiInstance = new DeliveryOverviewApi(defaultClient); + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | The sourceId for the Workspace. This parameter exists in beta. + String startTime = "2024-01-01T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. + String endTime = "2024-01-03T00:00:00Z"; // String | The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. + List groupBy = Arrays.asList(); // List | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, and/or `app Version`. This parameter exists in beta. + String granularity = "DAY"; // String | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. + DeliveryOverviewSuccessfullyReceivedFilterBy filter = new DeliveryOverviewSuccessfullyReceivedFilterBy(); // DeliveryOverviewSuccessfullyReceivedFilterBy | An optional filter for `event Name`, `event Type`, and/or `app Version` that can be applied in addition to a `group By`. This parameter exists in beta. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Optional params to specify the page cursor and count. This parameter exists in beta. + try { + GetEgressFailedMetricsFromDeliveryOverview200Response result = apiInstance.getIngressSuccessMetricsFromDeliveryOverview(sourceId, startTime, endTime, groupBy, granularity, filter, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DeliveryOverviewApi#getIngressSuccessMetricsFromDeliveryOverview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| The sourceId for the Workspace. This parameter exists in beta. | | +| **startTime** | **String**| The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. | | +| **endTime** | **String**| The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. | | +| **groupBy** | [**List<String>**](String.md)| A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, and/or `app Version`. This parameter exists in beta. | [optional] | +| **granularity** | **String**| The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. | [enum: DAY, HOUR, MINUTE] | +| **filter** | [**DeliveryOverviewSuccessfullyReceivedFilterBy**](.md)| An optional filter for `event Name`, `event Type`, and/or `app Version` that can be applied in addition to a `group By`. This parameter exists in beta. | [optional] | +| **pagination** | [**PaginationInput**](.md)| Optional params to specify the page cursor and count. This parameter exists in beta. | [optional] | + +### Return type + +[**GetEgressFailedMetricsFromDeliveryOverview200Response**](GetEgressFailedMetricsFromDeliveryOverview200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1beta+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/DestinationFiltersApi.md b/docs/DestinationFiltersApi.md new file mode 100644 index 00000000..844bb68c --- /dev/null +++ b/docs/DestinationFiltersApi.md @@ -0,0 +1,464 @@ +# DestinationFiltersApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createFilterForDestination**](DestinationFiltersApi.md#createFilterForDestination) | **POST** /destination/{destinationId}/filters | Create Filter for Destination | +| [**getFilterInDestination**](DestinationFiltersApi.md#getFilterInDestination) | **GET** /destination/{destinationId}/filters/{filterId} | Get Filter in Destination | +| [**listFiltersFromDestination**](DestinationFiltersApi.md#listFiltersFromDestination) | **GET** /destination/{destinationId}/filters | List Filters from Destination | +| [**previewDestinationFilter**](DestinationFiltersApi.md#previewDestinationFilter) | **POST** /destination/filters/preview | Preview Destination Filter | +| [**removeFilterFromDestination**](DestinationFiltersApi.md#removeFilterFromDestination) | **DELETE** /destination/{destinationId}/filters/{filterId} | Remove Filter from Destination | +| [**updateFilterForDestination**](DestinationFiltersApi.md#updateFilterForDestination) | **PATCH** /destination/{destinationId}/filters/{filterId} | Update Filter for Destination | + + + +## Operation: createFilterForDestination + +> CreateFilterForDestination200Response createFilterForDestination(destinationId, createFilterForDestinationV1Input) + +Create Filter for Destination + +Creates a filter in a Destination. • When called, this endpoint may generate the `Destination Filter Created` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationFiltersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationFiltersApi apiInstance = new DestinationFiltersApi(defaultClient); + String destinationId = "fP7qoQw2HTWt9WdMr718gn"; // String | + CreateFilterForDestinationV1Input createFilterForDestinationV1Input = new CreateFilterForDestinationV1Input(); // CreateFilterForDestinationV1Input | + try { + CreateFilterForDestination200Response result = apiInstance.createFilterForDestination(destinationId, createFilterForDestinationV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationFiltersApi#createFilterForDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | +| **createFilterForDestinationV1Input** | [**CreateFilterForDestinationV1Input**](CreateFilterForDestinationV1Input.md)| | | + +### Return type + +[**CreateFilterForDestination200Response**](CreateFilterForDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getFilterInDestination + +> GetFilterInDestination200Response getFilterInDestination(destinationId, filterId) + +Get Filter in Destination + +Gets a Destination filter by id. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationFiltersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationFiltersApi apiInstance = new DestinationFiltersApi(defaultClient); + String destinationId = "fP7qoQw2HTWt9WdMr718gn"; // String | + String filterId = "xx6AySGeFExzdv2Gw2EuhV"; // String | + try { + GetFilterInDestination200Response result = apiInstance.getFilterInDestination(destinationId, filterId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationFiltersApi#getFilterInDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | +| **filterId** | **String**| | | + +### Return type + +[**GetFilterInDestination200Response**](GetFilterInDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listFiltersFromDestination + +> ListFiltersFromDestination200Response listFiltersFromDestination(destinationId, pagination) + +List Filters from Destination + +Lists filters for a Destination. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationFiltersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationFiltersApi apiInstance = new DestinationFiltersApi(defaultClient); + String destinationId = "qtiZHLLqqsHmpvLXNtP5du"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination options. This parameter exists in v1. + try { + ListFiltersFromDestination200Response result = apiInstance.listFiltersFromDestination(destinationId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationFiltersApi#listFiltersFromDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Pagination options. This parameter exists in v1. | [optional] | + +### Return type + +[**ListFiltersFromDestination200Response**](ListFiltersFromDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: previewDestinationFilter + +> PreviewDestinationFilter200Response previewDestinationFilter(previewDestinationFilterV1Input) + +Preview Destination Filter + +Simulates the application of a Destination filter to a provided JSON payload. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationFiltersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationFiltersApi apiInstance = new DestinationFiltersApi(defaultClient); + PreviewDestinationFilterV1Input previewDestinationFilterV1Input = new PreviewDestinationFilterV1Input(); // PreviewDestinationFilterV1Input | + try { + PreviewDestinationFilter200Response result = apiInstance.previewDestinationFilter(previewDestinationFilterV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationFiltersApi#previewDestinationFilter"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **previewDestinationFilterV1Input** | [**PreviewDestinationFilterV1Input**](PreviewDestinationFilterV1Input.md)| | | + +### Return type + +[**PreviewDestinationFilter200Response**](PreviewDestinationFilter200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: removeFilterFromDestination + +> RemoveFilterFromDestination200Response removeFilterFromDestination(destinationId, filterId) + +Remove Filter from Destination + +Deletes a Destination filter. • When called, this endpoint may generate the `Destination Filter Deleted` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationFiltersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationFiltersApi apiInstance = new DestinationFiltersApi(defaultClient); + String destinationId = "fP7qoQw2HTWt9WdMr718gn"; // String | + String filterId = "2c0vbGYWOBwbKszg0F0CoLSS01b"; // String | + try { + RemoveFilterFromDestination200Response result = apiInstance.removeFilterFromDestination(destinationId, filterId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationFiltersApi#removeFilterFromDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | +| **filterId** | **String**| | | + +### Return type + +[**RemoveFilterFromDestination200Response**](RemoveFilterFromDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateFilterForDestination + +> UpdateFilterForDestination200Response updateFilterForDestination(destinationId, filterId, updateFilterForDestinationV1Input) + +Update Filter for Destination + +Updates a filter in a Destination. • When called, this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Destination Filter Enabled * Destination Filter Disabled + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationFiltersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationFiltersApi apiInstance = new DestinationFiltersApi(defaultClient); + String destinationId = "fP7qoQw2HTWt9WdMr718gn"; // String | + String filterId = "xx6AySGeFExzdv2Gw2EuhV"; // String | + UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input = new UpdateFilterForDestinationV1Input(); // UpdateFilterForDestinationV1Input | + try { + UpdateFilterForDestination200Response result = apiInstance.updateFilterForDestination(destinationId, filterId, updateFilterForDestinationV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationFiltersApi#updateFilterForDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | +| **filterId** | **String**| | | +| **updateFilterForDestinationV1Input** | [**UpdateFilterForDestinationV1Input**](UpdateFilterForDestinationV1Input.md)| | | + +### Return type + +[**UpdateFilterForDestination200Response**](UpdateFilterForDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/DestinationsApi.md b/docs/DestinationsApi.md new file mode 100644 index 00000000..6022c56b --- /dev/null +++ b/docs/DestinationsApi.md @@ -0,0 +1,844 @@ +# DestinationsApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createDestination**](DestinationsApi.md#createDestination) | **POST** /destinations | Create Destination | +| [**createDestinationSubscription**](DestinationsApi.md#createDestinationSubscription) | **POST** /destinations/{destinationId}/subscriptions | Create Destination Subscription | +| [**deleteDestination**](DestinationsApi.md#deleteDestination) | **DELETE** /destinations/{destinationId} | Delete Destination | +| [**getDestination**](DestinationsApi.md#getDestination) | **GET** /destinations/{destinationId} | Get Destination | +| [**getSubscriptionFromDestination**](DestinationsApi.md#getSubscriptionFromDestination) | **GET** /destinations/{destinationId}/subscriptions/{id} | Get Subscription from Destination | +| [**listDeliveryMetricsSummaryFromDestination**](DestinationsApi.md#listDeliveryMetricsSummaryFromDestination) | **GET** /destinations/{destinationId}/delivery-metrics | List Delivery Metrics Summary from Destination | +| [**listDestinations**](DestinationsApi.md#listDestinations) | **GET** /destinations | List Destinations | +| [**listSubscriptionsFromDestination**](DestinationsApi.md#listSubscriptionsFromDestination) | **GET** /destinations/{destinationId}/subscriptions | List Subscriptions from Destination | +| [**removeSubscriptionFromDestination**](DestinationsApi.md#removeSubscriptionFromDestination) | **DELETE** /destinations/{destinationId}/subscriptions/{id} | Remove Subscription from Destination | +| [**updateDestination**](DestinationsApi.md#updateDestination) | **PATCH** /destinations/{destinationId} | Update Destination | +| [**updateSubscriptionForDestination**](DestinationsApi.md#updateSubscriptionForDestination) | **PATCH** /destinations/{destinationId}/subscriptions/{id} | Update Subscription for Destination | + + + +## Operation: createDestination + +> CreateDestination200Response createDestination(createDestinationV1Input) + +Create Destination + +Creates a new Destination. • When called, this endpoint may generate the `Integration Created` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationsApi apiInstance = new DestinationsApi(defaultClient); + CreateDestinationV1Input createDestinationV1Input = new CreateDestinationV1Input(); // CreateDestinationV1Input | + try { + CreateDestination200Response result = apiInstance.createDestination(createDestinationV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationsApi#createDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createDestinationV1Input** | [**CreateDestinationV1Input**](CreateDestinationV1Input.md)| | | + +### Return type + +[**CreateDestination200Response**](CreateDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createDestinationSubscription + +> CreateDestinationSubscription200Response createDestinationSubscription(destinationId, createDestinationSubscriptionAlphaInput) + +Create Destination Subscription + +Creates a new Destination subscription. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 5 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationsApi apiInstance = new DestinationsApi(defaultClient); + String destinationId = "fP7qoQw2HTWt9WdMr718gn"; // String | + CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput = new CreateDestinationSubscriptionAlphaInput(); // CreateDestinationSubscriptionAlphaInput | + try { + CreateDestinationSubscription200Response result = apiInstance.createDestinationSubscription(destinationId, createDestinationSubscriptionAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationsApi#createDestinationSubscription"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | +| **createDestinationSubscriptionAlphaInput** | [**CreateDestinationSubscriptionAlphaInput**](CreateDestinationSubscriptionAlphaInput.md)| | | + +### Return type + +[**CreateDestinationSubscription200Response**](CreateDestinationSubscription200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteDestination + +> DeleteDestination200Response deleteDestination(destinationId) + +Delete Destination + +Deletes an existing Destination. • When called, this endpoint may generate the `Integration Deleted` event in the [audit trail](/tag/Audit-Trail). Config API omitted fields: - `catalogId` + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationsApi apiInstance = new DestinationsApi(defaultClient); + String destinationId = "65c2bdbede6f2d8297f943db"; // String | + try { + DeleteDestination200Response result = apiInstance.deleteDestination(destinationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationsApi#deleteDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | + +### Return type + +[**DeleteDestination200Response**](DeleteDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getDestination + +> GetDestination200Response getDestination(destinationId) + +Get Destination + +Returns a Destination by its id. Config API omitted fields: - `catalogId` + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationsApi apiInstance = new DestinationsApi(defaultClient); + String destinationId = "qtiZHLLqqsHmpvLXNtP5du"; // String | + try { + GetDestination200Response result = apiInstance.getDestination(destinationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationsApi#getDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | + +### Return type + +[**GetDestination200Response**](GetDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getSubscriptionFromDestination + +> GetSubscriptionFromDestination200Response getSubscriptionFromDestination(destinationId, id) + +Get Subscription from Destination + +Gets a Destination subscription by id. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationsApi apiInstance = new DestinationsApi(defaultClient); + String destinationId = "fP7qoQw2HTWt9WdMr718gn"; // String | + String id = "kyMKN6LUgMvF8dwRMEz3cX"; // String | + try { + GetSubscriptionFromDestination200Response result = apiInstance.getSubscriptionFromDestination(destinationId, id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationsApi#getSubscriptionFromDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | +| **id** | **String**| | | + +### Return type + +[**GetSubscriptionFromDestination200Response**](GetSubscriptionFromDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listDeliveryMetricsSummaryFromDestination + +> ListDeliveryMetricsSummaryFromDestination200Response listDeliveryMetricsSummaryFromDestination(destinationId, sourceId, startTime, endTime, granularity) + +List Delivery Metrics Summary from Destination + +Get an event delivery metrics summary from a Destination. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 7 days - Oldest possible start time: 7 days in the past **Day**: - Max time range: 14 days - Oldest possible start time: 14 days in the past + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationsApi apiInstance = new DestinationsApi(defaultClient); + String destinationId = "fP7qoQw2HTWt9WdMr718gn"; // String | + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | The id of the Source linked to the Destination. Config API note: analogous to `parent`. This parameter exists in beta. + String startTime = "2006-01-02T15:04:05.000Z"; // String | Filter events that happened after this time. Defaults to: - 1 hour ago if granularity is `MINUTE`. - 7 days ago if granularity is `HOUR`. - 30 days ago if granularity is `DAY`. This parameter exists in beta. + String endTime = "2006-01-02T15:04:05.000Z"; // String | Filter events that happened before this time. Defaults to now if not set. This parameter exists in beta. + String granularity = "DAY"; // String | The granularity to filter metrics to. Either `MINUTE`, `HOUR` or `DAY`. Defaults to `MINUTE` if not set. This parameter exists in beta. + try { + ListDeliveryMetricsSummaryFromDestination200Response result = apiInstance.listDeliveryMetricsSummaryFromDestination(destinationId, sourceId, startTime, endTime, granularity); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationsApi#listDeliveryMetricsSummaryFromDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | +| **sourceId** | **String**| The id of the Source linked to the Destination. Config API note: analogous to `parent`. This parameter exists in beta. | | +| **startTime** | **String**| Filter events that happened after this time. Defaults to: - 1 hour ago if granularity is `MINUTE`. - 7 days ago if granularity is `HOUR`. - 30 days ago if granularity is `DAY`. This parameter exists in beta. | [optional] | +| **endTime** | **String**| Filter events that happened before this time. Defaults to now if not set. This parameter exists in beta. | [optional] | +| **granularity** | **String**| The granularity to filter metrics to. Either `MINUTE`, `HOUR` or `DAY`. Defaults to `MINUTE` if not set. This parameter exists in beta. | [optional] [enum: DAY, HOUR, MINUTE] | + +### Return type + +[**ListDeliveryMetricsSummaryFromDestination200Response**](ListDeliveryMetricsSummaryFromDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listDestinations + +> ListDestinations200Response listDestinations(pagination) + +List Destinations + +Returns a list of Destinations. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationsApi apiInstance = new DestinationsApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Required pagination params for the request. This parameter exists in v1. + try { + ListDestinations200Response result = apiInstance.listDestinations(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationsApi#listDestinations"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Required pagination params for the request. This parameter exists in v1. | [optional] | + +### Return type + +[**ListDestinations200Response**](ListDestinations200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listSubscriptionsFromDestination + +> ListSubscriptionsFromDestination200Response listSubscriptionsFromDestination(destinationId, pagination) + +List Subscriptions from Destination + +Lists subscriptions for a Destination. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationsApi apiInstance = new DestinationsApi(defaultClient); + String destinationId = "fP7qoQw2HTWt9WdMr718gn"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination options. This parameter exists in alpha. + try { + ListSubscriptionsFromDestination200Response result = apiInstance.listSubscriptionsFromDestination(destinationId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationsApi#listSubscriptionsFromDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Pagination options. This parameter exists in alpha. | [optional] | + +### Return type + +[**ListSubscriptionsFromDestination200Response**](ListSubscriptionsFromDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: removeSubscriptionFromDestination + +> RemoveSubscriptionFromDestination200Response removeSubscriptionFromDestination(destinationId, id) + +Remove Subscription from Destination + +Deletes an existing Destination subscription. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 5 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationsApi apiInstance = new DestinationsApi(defaultClient); + String destinationId = "fP7qoQw2HTWt9WdMr718gn"; // String | + String id = "zXCqmEMHJojkD45GcBAPt"; // String | + try { + RemoveSubscriptionFromDestination200Response result = apiInstance.removeSubscriptionFromDestination(destinationId, id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationsApi#removeSubscriptionFromDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | +| **id** | **String**| | | + +### Return type + +[**RemoveSubscriptionFromDestination200Response**](RemoveSubscriptionFromDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateDestination + +> UpdateDestination200Response updateDestination(destinationId, updateDestinationV1Input) + +Update Destination + +Updates an existing Destination. **Note**: if you attempt to update read-only settings for your destination you'll encounter the following behavior: * If only read-only properties are being updated, the endpoint will return an HTTP 400 error. * If there's a mix of writable and read-only properties in the payload, the request will be accepted, the writable properties will be updated and the read-only properties ignored. • When called, this endpoint may generate the `Integration Disabled` event in the [audit trail](/tag/Audit-Trail). Config API omitted fields: - `updateMask` + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationsApi apiInstance = new DestinationsApi(defaultClient); + String destinationId = "qtiZHLLqqsHmpvLXNtP5du"; // String | + UpdateDestinationV1Input updateDestinationV1Input = new UpdateDestinationV1Input(); // UpdateDestinationV1Input | + try { + UpdateDestination200Response result = apiInstance.updateDestination(destinationId, updateDestinationV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationsApi#updateDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | +| **updateDestinationV1Input** | [**UpdateDestinationV1Input**](UpdateDestinationV1Input.md)| | | + +### Return type + +[**UpdateDestination200Response**](UpdateDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateSubscriptionForDestination + +> UpdateSubscriptionForDestination200Response updateSubscriptionForDestination(destinationId, id, updateSubscriptionForDestinationAlphaInput) + +Update Subscription for Destination + +Updates an existing Destination subscription. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 5 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.DestinationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + DestinationsApi apiInstance = new DestinationsApi(defaultClient); + String destinationId = "qtiZHLLqqsHmpvLXNtP5du"; // String | + String id = "pJtn52LjrcD1TrQcm2ZSwp"; // String | + UpdateSubscriptionForDestinationAlphaInput updateSubscriptionForDestinationAlphaInput = new UpdateSubscriptionForDestinationAlphaInput(); // UpdateSubscriptionForDestinationAlphaInput | + try { + UpdateSubscriptionForDestination200Response result = apiInstance.updateSubscriptionForDestination(destinationId, id, updateSubscriptionForDestinationAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DestinationsApi#updateSubscriptionForDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **destinationId** | **String**| | | +| **id** | **String**| | | +| **updateSubscriptionForDestinationAlphaInput** | [**UpdateSubscriptionForDestinationAlphaInput**](UpdateSubscriptionForDestinationAlphaInput.md)| | | + +### Return type + +[**UpdateSubscriptionForDestination200Response**](UpdateSubscriptionForDestination200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/EdgeFunctionsApi.md b/docs/EdgeFunctionsApi.md new file mode 100644 index 00000000..954703c7 --- /dev/null +++ b/docs/EdgeFunctionsApi.md @@ -0,0 +1,306 @@ +# EdgeFunctionsApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createEdgeFunctions**](EdgeFunctionsApi.md#createEdgeFunctions) | **POST** /sources/{sourceId}/edge-functions | Create Edge Functions | +| [**disableEdgeFunctions**](EdgeFunctionsApi.md#disableEdgeFunctions) | **PATCH** /sources/{sourceId}/edge-functions/disable | Disable Edge Functions | +| [**generateUploadURLForEdgeFunctions**](EdgeFunctionsApi.md#generateUploadURLForEdgeFunctions) | **POST** /sources/{sourceId}/edge-functions/upload-url | Generate Upload URL for Edge Functions | +| [**getLatestFromEdgeFunctions**](EdgeFunctionsApi.md#getLatestFromEdgeFunctions) | **GET** /sources/{sourceId}/edge-functions/latest | Get Latest from Edge Functions | + + + +## Operation: createEdgeFunctions + +> CreateEdgeFunctions200Response createEdgeFunctions(sourceId, createEdgeFunctionsAlphaInput) + +Create Edge Functions + +Create EdgeFunctions for your Source given a valid upload URL for an Edge Functions bundle. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.EdgeFunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + EdgeFunctionsApi apiInstance = new EdgeFunctionsApi(defaultClient); + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | + CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput = new CreateEdgeFunctionsAlphaInput(); // CreateEdgeFunctionsAlphaInput | + try { + CreateEdgeFunctions200Response result = apiInstance.createEdgeFunctions(sourceId, createEdgeFunctionsAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling EdgeFunctionsApi#createEdgeFunctions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | +| **createEdgeFunctionsAlphaInput** | [**CreateEdgeFunctionsAlphaInput**](CreateEdgeFunctionsAlphaInput.md)| | | + +### Return type + +[**CreateEdgeFunctions200Response**](CreateEdgeFunctions200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: disableEdgeFunctions + +> DisableEdgeFunctions200Response disableEdgeFunctions(sourceId) + +Disable Edge Functions + +Disable Edge Functions for your Source. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.EdgeFunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + EdgeFunctionsApi apiInstance = new EdgeFunctionsApi(defaultClient); + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | + try { + DisableEdgeFunctions200Response result = apiInstance.disableEdgeFunctions(sourceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling EdgeFunctionsApi#disableEdgeFunctions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | + +### Return type + +[**DisableEdgeFunctions200Response**](DisableEdgeFunctions200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: generateUploadURLForEdgeFunctions + +> GenerateUploadURLForEdgeFunctions200Response generateUploadURLForEdgeFunctions(sourceId) + +Generate Upload URL for Edge Functions + +Generate a temporary upload URL that can be used to upload an Edge Functions bundle. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.EdgeFunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + EdgeFunctionsApi apiInstance = new EdgeFunctionsApi(defaultClient); + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | + try { + GenerateUploadURLForEdgeFunctions200Response result = apiInstance.generateUploadURLForEdgeFunctions(sourceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling EdgeFunctionsApi#generateUploadURLForEdgeFunctions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | + +### Return type + +[**GenerateUploadURLForEdgeFunctions200Response**](GenerateUploadURLForEdgeFunctions200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getLatestFromEdgeFunctions + +> GetLatestFromEdgeFunctions200Response getLatestFromEdgeFunctions(sourceId) + +Get Latest from Edge Functions + +Get the latest Edge Functions for your Source. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.EdgeFunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + EdgeFunctionsApi apiInstance = new EdgeFunctionsApi(defaultClient); + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | + try { + GetLatestFromEdgeFunctions200Response result = apiInstance.getLatestFromEdgeFunctions(sourceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling EdgeFunctionsApi#getLatestFromEdgeFunctions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | + +### Return type + +[**GetLatestFromEdgeFunctions200Response**](GetLatestFromEdgeFunctions200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/EventsApi.md b/docs/EventsApi.md new file mode 100644 index 00000000..fa3cec8b --- /dev/null +++ b/docs/EventsApi.md @@ -0,0 +1,98 @@ +# EventsApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getEventsVolumeFromWorkspace**](EventsApi.md#getEventsVolumeFromWorkspace) | **GET** /events/volume | Get Events Volume from Workspace | + + + +## Operation: getEventsVolumeFromWorkspace + +> GetEventsVolumeFromWorkspace200Response getEventsVolumeFromWorkspace(granularity, startTime, endTime, groupBy, sourceId, eventName, eventType, appVersion, pagination) + +Get Events Volume from Workspace + +Enumerates the Workspace event volumes over time in minute increments. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.EventsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + EventsApi apiInstance = new EventsApi(defaultClient); + String granularity = "DAY"; // String | The size of each bucket in the requested window. This parameter exists in v1. + String startTime = "2021-10-28T00:00:00Z"; // String | The ISO8601 formatted timestamp that corresponds to the beginning of the requested time frame, inclusive. This parameter exists in v1. + String endTime = "2021-10-29T16:40:00Z"; // String | The ISO8601 formatted timestamp that corresponds to the end of the requested time frame, noninclusive. Segment recommends that you lag queries 1 minute behind clock time to reduce the risk for latency to impact the counts. This parameter exists in v1. + List groupBy = Arrays.asList(); // List | A comma-delimited list of strings that represents the dimensions to group the result by. The options are: `eventName`, `eventType` and `source`. This parameter exists in v1. + List sourceId = Arrays.asList(); // List | A list of strings which filters the results to the given SourceIds. This parameter exists in v1. + List eventName = Arrays.asList(); // List | A list of strings which filters the results to the given EventNames. This parameter exists in v1. + List eventType = Arrays.asList(); // List | A list of strings which filters the results to the given EventTypes. This parameter exists in v1. + List appVersion = Arrays.asList(); // List | A list of strings which filters the results to the given AppVersions. This parameter exists in v1. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination input for event volume by Workspace. This parameter exists in v1. + try { + GetEventsVolumeFromWorkspace200Response result = apiInstance.getEventsVolumeFromWorkspace(granularity, startTime, endTime, groupBy, sourceId, eventName, eventType, appVersion, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling EventsApi#getEventsVolumeFromWorkspace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **granularity** | **String**| The size of each bucket in the requested window. This parameter exists in v1. | [enum: DAY, HOUR, MINUTE] | +| **startTime** | **String**| The ISO8601 formatted timestamp that corresponds to the beginning of the requested time frame, inclusive. This parameter exists in v1. | | +| **endTime** | **String**| The ISO8601 formatted timestamp that corresponds to the end of the requested time frame, noninclusive. Segment recommends that you lag queries 1 minute behind clock time to reduce the risk for latency to impact the counts. This parameter exists in v1. | | +| **groupBy** | [**List<String>**](String.md)| A comma-delimited list of strings that represents the dimensions to group the result by. The options are: `eventName`, `eventType` and `source`. This parameter exists in v1. | [optional] | +| **sourceId** | [**List<String>**](String.md)| A list of strings which filters the results to the given SourceIds. This parameter exists in v1. | [optional] | +| **eventName** | [**List<String>**](String.md)| A list of strings which filters the results to the given EventNames. This parameter exists in v1. | [optional] | +| **eventType** | [**List<String>**](String.md)| A list of strings which filters the results to the given EventTypes. This parameter exists in v1. | [optional] | +| **appVersion** | [**List<String>**](String.md)| A list of strings which filters the results to the given AppVersions. This parameter exists in v1. | [optional] | +| **pagination** | [**PaginationInput**](.md)| Pagination input for event volume by Workspace. This parameter exists in v1. | [optional] | + +### Return type + +[**GetEventsVolumeFromWorkspace200Response**](GetEventsVolumeFromWorkspace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/FunctionsApi.md b/docs/FunctionsApi.md new file mode 100644 index 00000000..b35be929 --- /dev/null +++ b/docs/FunctionsApi.md @@ -0,0 +1,1058 @@ +# FunctionsApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createFunction**](FunctionsApi.md#createFunction) | **POST** /functions | Create Function | +| [**createFunctionDeployment**](FunctionsApi.md#createFunctionDeployment) | **POST** /functions/{functionId}/deploy | Create Function Deployment | +| [**createInsertFunctionInstance**](FunctionsApi.md#createInsertFunctionInstance) | **POST** /insert-function-instances | Create Insert Function Instance | +| [**deleteFunction**](FunctionsApi.md#deleteFunction) | **DELETE** /functions/{functionId} | Delete Function | +| [**deleteInsertFunctionInstance**](FunctionsApi.md#deleteInsertFunctionInstance) | **DELETE** /insert-function-instances/{instanceId} | Delete Insert Function Instance | +| [**getFunction**](FunctionsApi.md#getFunction) | **GET** /functions/{functionId} | Get Function | +| [**getFunctionVersion**](FunctionsApi.md#getFunctionVersion) | **GET** /functions/{functionId}/versions/{versionId} | Get Function Version | +| [**getInsertFunctionInstance**](FunctionsApi.md#getInsertFunctionInstance) | **GET** /insert-function-instances/{instanceId} | Get Insert Function Instance | +| [**listFunctionVersions**](FunctionsApi.md#listFunctionVersions) | **GET** /functions/{functionId}/versions | List Function Versions | +| [**listFunctions**](FunctionsApi.md#listFunctions) | **GET** /functions | List Functions | +| [**listInsertFunctionInstances**](FunctionsApi.md#listInsertFunctionInstances) | **GET** /insert-function-instances | List Insert Function Instances | +| [**restoreFunctionVersion**](FunctionsApi.md#restoreFunctionVersion) | **POST** /functions/{functionId}/versions | Restore Function Version | +| [**updateFunction**](FunctionsApi.md#updateFunction) | **PATCH** /functions/{functionId} | Update Function | +| [**updateInsertFunctionInstance**](FunctionsApi.md#updateInsertFunctionInstance) | **PATCH** /insert-function-instances/{instanceId} | Update Insert Function Instance | + + + +## Operation: createFunction + +> CreateFunction200Response createFunction(createFunctionV1Input) + +Create Function + +Creates a Function. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + CreateFunctionV1Input createFunctionV1Input = new CreateFunctionV1Input(); // CreateFunctionV1Input | + try { + CreateFunction200Response result = apiInstance.createFunction(createFunctionV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#createFunction"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createFunctionV1Input** | [**CreateFunctionV1Input**](CreateFunctionV1Input.md)| | | + +### Return type + +[**CreateFunction200Response**](CreateFunction200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createFunctionDeployment + +> CreateFunctionDeployment200Response createFunctionDeployment(functionId) + +Create Function Deployment + +Deploys a Function. Only applicable to Source Function instances. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + String functionId = "sfn_rh5BDZp6QDHvXFCkibm1pR"; // String | + try { + CreateFunctionDeployment200Response result = apiInstance.createFunctionDeployment(functionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#createFunctionDeployment"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **functionId** | **String**| | | + +### Return type + +[**CreateFunctionDeployment200Response**](CreateFunctionDeployment200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createInsertFunctionInstance + +> CreateInsertFunctionInstance200Response createInsertFunctionInstance(createInsertFunctionInstanceAlphaInput) + +Create Insert Function Instance + +Creates an insert Function instance connected to the given Destination. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + CreateInsertFunctionInstanceAlphaInput createInsertFunctionInstanceAlphaInput = new CreateInsertFunctionInstanceAlphaInput(); // CreateInsertFunctionInstanceAlphaInput | + try { + CreateInsertFunctionInstance200Response result = apiInstance.createInsertFunctionInstance(createInsertFunctionInstanceAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#createInsertFunctionInstance"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createInsertFunctionInstanceAlphaInput** | [**CreateInsertFunctionInstanceAlphaInput**](CreateInsertFunctionInstanceAlphaInput.md)| | | + +### Return type + +[**CreateInsertFunctionInstance200Response**](CreateInsertFunctionInstance200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteFunction + +> DeleteFunction200Response deleteFunction(functionId) + +Delete Function + +Deletes a Function. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + String functionId = "sfnc_wXzcDGFR3KmjLDrtSawNHf"; // String | + try { + DeleteFunction200Response result = apiInstance.deleteFunction(functionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#deleteFunction"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **functionId** | **String**| | | + +### Return type + +[**DeleteFunction200Response**](DeleteFunction200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteInsertFunctionInstance + +> DeleteInsertFunctionInstance200Response deleteInsertFunctionInstance(instanceId) + +Delete Insert Function Instance + +Deletes an insert Function instance. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + String instanceId = "65c2bdbdde6f2d8297f943da"; // String | + try { + DeleteInsertFunctionInstance200Response result = apiInstance.deleteInsertFunctionInstance(instanceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#deleteInsertFunctionInstance"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **instanceId** | **String**| | | + +### Return type + +[**DeleteInsertFunctionInstance200Response**](DeleteInsertFunctionInstance200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getFunction + +> GetFunction200Response getFunction(functionId) + +Get Function + +Gets a Function. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + String functionId = "sfnc_wXzcDGFR3KmjLDrtSawNHf"; // String | + try { + GetFunction200Response result = apiInstance.getFunction(functionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#getFunction"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **functionId** | **String**| | | + +### Return type + +[**GetFunction200Response**](GetFunction200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getFunctionVersion + +> GetFunctionVersion200Response getFunctionVersion(functionId, versionId) + +Get Function Version + +Gets a Function version. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + String functionId = "sfnc_wXzcDGFR3KmjLDrtSawNHf"; // String | + String versionId = "2Ma03fahSqLoEzQfV5o2aSfVEHs"; // String | + try { + GetFunctionVersion200Response result = apiInstance.getFunctionVersion(functionId, versionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#getFunctionVersion"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **functionId** | **String**| | | +| **versionId** | **String**| | | + +### Return type + +[**GetFunctionVersion200Response**](GetFunctionVersion200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getInsertFunctionInstance + +> GetInsertFunctionInstance200Response getInsertFunctionInstance(instanceId) + +Get Insert Function Instance + +Gets an insert Function instance. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + String instanceId = "65c2bdbcde6f2d8297f943d7"; // String | + try { + GetInsertFunctionInstance200Response result = apiInstance.getInsertFunctionInstance(instanceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#getInsertFunctionInstance"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **instanceId** | **String**| | | + +### Return type + +[**GetInsertFunctionInstance200Response**](GetInsertFunctionInstance200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listFunctionVersions + +> ListFunctionVersions200Response listFunctionVersions(functionId, pagination) + +List Function Versions + +Lists versions for a Function in a Workspace. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + String functionId = "sfnc_wXzcDGFR3KmjLDrtSawNHf"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination parameters. This parameter exists in alpha. + try { + ListFunctionVersions200Response result = apiInstance.listFunctionVersions(functionId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#listFunctionVersions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **functionId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Pagination parameters. This parameter exists in alpha. | [optional] | + +### Return type + +[**ListFunctionVersions200Response**](ListFunctionVersions200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listFunctions + +> ListFunctions200Response listFunctions(pagination, resourceType) + +List Functions + +Lists all Functions in a Workspace. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination parameters. This parameter exists in v1. + String resourceType = "DESTINATION"; // String | The Function type. Config API note: equal to `type`. This parameter exists in v1. + try { + ListFunctions200Response result = apiInstance.listFunctions(pagination, resourceType); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#listFunctions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Pagination parameters. This parameter exists in v1. | [optional] | +| **resourceType** | **String**| The Function type. Config API note: equal to `type`. This parameter exists in v1. | [enum: DESTINATION, INSERT_DESTINATION, INSERT_SOURCE, SOURCE] | + +### Return type + +[**ListFunctions200Response**](ListFunctions200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listInsertFunctionInstances + +> ListInsertFunctionInstances200Response listInsertFunctionInstances(pagination, functionId) + +List Insert Function Instances + +Lists all insert Function instances connected to the given insert Function. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination parameters. This parameter exists in alpha. + String functionId = "76365637324e715a67535831"; // String | The insert Function class id to lookup. This parameter exists in alpha. + try { + ListInsertFunctionInstances200Response result = apiInstance.listInsertFunctionInstances(pagination, functionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#listInsertFunctionInstances"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Pagination parameters. This parameter exists in alpha. | [optional] | +| **functionId** | **String**| The insert Function class id to lookup. This parameter exists in alpha. | | + +### Return type + +[**ListInsertFunctionInstances200Response**](ListInsertFunctionInstances200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: restoreFunctionVersion + +> RestoreFunctionVersion200Response restoreFunctionVersion(functionId, restoreFunctionVersionAlphaInput) + +Restore Function Version + +Restore an old Function version as the latest version. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + String functionId = "sfnc_wXzcDGFR3KmjLDrtSawNHf"; // String | + RestoreFunctionVersionAlphaInput restoreFunctionVersionAlphaInput = new RestoreFunctionVersionAlphaInput(); // RestoreFunctionVersionAlphaInput | + try { + RestoreFunctionVersion200Response result = apiInstance.restoreFunctionVersion(functionId, restoreFunctionVersionAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#restoreFunctionVersion"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **functionId** | **String**| | | +| **restoreFunctionVersionAlphaInput** | [**RestoreFunctionVersionAlphaInput**](RestoreFunctionVersionAlphaInput.md)| | | + +### Return type + +[**RestoreFunctionVersion200Response**](RestoreFunctionVersion200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateFunction + +> UpdateFunction200Response updateFunction(functionId, updateFunctionV1Input) + +Update Function + +Updates a Function. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. Config API omitted fields: - `updateMask` + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + String functionId = "sfnc_wXzcDGFR3KmjLDrtSawNHf"; // String | + UpdateFunctionV1Input updateFunctionV1Input = new UpdateFunctionV1Input(); // UpdateFunctionV1Input | + try { + UpdateFunction200Response result = apiInstance.updateFunction(functionId, updateFunctionV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#updateFunction"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **functionId** | **String**| | | +| **updateFunctionV1Input** | [**UpdateFunctionV1Input**](UpdateFunctionV1Input.md)| | | + +### Return type + +[**UpdateFunction200Response**](UpdateFunction200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateInsertFunctionInstance + +> UpdateInsertFunctionInstance200Response updateInsertFunctionInstance(instanceId, updateInsertFunctionInstanceAlphaInput) + +Update Insert Function Instance + +Updates an insert Function instance connected to the given Destination. • In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.FunctionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + FunctionsApi apiInstance = new FunctionsApi(defaultClient); + String instanceId = "65c2bdbcde6f2d8297f943d8"; // String | + UpdateInsertFunctionInstanceAlphaInput updateInsertFunctionInstanceAlphaInput = new UpdateInsertFunctionInstanceAlphaInput(); // UpdateInsertFunctionInstanceAlphaInput | + try { + UpdateInsertFunctionInstance200Response result = apiInstance.updateInsertFunctionInstance(instanceId, updateInsertFunctionInstanceAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsApi#updateInsertFunctionInstance"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **instanceId** | **String**| | | +| **updateInsertFunctionInstanceAlphaInput** | [**UpdateInsertFunctionInstanceAlphaInput**](UpdateInsertFunctionInstanceAlphaInput.md)| | | + +### Return type + +[**UpdateInsertFunctionInstance200Response**](UpdateInsertFunctionInstance200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/IamGroupsApi.md b/docs/IamGroupsApi.md new file mode 100644 index 00000000..465f3226 --- /dev/null +++ b/docs/IamGroupsApi.md @@ -0,0 +1,912 @@ +# IamGroupsApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPermissionsToUserGroup**](IamGroupsApi.md#addPermissionsToUserGroup) | **POST** /groups/{userGroupId}/permissions | Add Permissions to User Group | +| [**addUsersToUserGroup**](IamGroupsApi.md#addUsersToUserGroup) | **POST** /groups/{userGroupId}/users | Add Users to User Group | +| [**createUserGroup**](IamGroupsApi.md#createUserGroup) | **POST** /groups | Create User Group | +| [**deleteUserGroup**](IamGroupsApi.md#deleteUserGroup) | **DELETE** /groups/{userGroupId} | Delete User Group | +| [**getUserGroup**](IamGroupsApi.md#getUserGroup) | **GET** /groups/{userGroupId} | Get User Group | +| [**listInvitesFromUserGroup**](IamGroupsApi.md#listInvitesFromUserGroup) | **GET** /groups/{userGroupId}/invites | List Invites from User Group | +| [**listUserGroups**](IamGroupsApi.md#listUserGroups) | **GET** /groups | List User Groups | +| [**listUsersFromUserGroup**](IamGroupsApi.md#listUsersFromUserGroup) | **GET** /groups/{userGroupId}/users | List Users from User Group | +| [**removeUsersFromUserGroup**](IamGroupsApi.md#removeUsersFromUserGroup) | **DELETE** /group/{userGroupId}/users | Remove Users from User Group | +| [**replacePermissionsForUserGroup**](IamGroupsApi.md#replacePermissionsForUserGroup) | **PUT** /groups/{userGroupId}/permissions | Replace Permissions for User Group | +| [**replaceUsersInUserGroup**](IamGroupsApi.md#replaceUsersInUserGroup) | **PUT** /group/{userGroupId}/users | Replace Users in User Group | +| [**updateUserGroup**](IamGroupsApi.md#updateUserGroup) | **PATCH** /groups/{userGroupId} | Update User Group | + + + +## Operation: addPermissionsToUserGroup + +> AddPermissionsToUserGroup200Response addPermissionsToUserGroup(userGroupId, addPermissionsToUserGroupV1Input) + +Add Permissions to User Group + +Adds a list of access permissions to a user group. • When called, this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Policy Created * User Group Policy Updated The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamGroupsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamGroupsApi apiInstance = new IamGroupsApi(defaultClient); + String userGroupId = "bBABwqbaDf2QdwTbW8bNEm"; // String | + AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input = new AddPermissionsToUserGroupV1Input(); // AddPermissionsToUserGroupV1Input | + try { + AddPermissionsToUserGroup200Response result = apiInstance.addPermissionsToUserGroup(userGroupId, addPermissionsToUserGroupV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamGroupsApi#addPermissionsToUserGroup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userGroupId** | **String**| | | +| **addPermissionsToUserGroupV1Input** | [**AddPermissionsToUserGroupV1Input**](AddPermissionsToUserGroupV1Input.md)| | | + +### Return type + +[**AddPermissionsToUserGroup200Response**](AddPermissionsToUserGroup200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: addUsersToUserGroup + +> AddUsersToUserGroup200Response addUsersToUserGroup(userGroupId, addUsersToUserGroupV1Input) + +Add Users to User Group + +Adds a list of users or invites to a user group. • When called, this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Subjects Added to Group * User Added To User Group The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamGroupsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamGroupsApi apiInstance = new IamGroupsApi(defaultClient); + String userGroupId = "bBABwqbaDf2QdwTbW8bNEm"; // String | + AddUsersToUserGroupV1Input addUsersToUserGroupV1Input = new AddUsersToUserGroupV1Input(); // AddUsersToUserGroupV1Input | + try { + AddUsersToUserGroup200Response result = apiInstance.addUsersToUserGroup(userGroupId, addUsersToUserGroupV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamGroupsApi#addUsersToUserGroup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userGroupId** | **String**| | | +| **addUsersToUserGroupV1Input** | [**AddUsersToUserGroupV1Input**](AddUsersToUserGroupV1Input.md)| | | + +### Return type + +[**AddUsersToUserGroup200Response**](AddUsersToUserGroup200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createUserGroup + +> CreateUserGroup200Response createUserGroup(createUserGroupV1Input) + +Create User Group + +Creates a user group. • When called, this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* User Group Created * Policy Created The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamGroupsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamGroupsApi apiInstance = new IamGroupsApi(defaultClient); + CreateUserGroupV1Input createUserGroupV1Input = new CreateUserGroupV1Input(); // CreateUserGroupV1Input | + try { + CreateUserGroup200Response result = apiInstance.createUserGroup(createUserGroupV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamGroupsApi#createUserGroup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createUserGroupV1Input** | [**CreateUserGroupV1Input**](CreateUserGroupV1Input.md)| | | + +### Return type + +[**CreateUserGroup200Response**](CreateUserGroup200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteUserGroup + +> DeleteUserGroup200Response deleteUserGroup(userGroupId) + +Delete User Group + +Removes a user group from a Workspace. • When called, this endpoint may generate the `User Group Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamGroupsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamGroupsApi apiInstance = new IamGroupsApi(defaultClient); + String userGroupId = "2c0vZc1kXJ9Nf9wIJ1Gb7JzORGf"; // String | + try { + DeleteUserGroup200Response result = apiInstance.deleteUserGroup(userGroupId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamGroupsApi#deleteUserGroup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userGroupId** | **String**| | | + +### Return type + +[**DeleteUserGroup200Response**](DeleteUserGroup200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getUserGroup + +> GetUserGroup200Response getUserGroup(userGroupId) + +Get User Group + +Returns a user group. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamGroupsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamGroupsApi apiInstance = new IamGroupsApi(defaultClient); + String userGroupId = "bBABwqbaDf2QdwTbW8bNEm"; // String | + try { + GetUserGroup200Response result = apiInstance.getUserGroup(userGroupId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamGroupsApi#getUserGroup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userGroupId** | **String**| | | + +### Return type + +[**GetUserGroup200Response**](GetUserGroup200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listInvitesFromUserGroup + +> ListInvitesFromUserGroup200Response listInvitesFromUserGroup(userGroupId, pagination) + +List Invites from User Group + +Returns the emails of invitees to a user group. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamGroupsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamGroupsApi apiInstance = new IamGroupsApi(defaultClient); + String userGroupId = "bBABwqbaDf2QdwTbW8bNEm"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination for invites to the group. This parameter exists in v1. + try { + ListInvitesFromUserGroup200Response result = apiInstance.listInvitesFromUserGroup(userGroupId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamGroupsApi#listInvitesFromUserGroup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userGroupId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Pagination for invites to the group. This parameter exists in v1. | [optional] | + +### Return type + +[**ListInvitesFromUserGroup200Response**](ListInvitesFromUserGroup200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listUserGroups + +> ListUserGroups200Response listUserGroups(pagination) + +List User Groups + +Returns all user groups. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamGroupsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamGroupsApi apiInstance = new IamGroupsApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination for user groups. This parameter exists in v1. + try { + ListUserGroups200Response result = apiInstance.listUserGroups(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamGroupsApi#listUserGroups"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Pagination for user groups. This parameter exists in v1. | [optional] | + +### Return type + +[**ListUserGroups200Response**](ListUserGroups200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listUsersFromUserGroup + +> ListUsersFromUserGroup200Response listUsersFromUserGroup(userGroupId, pagination) + +List Users from User Group + +Returns users belonging to a user group. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamGroupsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamGroupsApi apiInstance = new IamGroupsApi(defaultClient); + String userGroupId = "bBABwqbaDf2QdwTbW8bNEm"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination for members of a group. This parameter exists in v1. + try { + ListUsersFromUserGroup200Response result = apiInstance.listUsersFromUserGroup(userGroupId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamGroupsApi#listUsersFromUserGroup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userGroupId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Pagination for members of a group. This parameter exists in v1. | [optional] | + +### Return type + +[**ListUsersFromUserGroup200Response**](ListUsersFromUserGroup200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: removeUsersFromUserGroup + +> RemoveUsersFromUserGroup200Response removeUsersFromUserGroup(userGroupId, emails) + +Remove Users from User Group + +Removes one or multiple users or invites from a user group by email. • When called, this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Group Memberships Deleted * User Removed From User Group The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamGroupsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamGroupsApi apiInstance = new IamGroupsApi(defaultClient); + String userGroupId = "bBABwqbaDf2QdwTbW8bNEm"; // String | + List emails = Arrays.asList(); // List | The list of emails to remove from the user group. This parameter exists in v1. + try { + RemoveUsersFromUserGroup200Response result = apiInstance.removeUsersFromUserGroup(userGroupId, emails); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamGroupsApi#removeUsersFromUserGroup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userGroupId** | **String**| | | +| **emails** | [**List<String>**](String.md)| The list of emails to remove from the user group. This parameter exists in v1. | | + +### Return type + +[**RemoveUsersFromUserGroup200Response**](RemoveUsersFromUserGroup200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: replacePermissionsForUserGroup + +> ReplacePermissionsForUserGroup200Response replacePermissionsForUserGroup(userGroupId, replacePermissionsForUserGroupV1Input) + +Replace Permissions for User Group + +Updates the list of access permissions for a user group. • When called, this endpoint may generate the `Policy Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamGroupsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamGroupsApi apiInstance = new IamGroupsApi(defaultClient); + String userGroupId = "bBABwqbaDf2QdwTbW8bNEm"; // String | + ReplacePermissionsForUserGroupV1Input replacePermissionsForUserGroupV1Input = new ReplacePermissionsForUserGroupV1Input(); // ReplacePermissionsForUserGroupV1Input | + try { + ReplacePermissionsForUserGroup200Response result = apiInstance.replacePermissionsForUserGroup(userGroupId, replacePermissionsForUserGroupV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamGroupsApi#replacePermissionsForUserGroup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userGroupId** | **String**| | | +| **replacePermissionsForUserGroupV1Input** | [**ReplacePermissionsForUserGroupV1Input**](ReplacePermissionsForUserGroupV1Input.md)| | | + +### Return type + +[**ReplacePermissionsForUserGroup200Response**](ReplacePermissionsForUserGroup200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: replaceUsersInUserGroup + +> ReplaceUsersInUserGroup200Response replaceUsersInUserGroup(userGroupId, replaceUsersInUserGroupV1Input) + +Replace Users in User Group + +Replaces the members of a user group by email. • When called, this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Subjects Added to Group * User Added To User Group * Group Memberships Deleted The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamGroupsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamGroupsApi apiInstance = new IamGroupsApi(defaultClient); + String userGroupId = "bBABwqbaDf2QdwTbW8bNEm"; // String | + ReplaceUsersInUserGroupV1Input replaceUsersInUserGroupV1Input = new ReplaceUsersInUserGroupV1Input(); // ReplaceUsersInUserGroupV1Input | + try { + ReplaceUsersInUserGroup200Response result = apiInstance.replaceUsersInUserGroup(userGroupId, replaceUsersInUserGroupV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamGroupsApi#replaceUsersInUserGroup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userGroupId** | **String**| | | +| **replaceUsersInUserGroupV1Input** | [**ReplaceUsersInUserGroupV1Input**](ReplaceUsersInUserGroupV1Input.md)| | | + +### Return type + +[**ReplaceUsersInUserGroup200Response**](ReplaceUsersInUserGroup200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateUserGroup + +> UpdateUserGroup200Response updateUserGroup(userGroupId, updateUserGroupV1Input) + +Update User Group + +Updates a user group for a Workspace. • When called, this endpoint may generate the `User Group Updated` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamGroupsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamGroupsApi apiInstance = new IamGroupsApi(defaultClient); + String userGroupId = "bBABwqbaDf2QdwTbW8bNEm"; // String | + UpdateUserGroupV1Input updateUserGroupV1Input = new UpdateUserGroupV1Input(); // UpdateUserGroupV1Input | + try { + UpdateUserGroup200Response result = apiInstance.updateUserGroup(userGroupId, updateUserGroupV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamGroupsApi#updateUserGroup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userGroupId** | **String**| | | +| **updateUserGroupV1Input** | [**UpdateUserGroupV1Input**](UpdateUserGroupV1Input.md)| | | + +### Return type + +[**UpdateUserGroup200Response**](UpdateUserGroup200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/IamRolesApi.md b/docs/IamRolesApi.md new file mode 100644 index 00000000..461c8a94 --- /dev/null +++ b/docs/IamRolesApi.md @@ -0,0 +1,82 @@ +# IamRolesApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**listRoles**](IamRolesApi.md#listRoles) | **GET** /roles | List Roles | + + + +## Operation: listRoles + +> ListRoles200Response listRoles(pagination) + +List Roles + +Returns a list of Roles available to apply to permissions for users and/or groups. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamRolesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamRolesApi apiInstance = new IamRolesApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination for roles. This parameter exists in v1. + try { + ListRoles200Response result = apiInstance.listRoles(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamRolesApi#listRoles"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Pagination for roles. This parameter exists in v1. | [optional] | + +### Return type + +[**ListRoles200Response**](ListRoles200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/IamUsersApi.md b/docs/IamUsersApi.md new file mode 100644 index 00000000..134df1fc --- /dev/null +++ b/docs/IamUsersApi.md @@ -0,0 +1,680 @@ +# IamUsersApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPermissionsToUser**](IamUsersApi.md#addPermissionsToUser) | **POST** /users/{userId}/permissions | Add Permissions to User | +| [**createInvites**](IamUsersApi.md#createInvites) | **POST** /invites | Create Invites | +| [**deleteInvites**](IamUsersApi.md#deleteInvites) | **DELETE** /invites | Delete Invites | +| [**deleteUsers**](IamUsersApi.md#deleteUsers) | **DELETE** /users | Delete Users | +| [**getUser**](IamUsersApi.md#getUser) | **GET** /users/{userId} | Get User | +| [**listInvites**](IamUsersApi.md#listInvites) | **GET** /invites | List Invites | +| [**listUserGroupsFromUser**](IamUsersApi.md#listUserGroupsFromUser) | **GET** /users/{userId}/groups | List User Groups from User | +| [**listUsers**](IamUsersApi.md#listUsers) | **GET** /users | List Users | +| [**replacePermissionsForUser**](IamUsersApi.md#replacePermissionsForUser) | **PUT** /users/{userId}/permissions | Replace Permissions for User | + + + +## Operation: addPermissionsToUser + +> AddPermissionsToUser200Response addPermissionsToUser(userId, addPermissionsToUserV1Input) + +Add Permissions to User + +Adds a list of access permissions to a user. • When called, this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Policy Created * User Policy Updated The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamUsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamUsersApi apiInstance = new IamUsersApi(defaultClient); + String userId = "sgJDWk3K21k6LE3tLU9nRK"; // String | + AddPermissionsToUserV1Input addPermissionsToUserV1Input = new AddPermissionsToUserV1Input(); // AddPermissionsToUserV1Input | + try { + AddPermissionsToUser200Response result = apiInstance.addPermissionsToUser(userId, addPermissionsToUserV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamUsersApi#addPermissionsToUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **addPermissionsToUserV1Input** | [**AddPermissionsToUserV1Input**](AddPermissionsToUserV1Input.md)| | | + +### Return type + +[**AddPermissionsToUser200Response**](AddPermissionsToUser200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createInvites + +> CreateInvites201Response createInvites(createInvitesV1Input) + +Create Invites + +Invites a list of users to join a Workspace. • When called, this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Non-Segment User Invited to Workspace * Policy Created * New Segment User Invited to Workspace Config API omitted fields: - `parent` The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamUsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamUsersApi apiInstance = new IamUsersApi(defaultClient); + CreateInvitesV1Input createInvitesV1Input = new CreateInvitesV1Input(); // CreateInvitesV1Input | + try { + CreateInvites201Response result = apiInstance.createInvites(createInvitesV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamUsersApi#createInvites"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createInvitesV1Input** | [**CreateInvitesV1Input**](CreateInvitesV1Input.md)| | | + +### Return type + +[**CreateInvites201Response**](CreateInvites201Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteInvites + +> DeleteInvites200Response deleteInvites(emails) + +Delete Invites + +Removes a list of invitations to join a Workspace. • When called, this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Invite Deleted * Group Memberships Deleted The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamUsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamUsersApi apiInstance = new IamUsersApi(defaultClient); + List emails = Arrays.asList(); // List | The list of emails to delete invites for. This parameter exists in v1. + try { + DeleteInvites200Response result = apiInstance.deleteInvites(emails); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamUsersApi#deleteInvites"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **emails** | [**List<String>**](String.md)| The list of emails to delete invites for. This parameter exists in v1. | | + +### Return type + +[**DeleteInvites200Response**](DeleteInvites200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteUsers + +> DeleteUsers200Response deleteUsers(userIds) + +Delete Users + +Removes one or multiple users. • When called, this endpoint may generate the `Group Memberships Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamUsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamUsersApi apiInstance = new IamUsersApi(defaultClient); + List userIds = Arrays.asList(); // List | The ids of the users to remove. This parameter exists in v1. + try { + DeleteUsers200Response result = apiInstance.deleteUsers(userIds); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamUsersApi#deleteUsers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userIds** | [**List<String>**](String.md)| The ids of the users to remove. This parameter exists in v1. | | + +### Return type + +[**DeleteUsers200Response**](DeleteUsers200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getUser + +> GetUser200Response getUser(userId) + +Get User + +Returns a user given their id. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamUsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamUsersApi apiInstance = new IamUsersApi(defaultClient); + String userId = "sgJDWk3K21k6LE3tLU9nRK"; // String | + try { + GetUser200Response result = apiInstance.getUser(userId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamUsersApi#getUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | + +### Return type + +[**GetUser200Response**](GetUser200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listInvites + +> ListInvites200Response listInvites(pagination) + +List Invites + +Returns a list of invitations to join a Workspace. Config API omitted fields: - `parent` + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamUsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamUsersApi apiInstance = new IamUsersApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Defines the pagination parameters. This parameter exists in v1. + try { + ListInvites200Response result = apiInstance.listInvites(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamUsersApi#listInvites"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Defines the pagination parameters. This parameter exists in v1. | [optional] | + +### Return type + +[**ListInvites200Response**](ListInvites200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listUserGroupsFromUser + +> ListUserGroupsFromUser200Response listUserGroupsFromUser(userId, pagination) + +List User Groups from User + +Returns all groups a user belongs to. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamUsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamUsersApi apiInstance = new IamUsersApi(defaultClient); + String userId = "sgJDWk3K21k6LE3tLU9nRK"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination for groups. This parameter exists in v1. + try { + ListUserGroupsFromUser200Response result = apiInstance.listUserGroupsFromUser(userId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamUsersApi#listUserGroupsFromUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Pagination for groups. This parameter exists in v1. | [optional] | + +### Return type + +[**ListUserGroupsFromUser200Response**](ListUserGroupsFromUser200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listUsers + +> ListUsers200Response listUsers(pagination) + +List Users + +Returns a list of users with access to the Workspace. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamUsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamUsersApi apiInstance = new IamUsersApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination for users. This parameter exists in v1. + try { + ListUsers200Response result = apiInstance.listUsers(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamUsersApi#listUsers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Pagination for users. This parameter exists in v1. | [optional] | + +### Return type + +[**ListUsers200Response**](ListUsers200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: replacePermissionsForUser + +> ReplacePermissionsForUser200Response replacePermissionsForUser(userId, replacePermissionsForUserV1Input) + +Replace Permissions for User + +Updates the list of access permissions for a user. • When called, this endpoint may generate the `Policy Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.IamUsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + IamUsersApi apiInstance = new IamUsersApi(defaultClient); + String userId = "sgJDWk3K21k6LE3tLU9nRK"; // String | + ReplacePermissionsForUserV1Input replacePermissionsForUserV1Input = new ReplacePermissionsForUserV1Input(); // ReplacePermissionsForUserV1Input | + try { + ReplacePermissionsForUser200Response result = apiInstance.replacePermissionsForUser(userId, replacePermissionsForUserV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IamUsersApi#replacePermissionsForUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **replacePermissionsForUserV1Input** | [**ReplacePermissionsForUserV1Input**](ReplacePermissionsForUserV1Input.md)| | | + +### Return type + +[**ReplacePermissionsForUser200Response**](ReplacePermissionsForUser200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/LabelsApi.md b/docs/LabelsApi.md new file mode 100644 index 00000000..f8e435bd --- /dev/null +++ b/docs/LabelsApi.md @@ -0,0 +1,228 @@ +# LabelsApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createLabel**](LabelsApi.md#createLabel) | **POST** /labels | Create Label | +| [**deleteLabel**](LabelsApi.md#deleteLabel) | **DELETE** /labels/{key}/{value} | Delete Label | +| [**listLabels**](LabelsApi.md#listLabels) | **GET** /labels | List Labels | + + + +## Operation: createLabel + +> CreateLabel201Response createLabel(createLabelV1Input) + +Create Label + +Creates a new label. • When called, this endpoint may generate the `Label Created` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.LabelsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + LabelsApi apiInstance = new LabelsApi(defaultClient); + CreateLabelV1Input createLabelV1Input = new CreateLabelV1Input(); // CreateLabelV1Input | + try { + CreateLabel201Response result = apiInstance.createLabel(createLabelV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling LabelsApi#createLabel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createLabelV1Input** | [**CreateLabelV1Input**](CreateLabelV1Input.md)| | | + +### Return type + +[**CreateLabel201Response**](CreateLabel201Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteLabel + +> DeleteLabel200Response deleteLabel(key, value) + +Delete Label + +Deletes a label. • When called, this endpoint may generate the `Label Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.LabelsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + LabelsApi apiInstance = new LabelsApi(defaultClient); + String key = "environment"; // String | + String value = "yolo"; // String | + try { + DeleteLabel200Response result = apiInstance.deleteLabel(key, value); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling LabelsApi#deleteLabel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **key** | **String**| | | +| **value** | **String**| | | + +### Return type + +[**DeleteLabel200Response**](DeleteLabel200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listLabels + +> ListLabels200Response listLabels() + +List Labels + +Returns a list of all available labels. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.LabelsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + LabelsApi apiInstance = new LabelsApi(defaultClient); + try { + ListLabels200Response result = apiInstance.listLabels(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling LabelsApi#listLabels"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**ListLabels200Response**](ListLabels200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/MonthlyTrackedUsersApi.md b/docs/MonthlyTrackedUsersApi.md new file mode 100644 index 00000000..ef435eaa --- /dev/null +++ b/docs/MonthlyTrackedUsersApi.md @@ -0,0 +1,160 @@ +# MonthlyTrackedUsersApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getDailyPerSourceMTUUsage**](MonthlyTrackedUsersApi.md#getDailyPerSourceMTUUsage) | **GET** /usage/mtu/sources/daily | Get Daily Per Source MTU Usage | +| [**getDailyWorkspaceMTUUsage**](MonthlyTrackedUsersApi.md#getDailyWorkspaceMTUUsage) | **GET** /usage/mtu/daily | Get Daily Workspace MTU Usage | + + + +## Operation: getDailyPerSourceMTUUsage + +> GetDailyPerSourceMTUUsage200Response getDailyPerSourceMTUUsage(period, pagination) + +Get Daily Per Source MTU Usage + +Provides daily cumulative per-source MTU counts for a usage period. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.MonthlyTrackedUsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + MonthlyTrackedUsersApi apiInstance = new MonthlyTrackedUsersApi(defaultClient); + String period = "2021-02-01"; // String | The start of the usage month, in the ISO-8601 format. This parameter exists in v1. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination input for per Source MTU counts. This parameter exists in v1. + try { + GetDailyPerSourceMTUUsage200Response result = apiInstance.getDailyPerSourceMTUUsage(period, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MonthlyTrackedUsersApi#getDailyPerSourceMTUUsage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **period** | **String**| The start of the usage month, in the ISO-8601 format. This parameter exists in v1. | | +| **pagination** | [**PaginationInput**](.md)| Pagination input for per Source MTU counts. This parameter exists in v1. | [optional] | + +### Return type + +[**GetDailyPerSourceMTUUsage200Response**](GetDailyPerSourceMTUUsage200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getDailyWorkspaceMTUUsage + +> GetDailyWorkspaceMTUUsage200Response getDailyWorkspaceMTUUsage(period, pagination) + +Get Daily Workspace MTU Usage + +Provides daily cumulative MTU counts for a usage period. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.MonthlyTrackedUsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + MonthlyTrackedUsersApi apiInstance = new MonthlyTrackedUsersApi(defaultClient); + String period = "2021-02-01"; // String | The start of the usage month, in the ISO-8601 format. This parameter exists in v1. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination input for Workspace MTU counts. This parameter exists in v1. + try { + GetDailyWorkspaceMTUUsage200Response result = apiInstance.getDailyWorkspaceMTUUsage(period, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MonthlyTrackedUsersApi#getDailyWorkspaceMTUUsage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **period** | **String**| The start of the usage month, in the ISO-8601 format. This parameter exists in v1. | | +| **pagination** | [**PaginationInput**](.md)| Pagination input for Workspace MTU counts. This parameter exists in v1. | [optional] | + +### Return type + +[**GetDailyWorkspaceMTUUsage200Response**](GetDailyWorkspaceMTUUsage200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/ProfilesSyncApi.md b/docs/ProfilesSyncApi.md new file mode 100644 index 00000000..74c33818 --- /dev/null +++ b/docs/ProfilesSyncApi.md @@ -0,0 +1,470 @@ +# ProfilesSyncApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createProfilesWarehouse**](ProfilesSyncApi.md#createProfilesWarehouse) | **POST** /spaces/{spaceId}/profiles-warehouses | Create Profiles Warehouse | +| [**listProfilesWarehouseInSpace**](ProfilesSyncApi.md#listProfilesWarehouseInSpace) | **GET** /spaces/{spaceId}/profiles-warehouses | List Profiles Warehouse in Space | +| [**listSelectiveSyncsFromWarehouseAndSpace**](ProfilesSyncApi.md#listSelectiveSyncsFromWarehouseAndSpace) | **GET** /spaces/{spaceId}/profiles-warehouses/{warehouseId}/selective-syncs | List Selective Syncs from Warehouse And Space | +| [**removeProfilesWarehouseFromSpace**](ProfilesSyncApi.md#removeProfilesWarehouseFromSpace) | **DELETE** /spaces/{spaceId}/profiles-warehouses/{warehouseId} | Remove Profiles Warehouse from Space | +| [**updateProfilesWarehouseForSpaceWarehouse**](ProfilesSyncApi.md#updateProfilesWarehouseForSpaceWarehouse) | **PATCH** /spaces/{spaceId}/profiles-warehouses/{warehouseId} | Update Profiles Warehouse for Space Warehouse | +| [**updateSelectiveSyncForWarehouseAndSpace**](ProfilesSyncApi.md#updateSelectiveSyncForWarehouseAndSpace) | **PATCH** /spaces/{spaceId}/profiles-warehouses/{warehouseId}/selective-syncs | Update Selective Sync for Warehouse And Space | + + + +## Operation: createProfilesWarehouse + +> CreateProfilesWarehouse201Response createProfilesWarehouse(spaceId, createProfilesWarehouseAlphaInput) + +Create Profiles Warehouse + +Creates a new Profiles Warehouse. • When called, this endpoint may generate the `Profiles Sync Warehouse Created` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ProfilesSyncApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ProfilesSyncApi apiInstance = new ProfilesSyncApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + CreateProfilesWarehouseAlphaInput createProfilesWarehouseAlphaInput = new CreateProfilesWarehouseAlphaInput(); // CreateProfilesWarehouseAlphaInput | + try { + CreateProfilesWarehouse201Response result = apiInstance.createProfilesWarehouse(spaceId, createProfilesWarehouseAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ProfilesSyncApi#createProfilesWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **createProfilesWarehouseAlphaInput** | [**CreateProfilesWarehouseAlphaInput**](CreateProfilesWarehouseAlphaInput.md)| | | + +### Return type + +[**CreateProfilesWarehouse201Response**](CreateProfilesWarehouse201Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listProfilesWarehouseInSpace + +> ListProfilesWarehouseInSpace200Response listProfilesWarehouseInSpace(spaceId, pagination) + +List Profiles Warehouse in Space + +Lists all Profile Warehouses for a given space id. • When called, this endpoint may generate the `Profiles Sync Warehouse Retrieved` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ProfilesSyncApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ProfilesSyncApi apiInstance = new ProfilesSyncApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Defines the pagination parameters. This parameter exists in alpha. + try { + ListProfilesWarehouseInSpace200Response result = apiInstance.listProfilesWarehouseInSpace(spaceId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ProfilesSyncApi#listProfilesWarehouseInSpace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Defines the pagination parameters. This parameter exists in alpha. | [optional] | + +### Return type + +[**ListProfilesWarehouseInSpace200Response**](ListProfilesWarehouseInSpace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listSelectiveSyncsFromWarehouseAndSpace + +> ListSelectiveSyncsFromWarehouseAndSpace200Response listSelectiveSyncsFromWarehouseAndSpace(spaceId, warehouseId, pagination) + +List Selective Syncs from Warehouse And Space + +Returns the schema for a Space Warehouse connection, including Collections and Properties. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ProfilesSyncApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ProfilesSyncApi apiInstance = new ProfilesSyncApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + String warehouseId = "fQyLbqjfwaqg9mr3hDQ7We"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Defines the pagination parameters. This parameter exists in alpha. + try { + ListSelectiveSyncsFromWarehouseAndSpace200Response result = apiInstance.listSelectiveSyncsFromWarehouseAndSpace(spaceId, warehouseId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ProfilesSyncApi#listSelectiveSyncsFromWarehouseAndSpace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **warehouseId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Defines the pagination parameters. This parameter exists in alpha. | [optional] | + +### Return type + +[**ListSelectiveSyncsFromWarehouseAndSpace200Response**](ListSelectiveSyncsFromWarehouseAndSpace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: removeProfilesWarehouseFromSpace + +> RemoveProfilesWarehouseFromSpace200Response removeProfilesWarehouseFromSpace(spaceId, warehouseId) + +Remove Profiles Warehouse from Space + +Deletes an existing Profiles Warehouse. • When called, this endpoint may generate the `Profiles Sync Warehouse Deleted` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ProfilesSyncApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ProfilesSyncApi apiInstance = new ProfilesSyncApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + String warehouseId = "qABd3NVTPfTLQ3kXWoBhgi"; // String | + try { + RemoveProfilesWarehouseFromSpace200Response result = apiInstance.removeProfilesWarehouseFromSpace(spaceId, warehouseId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ProfilesSyncApi#removeProfilesWarehouseFromSpace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **warehouseId** | **String**| | | + +### Return type + +[**RemoveProfilesWarehouseFromSpace200Response**](RemoveProfilesWarehouseFromSpace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateProfilesWarehouseForSpaceWarehouse + +> UpdateProfilesWarehouseForSpaceWarehouse200Response updateProfilesWarehouseForSpaceWarehouse(spaceId, warehouseId, updateProfilesWarehouseForSpaceWarehouseAlphaInput) + +Update Profiles Warehouse for Space Warehouse + +Updates an existing Profiles Warehouse. • When called, this endpoint may generate the `Profiles Sync Warehouse Updated` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ProfilesSyncApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ProfilesSyncApi apiInstance = new ProfilesSyncApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + String warehouseId = "3eadBBqVMQD2DEtaWXSkqA"; // String | + UpdateProfilesWarehouseForSpaceWarehouseAlphaInput updateProfilesWarehouseForSpaceWarehouseAlphaInput = new UpdateProfilesWarehouseForSpaceWarehouseAlphaInput(); // UpdateProfilesWarehouseForSpaceWarehouseAlphaInput | + try { + UpdateProfilesWarehouseForSpaceWarehouse200Response result = apiInstance.updateProfilesWarehouseForSpaceWarehouse(spaceId, warehouseId, updateProfilesWarehouseForSpaceWarehouseAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ProfilesSyncApi#updateProfilesWarehouseForSpaceWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **warehouseId** | **String**| | | +| **updateProfilesWarehouseForSpaceWarehouseAlphaInput** | [**UpdateProfilesWarehouseForSpaceWarehouseAlphaInput**](UpdateProfilesWarehouseForSpaceWarehouseAlphaInput.md)| | | + +### Return type + +[**UpdateProfilesWarehouseForSpaceWarehouse200Response**](UpdateProfilesWarehouseForSpaceWarehouse200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateSelectiveSyncForWarehouseAndSpace + +> UpdateSelectiveSyncForWarehouseAndSpace200Response updateSelectiveSyncForWarehouseAndSpace(spaceId, warehouseId, updateSelectiveSyncForWarehouseAndSpaceAlphaInput) + +Update Selective Sync for Warehouse And Space + +Updates the schema for a Space Warehouse connection, including Collections and Properties. • When called, this endpoint may generate the `Profiles Sync Warehouse Modified` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ProfilesSyncApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ProfilesSyncApi apiInstance = new ProfilesSyncApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + String warehouseId = "qABd3NVTPfTLQ3kXWoBhgi"; // String | + UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput updateSelectiveSyncForWarehouseAndSpaceAlphaInput = new UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput(); // UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput | + try { + UpdateSelectiveSyncForWarehouseAndSpace200Response result = apiInstance.updateSelectiveSyncForWarehouseAndSpace(spaceId, warehouseId, updateSelectiveSyncForWarehouseAndSpaceAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ProfilesSyncApi#updateSelectiveSyncForWarehouseAndSpace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **warehouseId** | **String**| | | +| **updateSelectiveSyncForWarehouseAndSpaceAlphaInput** | [**UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput**](UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput.md)| | | + +### Return type + +[**UpdateSelectiveSyncForWarehouseAndSpace200Response**](UpdateSelectiveSyncForWarehouseAndSpace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/ReverseEtlApi.md b/docs/ReverseEtlApi.md new file mode 100644 index 00000000..ae378ca8 --- /dev/null +++ b/docs/ReverseEtlApi.md @@ -0,0 +1,688 @@ +# ReverseEtlApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**cancelReverseETLSyncForModel**](ReverseEtlApi.md#cancelReverseETLSyncForModel) | **POST** /reverse-etl-models/{modelId}/syncs/{syncId}/cancel | Cancel Reverse ETL Sync for Model | +| [**createReverseETLManualSync**](ReverseEtlApi.md#createReverseETLManualSync) | **POST** /reverse-etl-syncs | Create Reverse ETL Manual Sync | +| [**createReverseEtlModel**](ReverseEtlApi.md#createReverseEtlModel) | **POST** /reverse-etl-models | Create Reverse Etl Model | +| [**deleteReverseEtlModel**](ReverseEtlApi.md#deleteReverseEtlModel) | **DELETE** /reverse-etl-models/{modelId} | Delete Reverse Etl Model | +| [**getReverseETLSyncStatus**](ReverseEtlApi.md#getReverseETLSyncStatus) | **GET** /reverse-etl-models/{modelId}/syncs/{syncId} | Get Reverse ETL Sync Status | +| [**getReverseEtlModel**](ReverseEtlApi.md#getReverseEtlModel) | **GET** /reverse-etl-models/{modelId} | Get Reverse Etl Model | +| [**listReverseETLSyncStatusesFromModelAndSubscriptionId**](ReverseEtlApi.md#listReverseETLSyncStatusesFromModelAndSubscriptionId) | **GET** /reverse-etl-models/{modelId}/subscriptionId/{subscriptionId}/syncs | List Reverse ETL Sync Statuses from Model And Subscription Id | +| [**listReverseEtlModels**](ReverseEtlApi.md#listReverseEtlModels) | **GET** /reverse-etl-models | List Reverse Etl Models | +| [**updateReverseEtlModel**](ReverseEtlApi.md#updateReverseEtlModel) | **PATCH** /reverse-etl-models/{modelId} | Update Reverse Etl Model | + + + +## Operation: cancelReverseETLSyncForModel + +> CancelReverseETLSyncForModel200Response cancelReverseETLSyncForModel(modelId, syncId, cancelReverseETLSyncForModelInput) + +Cancel Reverse ETL Sync for Model + +Cancels a sync for a Reverse ETL Connection. It might take a few seconds to completely cancel the sync. Will return an error if the sync is already completed or cancelled. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ReverseEtlApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ReverseEtlApi apiInstance = new ReverseEtlApi(defaultClient); + String modelId = "modelId"; // String | + String syncId = "1"; // String | + CancelReverseETLSyncForModelInput cancelReverseETLSyncForModelInput = new CancelReverseETLSyncForModelInput(); // CancelReverseETLSyncForModelInput | + try { + CancelReverseETLSyncForModel200Response result = apiInstance.cancelReverseETLSyncForModel(modelId, syncId, cancelReverseETLSyncForModelInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReverseEtlApi#cancelReverseETLSyncForModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **modelId** | **String**| | | +| **syncId** | **String**| | | +| **cancelReverseETLSyncForModelInput** | [**CancelReverseETLSyncForModelInput**](CancelReverseETLSyncForModelInput.md)| | | + +### Return type + +[**CancelReverseETLSyncForModel200Response**](CancelReverseETLSyncForModel200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createReverseETLManualSync + +> CreateReverseETLManualSync200Response createReverseETLManualSync(createReverseETLManualSyncInput) + +Create Reverse ETL Manual Sync + +Triggers a manual sync for a Reverse ETL Connection. In the request body, the `subscription id` is the id that follows after `/mappings/` portion in the URL of the sync. For example, the `subscription id` would be `2` for this sync: https://app.Segment.com/example-workspace/reverse-etl/destinations/example-destination/sources/example-source/instances/1/mappings/2/source-id/3/model-id/4/sync-details The rate limit for this endpoint is 20 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ReverseEtlApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ReverseEtlApi apiInstance = new ReverseEtlApi(defaultClient); + CreateReverseETLManualSyncInput createReverseETLManualSyncInput = new CreateReverseETLManualSyncInput(); // CreateReverseETLManualSyncInput | + try { + CreateReverseETLManualSync200Response result = apiInstance.createReverseETLManualSync(createReverseETLManualSyncInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReverseEtlApi#createReverseETLManualSync"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createReverseETLManualSyncInput** | [**CreateReverseETLManualSyncInput**](CreateReverseETLManualSyncInput.md)| | | + +### Return type + +[**CreateReverseETLManualSync200Response**](CreateReverseETLManualSync200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createReverseEtlModel + +> CreateReverseEtlModel201Response createReverseEtlModel(createReverseEtlModelInput) + +Create Reverse Etl Model + +Creates a new Reverse ETL Model. • When called, this endpoint may generate the `Model Created` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ReverseEtlApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ReverseEtlApi apiInstance = new ReverseEtlApi(defaultClient); + CreateReverseEtlModelInput createReverseEtlModelInput = new CreateReverseEtlModelInput(); // CreateReverseEtlModelInput | + try { + CreateReverseEtlModel201Response result = apiInstance.createReverseEtlModel(createReverseEtlModelInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReverseEtlApi#createReverseEtlModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createReverseEtlModelInput** | [**CreateReverseEtlModelInput**](CreateReverseEtlModelInput.md)| | | + +### Return type + +[**CreateReverseEtlModel201Response**](CreateReverseEtlModel201Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteReverseEtlModel + +> DeleteReverseEtlModel200Response deleteReverseEtlModel(modelId) + +Delete Reverse Etl Model + +Deletes an existing Model. • When called, this endpoint may generate the `Model Deleted` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ReverseEtlApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ReverseEtlApi apiInstance = new ReverseEtlApi(defaultClient); + String modelId = "fxXMc5bLdKnDfEgBpDbV11"; // String | + try { + DeleteReverseEtlModel200Response result = apiInstance.deleteReverseEtlModel(modelId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReverseEtlApi#deleteReverseEtlModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **modelId** | **String**| | | + +### Return type + +[**DeleteReverseEtlModel200Response**](DeleteReverseEtlModel200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getReverseETLSyncStatus + +> GetReverseETLSyncStatus200Response getReverseETLSyncStatus(modelId, syncId) + +Get Reverse ETL Sync Status + +Get the sync status for a Reverse ETL sync. The sync status includes all detailed information about the sync - sync status, duration, details about the extract and load phase if applicable, etc. The rate limit for this endpoint is 250 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ReverseEtlApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ReverseEtlApi apiInstance = new ReverseEtlApi(defaultClient); + String modelId = "modelId"; // String | + String syncId = "syncId"; // String | + try { + GetReverseETLSyncStatus200Response result = apiInstance.getReverseETLSyncStatus(modelId, syncId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReverseEtlApi#getReverseETLSyncStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **modelId** | **String**| | | +| **syncId** | **String**| | | + +### Return type + +[**GetReverseETLSyncStatus200Response**](GetReverseETLSyncStatus200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getReverseEtlModel + +> GetReverseEtlModel200Response getReverseEtlModel(modelId) + +Get Reverse Etl Model + +Returns a Reverse ETL Model by its id. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ReverseEtlApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ReverseEtlApi apiInstance = new ReverseEtlApi(defaultClient); + String modelId = "jSAVzDH3z89geNDZwoNY9V"; // String | + try { + GetReverseEtlModel200Response result = apiInstance.getReverseEtlModel(modelId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReverseEtlApi#getReverseEtlModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **modelId** | **String**| | | + +### Return type + +[**GetReverseEtlModel200Response**](GetReverseEtlModel200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listReverseETLSyncStatusesFromModelAndSubscriptionId + +> ListReverseETLSyncStatusesFromModelAndSubscriptionId200Response listReverseETLSyncStatusesFromModelAndSubscriptionId(modelId, subscriptionId, count, cursor) + +List Reverse ETL Sync Statuses from Model And Subscription Id + +Get the sync statuses for a Reverse ETL mapping subscription. The sync status includes all detailed information about the sync - sync status, duration, details about the extract and load phase if applicable, etc. The default page count is 10, and then the next page can be fetched by passing the `cursor` query parameter. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ReverseEtlApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ReverseEtlApi apiInstance = new ReverseEtlApi(defaultClient); + String modelId = "modelId"; // String | + String subscriptionId = "subscriptionId"; // String | + BigDecimal count = new BigDecimal(78); // BigDecimal | The number of items to retrieve in a page, between 1 and 100. Default is 10 This parameter exists in alpha. + String cursor = "cursor_example"; // String | The page to request. Acceptable values to use are from the `current`, `next`, and `previous` keys. This parameter exists in alpha. + try { + ListReverseETLSyncStatusesFromModelAndSubscriptionId200Response result = apiInstance.listReverseETLSyncStatusesFromModelAndSubscriptionId(modelId, subscriptionId, count, cursor); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReverseEtlApi#listReverseETLSyncStatusesFromModelAndSubscriptionId"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **modelId** | **String**| | | +| **subscriptionId** | **String**| | | +| **count** | **BigDecimal**| The number of items to retrieve in a page, between 1 and 100. Default is 10 This parameter exists in alpha. | [optional] | +| **cursor** | **String**| The page to request. Acceptable values to use are from the `current`, `next`, and `previous` keys. This parameter exists in alpha. | [optional] | + +### Return type + +[**ListReverseETLSyncStatusesFromModelAndSubscriptionId200Response**](ListReverseETLSyncStatusesFromModelAndSubscriptionId200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listReverseEtlModels + +> ListReverseEtlModels200Response listReverseEtlModels(pagination) + +List Reverse Etl Models + +Returns a list of Reverse ETL Models. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ReverseEtlApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ReverseEtlApi apiInstance = new ReverseEtlApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Defines the pagination parameters. This parameter exists in alpha. + try { + ListReverseEtlModels200Response result = apiInstance.listReverseEtlModels(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReverseEtlApi#listReverseEtlModels"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Defines the pagination parameters. This parameter exists in alpha. | [optional] | + +### Return type + +[**ListReverseEtlModels200Response**](ListReverseEtlModels200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateReverseEtlModel + +> UpdateReverseEtlModel200Response updateReverseEtlModel(modelId, updateReverseEtlModelInput) + +Update Reverse Etl Model + +Updates an existing Reverse ETL Model. • When called, this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Model Settings Saved * Model State Change Toggled + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.ReverseEtlApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + ReverseEtlApi apiInstance = new ReverseEtlApi(defaultClient); + String modelId = "6BthE21tPsXyA2cK3QPQFQ"; // String | + UpdateReverseEtlModelInput updateReverseEtlModelInput = new UpdateReverseEtlModelInput(); // UpdateReverseEtlModelInput | + try { + UpdateReverseEtlModel200Response result = apiInstance.updateReverseEtlModel(modelId, updateReverseEtlModelInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReverseEtlApi#updateReverseEtlModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **modelId** | **String**| | | +| **updateReverseEtlModelInput** | [**UpdateReverseEtlModelInput**](UpdateReverseEtlModelInput.md)| | | + +### Return type + +[**UpdateReverseEtlModel200Response**](UpdateReverseEtlModel200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/SelectiveSyncApi.md b/docs/SelectiveSyncApi.md new file mode 100644 index 00000000..ae0893fb --- /dev/null +++ b/docs/SelectiveSyncApi.md @@ -0,0 +1,466 @@ +# SelectiveSyncApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getAdvancedSyncScheduleFromWarehouse**](SelectiveSyncApi.md#getAdvancedSyncScheduleFromWarehouse) | **GET** /warehouses/{warehouseId}/advanced-sync-schedule | Get Advanced Sync Schedule from Warehouse | +| [**listSelectiveSyncsFromWarehouseAndSource**](SelectiveSyncApi.md#listSelectiveSyncsFromWarehouseAndSource) | **GET** /warehouses/{warehouseId}/connected-sources/{sourceId}/selective-syncs | List Selective Syncs from Warehouse And Source | +| [**listSyncsFromWarehouse**](SelectiveSyncApi.md#listSyncsFromWarehouse) | **GET** /warehouses/{warehouseId}/syncs | List Syncs from Warehouse | +| [**listSyncsFromWarehouseAndSource**](SelectiveSyncApi.md#listSyncsFromWarehouseAndSource) | **GET** /warehouses/{warehouseId}/connected-sources/{sourceId}/syncs | List Syncs from Warehouse And Source | +| [**replaceAdvancedSyncScheduleForWarehouse**](SelectiveSyncApi.md#replaceAdvancedSyncScheduleForWarehouse) | **PUT** /warehouses/{warehouseId}/advanced-sync-schedule | Replace Advanced Sync Schedule for Warehouse | +| [**updateSelectiveSyncForWarehouse**](SelectiveSyncApi.md#updateSelectiveSyncForWarehouse) | **PATCH** /warehouses/{warehouseId}/selective-sync | Update Selective Sync for Warehouse | + + + +## Operation: getAdvancedSyncScheduleFromWarehouse + +> GetAdvancedSyncScheduleFromWarehouse200Response getAdvancedSyncScheduleFromWarehouse(warehouseId) + +Get Advanced Sync Schedule from Warehouse + +Returns the advanced sync schedule for a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SelectiveSyncApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SelectiveSyncApi apiInstance = new SelectiveSyncApi(defaultClient); + String warehouseId = "kjU72LCJexvrqL7G4TMHHN"; // String | + try { + GetAdvancedSyncScheduleFromWarehouse200Response result = apiInstance.getAdvancedSyncScheduleFromWarehouse(warehouseId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SelectiveSyncApi#getAdvancedSyncScheduleFromWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | + +### Return type + +[**GetAdvancedSyncScheduleFromWarehouse200Response**](GetAdvancedSyncScheduleFromWarehouse200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listSelectiveSyncsFromWarehouseAndSource + +> ListSelectiveSyncsFromWarehouseAndSource200Response listSelectiveSyncsFromWarehouseAndSource(warehouseId, sourceId, pagination) + +List Selective Syncs from Warehouse And Source + +Returns the schema for a Warehouse, including Sources, Collections, and Properties. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SelectiveSyncApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SelectiveSyncApi apiInstance = new SelectiveSyncApi(defaultClient); + String warehouseId = "kjU72LCJexvrqL7G4TMHHN"; // String | + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Defines the pagination parameters. This parameter exists in v1. + try { + ListSelectiveSyncsFromWarehouseAndSource200Response result = apiInstance.listSelectiveSyncsFromWarehouseAndSource(warehouseId, sourceId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SelectiveSyncApi#listSelectiveSyncsFromWarehouseAndSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | +| **sourceId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Defines the pagination parameters. This parameter exists in v1. | [optional] | + +### Return type + +[**ListSelectiveSyncsFromWarehouseAndSource200Response**](ListSelectiveSyncsFromWarehouseAndSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listSyncsFromWarehouse + +> ListSyncsFromWarehouse200Response listSyncsFromWarehouse(warehouseId, pagination) + +List Syncs from Warehouse + +Returns the overview of syncs for every Source connected to a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SelectiveSyncApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SelectiveSyncApi apiInstance = new SelectiveSyncApi(defaultClient); + String warehouseId = "kjU72LCJexvrqL7G4TMHHN"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Defines the pagination parameters. This parameter exists in v1. + try { + ListSyncsFromWarehouse200Response result = apiInstance.listSyncsFromWarehouse(warehouseId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SelectiveSyncApi#listSyncsFromWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Defines the pagination parameters. This parameter exists in v1. | [optional] | + +### Return type + +[**ListSyncsFromWarehouse200Response**](ListSyncsFromWarehouse200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listSyncsFromWarehouseAndSource + +> ListSyncsFromWarehouseAndSource200Response listSyncsFromWarehouseAndSource(warehouseId, sourceId, pagination) + +List Syncs from Warehouse And Source + +Returns the overview of syncs for a Source connected to a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SelectiveSyncApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SelectiveSyncApi apiInstance = new SelectiveSyncApi(defaultClient); + String warehouseId = "kjU72LCJexvrqL7G4TMHHN"; // String | + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Defines the pagination parameters. This parameter exists in v1. + try { + ListSyncsFromWarehouseAndSource200Response result = apiInstance.listSyncsFromWarehouseAndSource(warehouseId, sourceId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SelectiveSyncApi#listSyncsFromWarehouseAndSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | +| **sourceId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Defines the pagination parameters. This parameter exists in v1. | [optional] | + +### Return type + +[**ListSyncsFromWarehouseAndSource200Response**](ListSyncsFromWarehouseAndSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: replaceAdvancedSyncScheduleForWarehouse + +> ReplaceAdvancedSyncScheduleForWarehouse200Response replaceAdvancedSyncScheduleForWarehouse(warehouseId, replaceAdvancedSyncScheduleForWarehouseV1Input) + +Replace Advanced Sync Schedule for Warehouse + +Updates the advanced sync schedule for a Warehouse, replacing the sync schedule with a new schedule. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SelectiveSyncApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SelectiveSyncApi apiInstance = new SelectiveSyncApi(defaultClient); + String warehouseId = "kjU72LCJexvrqL7G4TMHHN"; // String | + ReplaceAdvancedSyncScheduleForWarehouseV1Input replaceAdvancedSyncScheduleForWarehouseV1Input = new ReplaceAdvancedSyncScheduleForWarehouseV1Input(); // ReplaceAdvancedSyncScheduleForWarehouseV1Input | + try { + ReplaceAdvancedSyncScheduleForWarehouse200Response result = apiInstance.replaceAdvancedSyncScheduleForWarehouse(warehouseId, replaceAdvancedSyncScheduleForWarehouseV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SelectiveSyncApi#replaceAdvancedSyncScheduleForWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | +| **replaceAdvancedSyncScheduleForWarehouseV1Input** | [**ReplaceAdvancedSyncScheduleForWarehouseV1Input**](ReplaceAdvancedSyncScheduleForWarehouseV1Input.md)| | | + +### Return type + +[**ReplaceAdvancedSyncScheduleForWarehouse200Response**](ReplaceAdvancedSyncScheduleForWarehouse200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateSelectiveSyncForWarehouse + +> UpdateSelectiveSyncForWarehouse200Response updateSelectiveSyncForWarehouse(warehouseId, updateSelectiveSyncForWarehouseV1Input) + +Update Selective Sync for Warehouse + +Configures the schema for a Warehouse, including Sources, Collections, and Properties. • When called, this endpoint may generate the `Storage Destination Modified` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SelectiveSyncApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SelectiveSyncApi apiInstance = new SelectiveSyncApi(defaultClient); + String warehouseId = "kjU72LCJexvrqL7G4TMHHN"; // String | + UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input = new UpdateSelectiveSyncForWarehouseV1Input(); // UpdateSelectiveSyncForWarehouseV1Input | + try { + UpdateSelectiveSyncForWarehouse200Response result = apiInstance.updateSelectiveSyncForWarehouse(warehouseId, updateSelectiveSyncForWarehouseV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SelectiveSyncApi#updateSelectiveSyncForWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | +| **updateSelectiveSyncForWarehouseV1Input** | [**UpdateSelectiveSyncForWarehouseV1Input**](UpdateSelectiveSyncForWarehouseV1Input.md)| | | + +### Return type + +[**UpdateSelectiveSyncForWarehouse200Response**](UpdateSelectiveSyncForWarehouse200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/SourcesApi.md b/docs/SourcesApi.md new file mode 100644 index 00000000..9b04b091 --- /dev/null +++ b/docs/SourcesApi.md @@ -0,0 +1,984 @@ +# SourcesApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addLabelsToSource**](SourcesApi.md#addLabelsToSource) | **POST** /sources/{sourceId}/labels | Add Labels to Source | +| [**createSource**](SourcesApi.md#createSource) | **POST** /sources | Create Source | +| [**createWriteKeyForSource**](SourcesApi.md#createWriteKeyForSource) | **POST** /sources/{sourceId}/writekey | Create Write Key for Source | +| [**deleteSource**](SourcesApi.md#deleteSource) | **DELETE** /sources/{sourceId} | Delete Source | +| [**getSource**](SourcesApi.md#getSource) | **GET** /sources/{sourceId} | Get Source | +| [**listConnectedDestinationsFromSource**](SourcesApi.md#listConnectedDestinationsFromSource) | **GET** /sources/{sourceId}/connected-destinations | List Connected Destinations from Source | +| [**listConnectedWarehousesFromSource**](SourcesApi.md#listConnectedWarehousesFromSource) | **GET** /sources/{sourceId}/connected-warehouses | List Connected Warehouses from Source | +| [**listSchemaSettingsInSource**](SourcesApi.md#listSchemaSettingsInSource) | **GET** /sources/{sourceId}/settings | List Schema Settings in Source | +| [**listSources**](SourcesApi.md#listSources) | **GET** /sources | List Sources | +| [**removeWriteKeyFromSource**](SourcesApi.md#removeWriteKeyFromSource) | **DELETE** /sources/{sourceId}/writekey/{writeKey} | Remove Write Key from Source | +| [**replaceLabelsInSource**](SourcesApi.md#replaceLabelsInSource) | **PUT** /sources/{sourceId}/labels | Replace Labels in Source | +| [**updateSchemaSettingsInSource**](SourcesApi.md#updateSchemaSettingsInSource) | **PATCH** /sources/{sourceId}/settings | Update Schema Settings in Source | +| [**updateSource**](SourcesApi.md#updateSource) | **PATCH** /sources/{sourceId} | Update Source | + + + +## Operation: addLabelsToSource + +> AddLabelsToSource200Response addLabelsToSource(sourceId, addLabelsToSourceV1Input) + +Add Labels to Source + +Adds an existing label to a Source. • When called, this endpoint may generate the `Source Modified` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | + AddLabelsToSourceV1Input addLabelsToSourceV1Input = new AddLabelsToSourceV1Input(); // AddLabelsToSourceV1Input | + try { + AddLabelsToSource200Response result = apiInstance.addLabelsToSource(sourceId, addLabelsToSourceV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#addLabelsToSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | +| **addLabelsToSourceV1Input** | [**AddLabelsToSourceV1Input**](AddLabelsToSourceV1Input.md)| | | + +### Return type + +[**AddLabelsToSource200Response**](AddLabelsToSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createSource + +> CreateSource201Response createSource(createSourceV1Input) + +Create Source + +Creates a new Source. • When called, this endpoint may generate the `Source Created` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + CreateSourceV1Input createSourceV1Input = new CreateSourceV1Input(); // CreateSourceV1Input | + try { + CreateSource201Response result = apiInstance.createSource(createSourceV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#createSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createSourceV1Input** | [**CreateSourceV1Input**](CreateSourceV1Input.md)| | | + +### Return type + +[**CreateSource201Response**](CreateSource201Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createWriteKeyForSource + +> CreateWriteKeyForSource200Response createWriteKeyForSource(sourceId) + +Create Write Key for Source + +Creates a new Write Key for the Source. • When called, this endpoint may generate the `Source Modified` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + String sourceId = "idR4zzU9iGcGJgoAX891nf"; // String | + try { + CreateWriteKeyForSource200Response result = apiInstance.createWriteKeyForSource(sourceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#createWriteKeyForSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | + +### Return type + +[**CreateWriteKeyForSource200Response**](CreateWriteKeyForSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteSource + +> DeleteSource200Response deleteSource(sourceId) + +Delete Source + +Deletes an existing Source. • When called, this endpoint may generate the `Source Deleted` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + String sourceId = "rYxTjyaPtAELCjnFE5EYfM"; // String | + try { + DeleteSource200Response result = apiInstance.deleteSource(sourceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#deleteSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | + +### Return type + +[**DeleteSource200Response**](DeleteSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getSource + +> GetSource200Response getSource(sourceId) + +Get Source + +Returns a Source by its id. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | + try { + GetSource200Response result = apiInstance.getSource(sourceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#getSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | + +### Return type + +[**GetSource200Response**](GetSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listConnectedDestinationsFromSource + +> ListConnectedDestinationsFromSource200Response listConnectedDestinationsFromSource(sourceId, pagination) + +List Connected Destinations from Source + +Returns a list of Destinations connected to a Source. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Required pagination params for the request. This parameter exists in alpha. + try { + ListConnectedDestinationsFromSource200Response result = apiInstance.listConnectedDestinationsFromSource(sourceId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#listConnectedDestinationsFromSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Required pagination params for the request. This parameter exists in alpha. | [optional] | + +### Return type + +[**ListConnectedDestinationsFromSource200Response**](ListConnectedDestinationsFromSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listConnectedWarehousesFromSource + +> ListConnectedWarehousesFromSource200Response listConnectedWarehousesFromSource(sourceId, pagination) + +List Connected Warehouses from Source + +Returns a list of Warehouses connected to a Source. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Required pagination params for the request. This parameter exists in alpha. + try { + ListConnectedWarehousesFromSource200Response result = apiInstance.listConnectedWarehousesFromSource(sourceId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#listConnectedWarehousesFromSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Required pagination params for the request. This parameter exists in alpha. | [optional] | + +### Return type + +[**ListConnectedWarehousesFromSource200Response**](ListConnectedWarehousesFromSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listSchemaSettingsInSource + +> ListSchemaSettingsInSource200Response listSchemaSettingsInSource(sourceId) + +List Schema Settings in Source + +Retrieves the schema configuration settings for a Source. If Protocols is not enabled for the Source, the configurations specific to Protocols will have default values. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | + try { + ListSchemaSettingsInSource200Response result = apiInstance.listSchemaSettingsInSource(sourceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#listSchemaSettingsInSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | + +### Return type + +[**ListSchemaSettingsInSource200Response**](ListSchemaSettingsInSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listSources + +> ListSources200Response listSources(pagination) + +List Sources + +Returns a list of Sources. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Defines the pagination parameters. This parameter exists in alpha. + try { + ListSources200Response result = apiInstance.listSources(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#listSources"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Defines the pagination parameters. This parameter exists in alpha. | [optional] | + +### Return type + +[**ListSources200Response**](ListSources200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: removeWriteKeyFromSource + +> RemoveWriteKeyFromSource200Response removeWriteKeyFromSource(sourceId, writeKey) + +Remove Write Key from Source + +Removes a Write Key from a Source. • When called, this endpoint may generate the `Source Modified` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + String sourceId = "idR4zzU9iGcGJgoAX891nf"; // String | + String writeKey = "wk123"; // String | + try { + RemoveWriteKeyFromSource200Response result = apiInstance.removeWriteKeyFromSource(sourceId, writeKey); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#removeWriteKeyFromSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | +| **writeKey** | **String**| | | + +### Return type + +[**RemoveWriteKeyFromSource200Response**](RemoveWriteKeyFromSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: replaceLabelsInSource + +> ReplaceLabelsInSource200Response replaceLabelsInSource(sourceId, replaceLabelsInSourceV1Input) + +Replace Labels in Source + +Replaces all labels in a Source. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | + ReplaceLabelsInSourceV1Input replaceLabelsInSourceV1Input = new ReplaceLabelsInSourceV1Input(); // ReplaceLabelsInSourceV1Input | + try { + ReplaceLabelsInSource200Response result = apiInstance.replaceLabelsInSource(sourceId, replaceLabelsInSourceV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#replaceLabelsInSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | +| **replaceLabelsInSourceV1Input** | [**ReplaceLabelsInSourceV1Input**](ReplaceLabelsInSourceV1Input.md)| | | + +### Return type + +[**ReplaceLabelsInSource200Response**](ReplaceLabelsInSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateSchemaSettingsInSource + +> UpdateSchemaSettingsInSource200Response updateSchemaSettingsInSource(sourceId, updateSchemaSettingsInSourceV1Input) + +Update Schema Settings in Source + +Updates the schema configuration for a Source. If Protocols is not enabled for the Source, any updates to Protocols-specific configurations will not be applied. Config API omitted fields: - `updateMask` + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | + UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input = new UpdateSchemaSettingsInSourceV1Input(); // UpdateSchemaSettingsInSourceV1Input | + try { + UpdateSchemaSettingsInSource200Response result = apiInstance.updateSchemaSettingsInSource(sourceId, updateSchemaSettingsInSourceV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#updateSchemaSettingsInSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | +| **updateSchemaSettingsInSourceV1Input** | [**UpdateSchemaSettingsInSourceV1Input**](UpdateSchemaSettingsInSourceV1Input.md)| | | + +### Return type + +[**UpdateSchemaSettingsInSource200Response**](UpdateSchemaSettingsInSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateSource + +> UpdateSource200Response updateSource(sourceId, updateSourceV1Input) + +Update Source + +Updates an existing Source. • When called, this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Source Modified * Source Enabled * Source Settings Modified * Source Disabled Config API omitted fields: - `updateMask` + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SourcesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SourcesApi apiInstance = new SourcesApi(defaultClient); + String sourceId = "44LMHs8Wf5vidxba4kN52J"; // String | + UpdateSourceV1Input updateSourceV1Input = new UpdateSourceV1Input(); // UpdateSourceV1Input | + try { + UpdateSource200Response result = apiInstance.updateSource(sourceId, updateSourceV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SourcesApi#updateSource"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **sourceId** | **String**| | | +| **updateSourceV1Input** | [**UpdateSourceV1Input**](UpdateSourceV1Input.md)| | | + +### Return type + +[**UpdateSource200Response**](UpdateSource200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/SpaceFiltersApi.md b/docs/SpaceFiltersApi.md new file mode 100644 index 00000000..3c2cf5a4 --- /dev/null +++ b/docs/SpaceFiltersApi.md @@ -0,0 +1,382 @@ +# SpaceFiltersApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createFilterForSpace**](SpaceFiltersApi.md#createFilterForSpace) | **POST** /filters | Create Filter for Space | +| [**deleteFilterById**](SpaceFiltersApi.md#deleteFilterById) | **DELETE** /filters/{id} | Delete Filter By Id | +| [**getFilterById**](SpaceFiltersApi.md#getFilterById) | **GET** /filters/{id} | Get Filter By Id | +| [**listFiltersForSpace**](SpaceFiltersApi.md#listFiltersForSpace) | **GET** /filters | List Filters for Space | +| [**updateFilterById**](SpaceFiltersApi.md#updateFilterById) | **PATCH** /filters/{id} | Update Filter By Id | + + + +## Operation: createFilterForSpace + +> CreateFilterForSpace200Response createFilterForSpace(createFilterForSpaceInput) + +Create Filter for Space + +Creates a filter for a space. A space filter applies to events coming from all Sources connected to a space. • This endpoint is in **Beta** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Space Filters feature enabled. Please reach out to your customer success manager for more information. • When called, this endpoint may generate the `Filter Created` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SpaceFiltersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SpaceFiltersApi apiInstance = new SpaceFiltersApi(defaultClient); + CreateFilterForSpaceInput createFilterForSpaceInput = new CreateFilterForSpaceInput(); // CreateFilterForSpaceInput | + try { + CreateFilterForSpace200Response result = apiInstance.createFilterForSpace(createFilterForSpaceInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SpaceFiltersApi#createFilterForSpace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createFilterForSpaceInput** | [**CreateFilterForSpaceInput**](CreateFilterForSpaceInput.md)| | | + +### Return type + +[**CreateFilterForSpace200Response**](CreateFilterForSpace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteFilterById + +> DeleteFilterById200Response deleteFilterById(id) + +Delete Filter By Id + +Deletes a filter by id. • This endpoint is in **Beta** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Space Filters feature enabled. Please reach out to your customer success manager for more information. • When called, this endpoint may generate the `Filter Deleted` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SpaceFiltersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SpaceFiltersApi apiInstance = new SpaceFiltersApi(defaultClient); + String id = ""; // String | + try { + DeleteFilterById200Response result = apiInstance.deleteFilterById(id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SpaceFiltersApi#deleteFilterById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **id** | **String**| | | + +### Return type + +[**DeleteFilterById200Response**](DeleteFilterById200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getFilterById + +> GetFilterById200Response getFilterById(id) + +Get Filter By Id + +Gets a filter by id. • This endpoint is in **Beta** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Space Filters feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SpaceFiltersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SpaceFiltersApi apiInstance = new SpaceFiltersApi(defaultClient); + String id = ""; // String | + try { + GetFilterById200Response result = apiInstance.getFilterById(id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SpaceFiltersApi#getFilterById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **id** | **String**| | | + +### Return type + +[**GetFilterById200Response**](GetFilterById200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listFiltersForSpace + +> ListFiltersForSpace200Response listFiltersForSpace(integrationId, pagination) + +List Filters for Space + +Lists filters for a space. • This endpoint is in **Beta** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Space Filters feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SpaceFiltersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SpaceFiltersApi apiInstance = new SpaceFiltersApi(defaultClient); + String integrationId = ""; // String | The Space Id for which to fetch filters This parameter exists in beta. + ListFiltersPaginationInput pagination = new ListFiltersPaginationInput(); // ListFiltersPaginationInput | Pagination parameters. This parameter exists in beta. + try { + ListFiltersForSpace200Response result = apiInstance.listFiltersForSpace(integrationId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SpaceFiltersApi#listFiltersForSpace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **integrationId** | **String**| The Space Id for which to fetch filters This parameter exists in beta. | | +| **pagination** | [**ListFiltersPaginationInput**](.md)| Pagination parameters. This parameter exists in beta. | [optional] | + +### Return type + +[**ListFiltersForSpace200Response**](ListFiltersForSpace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateFilterById + +> UpdateFilterById200Response updateFilterById(id, updateFilterByIdInput) + +Update Filter By Id + +Updates a filter by id and replaces the existing filter. • This endpoint is in **Beta** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Space Filters feature enabled. Please reach out to your customer success manager for more information. • When called, this endpoint may generate the `Filter Updated` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SpaceFiltersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SpaceFiltersApi apiInstance = new SpaceFiltersApi(defaultClient); + String id = ""; // String | + UpdateFilterByIdInput updateFilterByIdInput = new UpdateFilterByIdInput(); // UpdateFilterByIdInput | + try { + UpdateFilterById200Response result = apiInstance.updateFilterById(id, updateFilterByIdInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SpaceFiltersApi#updateFilterById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **id** | **String**| | | +| **updateFilterByIdInput** | [**UpdateFilterByIdInput**](UpdateFilterByIdInput.md)| | | + +### Return type + +[**UpdateFilterById200Response**](UpdateFilterById200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/SpacesApi.md b/docs/SpacesApi.md new file mode 100644 index 00000000..dbf4960c --- /dev/null +++ b/docs/SpacesApi.md @@ -0,0 +1,308 @@ +# SpacesApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**batchQueryMessagingSubscriptionsForSpace**](SpacesApi.md#batchQueryMessagingSubscriptionsForSpace) | **POST** /spaces/{spaceId}/messaging-subscriptions/batch | Batch Query Messaging Subscriptions for Space | +| [**getSpace**](SpacesApi.md#getSpace) | **GET** /spaces/{spaceId} | Get Space | +| [**listSpaces**](SpacesApi.md#listSpaces) | **GET** /spaces | List Spaces | +| [**replaceMessagingSubscriptionsInSpaces**](SpacesApi.md#replaceMessagingSubscriptionsInSpaces) | **PUT** /spaces/{spaceId}/messaging-subscriptions | Replace Messaging Subscriptions in Spaces | + + + +## Operation: batchQueryMessagingSubscriptionsForSpace + +> BatchQueryMessagingSubscriptionsForSpace200Response batchQueryMessagingSubscriptionsForSpace(spaceId, batchQueryMessagingSubscriptionsForSpaceAlphaInput) + +Batch Query Messaging Subscriptions for Space + + <div style=\"background-color: #fff3cd; border: 1px solid #ffc107; border-radius: 6px; padding: 16px; margin: 16px 0; color: #856404; display: flex; align-items: center; gap: 12px; line-height: 1.5;\"> <span style=\"color: #ff9800; font-size: 16px; flex-shrink: 0;\">⚠️</span> <div style=\"line-height: 1.5;\"> <div style=\"font-weight: 600; font-size: 14px; margin-bottom: 6px;\"> Engage Premier features will no longer be available after December 15, 2025. </div> <div style=\"font-size: 13px;\"> This API will be deactivated after this date. </div> </div> </div> Get Messaging Subscriptions for space. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Spaces feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SpacesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SpacesApi apiInstance = new SpacesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + BatchQueryMessagingSubscriptionsForSpaceAlphaInput batchQueryMessagingSubscriptionsForSpaceAlphaInput = new BatchQueryMessagingSubscriptionsForSpaceAlphaInput(); // BatchQueryMessagingSubscriptionsForSpaceAlphaInput | + try { + BatchQueryMessagingSubscriptionsForSpace200Response result = apiInstance.batchQueryMessagingSubscriptionsForSpace(spaceId, batchQueryMessagingSubscriptionsForSpaceAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SpacesApi#batchQueryMessagingSubscriptionsForSpace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **batchQueryMessagingSubscriptionsForSpaceAlphaInput** | [**BatchQueryMessagingSubscriptionsForSpaceAlphaInput**](BatchQueryMessagingSubscriptionsForSpaceAlphaInput.md)| | | + +### Return type + +[**BatchQueryMessagingSubscriptionsForSpace200Response**](BatchQueryMessagingSubscriptionsForSpace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getSpace + +> GetSpace200Response getSpace(spaceId) + +Get Space + +Returns the Space by id. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Spaces feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SpacesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SpacesApi apiInstance = new SpacesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + try { + GetSpace200Response result = apiInstance.getSpace(spaceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SpacesApi#getSpace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | + +### Return type + +[**GetSpace200Response**](GetSpace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listSpaces + +> ListSpaces200Response listSpaces(pagination) + +List Spaces + +List Spaces. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Spaces feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SpacesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SpacesApi apiInstance = new SpacesApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination params This parameter exists in alpha. + try { + ListSpaces200Response result = apiInstance.listSpaces(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SpacesApi#listSpaces"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Pagination params This parameter exists in alpha. | [optional] | + +### Return type + +[**ListSpaces200Response**](ListSpaces200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: replaceMessagingSubscriptionsInSpaces + +> ReplaceMessagingSubscriptionsInSpaces200Response replaceMessagingSubscriptionsInSpaces(spaceId, replaceMessagingSubscriptionsInSpacesAlphaInput) + +Replace Messaging Subscriptions in Spaces + + <div style=\"background-color: #fff3cd; border: 1px solid #ffc107; border-radius: 6px; padding: 16px; margin: 16px 0; color: #856404; display: flex; align-items: center; gap: 12px; line-height: 1.5;\"> <span style=\"color: #ff9800; font-size: 16px; flex-shrink: 0;\">⚠️</span> <div style=\"line-height: 1.5;\"> <div style=\"font-weight: 600; font-size: 14px; margin-bottom: 6px;\"> Engage Premier features will no longer be available after December 15, 2025. </div> <div style=\"font-size: 13px;\"> This API will be deactivated after this date. </div> </div> </div> Replace Messaging Subscriptions in Spaces. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • In order to successfully call this endpoint, the specified Workspace needs to have the Spaces feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.SpacesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + SpacesApi apiInstance = new SpacesApi(defaultClient); + String spaceId = "9aQ1Lj62S4bomZKLF4DPqW"; // String | + ReplaceMessagingSubscriptionsInSpacesAlphaInput replaceMessagingSubscriptionsInSpacesAlphaInput = new ReplaceMessagingSubscriptionsInSpacesAlphaInput(); // ReplaceMessagingSubscriptionsInSpacesAlphaInput | + try { + ReplaceMessagingSubscriptionsInSpaces200Response result = apiInstance.replaceMessagingSubscriptionsInSpaces(spaceId, replaceMessagingSubscriptionsInSpacesAlphaInput); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SpacesApi#replaceMessagingSubscriptionsInSpaces"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **spaceId** | **String**| | | +| **replaceMessagingSubscriptionsInSpacesAlphaInput** | [**ReplaceMessagingSubscriptionsInSpacesAlphaInput**](ReplaceMessagingSubscriptionsInSpacesAlphaInput.md)| | | + +### Return type + +[**ReplaceMessagingSubscriptionsInSpaces200Response**](ReplaceMessagingSubscriptionsInSpaces200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1alpha+json, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/TestingApi.md b/docs/TestingApi.md new file mode 100644 index 00000000..8bf71ace --- /dev/null +++ b/docs/TestingApi.md @@ -0,0 +1,92 @@ +# TestingApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**echo**](TestingApi.md#echo) | **GET** /echo | Echo | + + + +## Operation: echo + +> Echo200Response echo(message, delay, triggerError, triggerMultipleErrors, triggerUnexpectedError, statusCode) + +Echo + +Public Echo endpoint. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TestingApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TestingApi apiInstance = new TestingApi(defaultClient); + String message = "Hello, World!"; // String | Sets the response `message` field. The response contains this field's entry. This parameter exists in alpha. + BigDecimal delay = new BigDecimal(78); // BigDecimal | The desired response delay, in milliseconds. This parameter exists in alpha. + Boolean triggerError = true; // Boolean | If `true`, returns an HTTP `4xx` error that contains the string in `message`. This parameter exists in alpha. + Boolean triggerMultipleErrors = true; // Boolean | If `true`, returns an HTTP `4xx` error that contains the value of the `message` field in the error message array. This has no effect if the request sets `triggerError`. This parameter exists in alpha. + Boolean triggerUnexpectedError = true; // Boolean | If `true`, triggers a `500` error. This has no effect if the request sets either `triggerError` or `triggerMultipleErrors`. This parameter exists in alpha. + BigDecimal statusCode = new BigDecimal(78); // BigDecimal | Sets the HTTP status code to return. This parameter exists in alpha. + try { + Echo200Response result = apiInstance.echo(message, delay, triggerError, triggerMultipleErrors, triggerUnexpectedError, statusCode); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TestingApi#echo"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **message** | **String**| Sets the response `message` field. The response contains this field's entry. This parameter exists in alpha. | | +| **delay** | **BigDecimal**| The desired response delay, in milliseconds. This parameter exists in alpha. | [optional] | +| **triggerError** | **Boolean**| If `true`, returns an HTTP `4xx` error that contains the string in `message`. This parameter exists in alpha. | [optional] | +| **triggerMultipleErrors** | **Boolean**| If `true`, returns an HTTP `4xx` error that contains the value of the `message` field in the error message array. This has no effect if the request sets `triggerError`. This parameter exists in alpha. | [optional] | +| **triggerUnexpectedError** | **Boolean**| If `true`, triggers a `500` error. This has no effect if the request sets either `triggerError` or `triggerMultipleErrors`. This parameter exists in alpha. | [optional] | +| **statusCode** | **BigDecimal**| Sets the HTTP status code to return. This parameter exists in alpha. | [optional] | + +### Return type + +[**Echo200Response**](Echo200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/TrackingPlansApi.md b/docs/TrackingPlansApi.md new file mode 100644 index 00000000..769856e8 --- /dev/null +++ b/docs/TrackingPlansApi.md @@ -0,0 +1,914 @@ +# TrackingPlansApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addSourceToTrackingPlan**](TrackingPlansApi.md#addSourceToTrackingPlan) | **POST** /tracking-plans/{trackingPlanId}/sources | Add Source to Tracking Plan | +| [**createTrackingPlan**](TrackingPlansApi.md#createTrackingPlan) | **POST** /tracking-plans | Create Tracking Plan | +| [**deleteTrackingPlan**](TrackingPlansApi.md#deleteTrackingPlan) | **DELETE** /tracking-plans/{trackingPlanId} | Delete Tracking Plan | +| [**getTrackingPlan**](TrackingPlansApi.md#getTrackingPlan) | **GET** /tracking-plans/{trackingPlanId} | Get Tracking Plan | +| [**listRulesFromTrackingPlan**](TrackingPlansApi.md#listRulesFromTrackingPlan) | **GET** /tracking-plans/{trackingPlanId}/rules | List Rules from Tracking Plan | +| [**listSourcesFromTrackingPlan**](TrackingPlansApi.md#listSourcesFromTrackingPlan) | **GET** /tracking-plans/{trackingPlanId}/sources | List Sources from Tracking Plan | +| [**listTrackingPlans**](TrackingPlansApi.md#listTrackingPlans) | **GET** /tracking-plans | List Tracking Plans | +| [**removeRulesFromTrackingPlan**](TrackingPlansApi.md#removeRulesFromTrackingPlan) | **DELETE** /tracking-plans/{trackingPlanId}/rules | Remove Rules from Tracking Plan | +| [**removeSourceFromTrackingPlan**](TrackingPlansApi.md#removeSourceFromTrackingPlan) | **DELETE** /tracking-plans/{trackingPlanId}/sources | Remove Source from Tracking Plan | +| [**replaceRulesInTrackingPlan**](TrackingPlansApi.md#replaceRulesInTrackingPlan) | **PUT** /tracking-plans/{trackingPlanId}/rules | Replace Rules in Tracking Plan | +| [**updateRulesInTrackingPlan**](TrackingPlansApi.md#updateRulesInTrackingPlan) | **PATCH** /tracking-plans/{trackingPlanId}/rules | Update Rules in Tracking Plan | +| [**updateTrackingPlan**](TrackingPlansApi.md#updateTrackingPlan) | **PATCH** /tracking-plans/{trackingPlanId} | Update Tracking Plan | + + + +## Operation: addSourceToTrackingPlan + +> AddSourceToTrackingPlan200Response addSourceToTrackingPlan(trackingPlanId, addSourceToTrackingPlanV1Input) + +Add Source to Tracking Plan + +Connects a Source to a Tracking Plan. • When called, this endpoint may generate the `Source Modified` event in the [audit trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TrackingPlansApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TrackingPlansApi apiInstance = new TrackingPlansApi(defaultClient); + String trackingPlanId = "tp_sprout_rVGCC6WdrNxjCf6JpCHP"; // String | + AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input = new AddSourceToTrackingPlanV1Input(); // AddSourceToTrackingPlanV1Input | + try { + AddSourceToTrackingPlan200Response result = apiInstance.addSourceToTrackingPlan(trackingPlanId, addSourceToTrackingPlanV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TrackingPlansApi#addSourceToTrackingPlan"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **trackingPlanId** | **String**| | | +| **addSourceToTrackingPlanV1Input** | [**AddSourceToTrackingPlanV1Input**](AddSourceToTrackingPlanV1Input.md)| | | + +### Return type + +[**AddSourceToTrackingPlan200Response**](AddSourceToTrackingPlan200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createTrackingPlan + +> CreateTrackingPlan200Response createTrackingPlan(createTrackingPlanV1Input) + +Create Tracking Plan + +Creates a Tracking Plan. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TrackingPlansApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TrackingPlansApi apiInstance = new TrackingPlansApi(defaultClient); + CreateTrackingPlanV1Input createTrackingPlanV1Input = new CreateTrackingPlanV1Input(); // CreateTrackingPlanV1Input | + try { + CreateTrackingPlan200Response result = apiInstance.createTrackingPlan(createTrackingPlanV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TrackingPlansApi#createTrackingPlan"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createTrackingPlanV1Input** | [**CreateTrackingPlanV1Input**](CreateTrackingPlanV1Input.md)| | | + +### Return type + +[**CreateTrackingPlan200Response**](CreateTrackingPlan200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteTrackingPlan + +> DeleteTrackingPlan200Response deleteTrackingPlan(trackingPlanId) + +Delete Tracking Plan + +Deletes a Tracking Plan. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TrackingPlansApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TrackingPlansApi apiInstance = new TrackingPlansApi(defaultClient); + String trackingPlanId = "tp_sprout_rVGCC6WdrNxjCf6JpCHP"; // String | + try { + DeleteTrackingPlan200Response result = apiInstance.deleteTrackingPlan(trackingPlanId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TrackingPlansApi#deleteTrackingPlan"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **trackingPlanId** | **String**| | | + +### Return type + +[**DeleteTrackingPlan200Response**](DeleteTrackingPlan200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getTrackingPlan + +> GetTrackingPlan200Response getTrackingPlan(trackingPlanId) + +Get Tracking Plan + +Returns a Tracking Plan. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TrackingPlansApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TrackingPlansApi apiInstance = new TrackingPlansApi(defaultClient); + String trackingPlanId = "tp_sprout_rVGCC6WdrNxjCf6JpCHP"; // String | + try { + GetTrackingPlan200Response result = apiInstance.getTrackingPlan(trackingPlanId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TrackingPlansApi#getTrackingPlan"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **trackingPlanId** | **String**| | | + +### Return type + +[**GetTrackingPlan200Response**](GetTrackingPlan200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listRulesFromTrackingPlan + +> ListRulesFromTrackingPlan200Response listRulesFromTrackingPlan(trackingPlanId, pagination) + +List Rules from Tracking Plan + +Lists Tracking Plan rules. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 200 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TrackingPlansApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TrackingPlansApi apiInstance = new TrackingPlansApi(defaultClient); + String trackingPlanId = "tp_sprout_rVGCC6WdrNxjCf6JpCHP"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination options. This parameter exists in v1. + try { + ListRulesFromTrackingPlan200Response result = apiInstance.listRulesFromTrackingPlan(trackingPlanId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TrackingPlansApi#listRulesFromTrackingPlan"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **trackingPlanId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Pagination options. This parameter exists in v1. | [optional] | + +### Return type + +[**ListRulesFromTrackingPlan200Response**](ListRulesFromTrackingPlan200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listSourcesFromTrackingPlan + +> ListSourcesFromTrackingPlan200Response listSourcesFromTrackingPlan(trackingPlanId, pagination) + +List Sources from Tracking Plan + +Lists Sources connected to a Tracking Plan. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. This endpoint requires the user to have at least the following permission(s): * Source Read-only * Tracking Plan Read-only + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TrackingPlansApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TrackingPlansApi apiInstance = new TrackingPlansApi(defaultClient); + String trackingPlanId = "tp_sprout_rVGCC6WdrNxjCf6JpCHP"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination options. This parameter exists in v1. + try { + ListSourcesFromTrackingPlan200Response result = apiInstance.listSourcesFromTrackingPlan(trackingPlanId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TrackingPlansApi#listSourcesFromTrackingPlan"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **trackingPlanId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Pagination options. This parameter exists in v1. | [optional] | + +### Return type + +[**ListSourcesFromTrackingPlan200Response**](ListSourcesFromTrackingPlan200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listTrackingPlans + +> ListTrackingPlans200Response listTrackingPlans(type, pagination) + +List Tracking Plans + +Returns a list of Tracking Plans. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TrackingPlansApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TrackingPlansApi apiInstance = new TrackingPlansApi(defaultClient); + String type = "ENGAGE"; // String | Requests Tracking Plans of a certain type. If omitted, lists all types. This parameter exists in v1. + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination options. This parameter exists in v1. + try { + ListTrackingPlans200Response result = apiInstance.listTrackingPlans(type, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TrackingPlansApi#listTrackingPlans"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **type** | **String**| Requests Tracking Plans of a certain type. If omitted, lists all types. This parameter exists in v1. | [optional] [enum: ENGAGE, LIVE, PROPERTY_LIBRARY, RULE_LIBRARY, TEMPLATE] | +| **pagination** | [**PaginationInput**](.md)| Pagination options. This parameter exists in v1. | [optional] | + +### Return type + +[**ListTrackingPlans200Response**](ListTrackingPlans200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: removeRulesFromTrackingPlan + +> RemoveRulesFromTrackingPlan200Response removeRulesFromTrackingPlan(trackingPlanId, rules) + +Remove Rules from Tracking Plan + +Deletes Tracking Plan rules. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TrackingPlansApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TrackingPlansApi apiInstance = new TrackingPlansApi(defaultClient); + String trackingPlanId = "tp_sprout_rVGCC6WdrNxjCf6JpCHP"; // String | + List rules = Arrays.asList(); // List | Rules to delete. This parameter exists in v1. + try { + RemoveRulesFromTrackingPlan200Response result = apiInstance.removeRulesFromTrackingPlan(trackingPlanId, rules); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TrackingPlansApi#removeRulesFromTrackingPlan"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **trackingPlanId** | **String**| | | +| **rules** | [**List<RemoveRuleV1>**](RemoveRuleV1.md)| Rules to delete. This parameter exists in v1. | | + +### Return type + +[**RemoveRulesFromTrackingPlan200Response**](RemoveRulesFromTrackingPlan200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: removeSourceFromTrackingPlan + +> RemoveSourceFromTrackingPlan200Response removeSourceFromTrackingPlan(trackingPlanId, sourceId) + +Remove Source from Tracking Plan + +Disconnects a Source from a Tracking Plan. • When called, this endpoint may generate the `Source Modified` event in the [audit trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TrackingPlansApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TrackingPlansApi apiInstance = new TrackingPlansApi(defaultClient); + String trackingPlanId = "tp_sprout_rVGCC6WdrNxjCf6JpCHP"; // String | + String sourceId = "qQEHquLrjRDN9j1ByrChyn"; // String | The id of the Source associated with the Tracking Plan. Config API note: analogous to `sourceName`. This parameter exists in v1. + try { + RemoveSourceFromTrackingPlan200Response result = apiInstance.removeSourceFromTrackingPlan(trackingPlanId, sourceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TrackingPlansApi#removeSourceFromTrackingPlan"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **trackingPlanId** | **String**| | | +| **sourceId** | **String**| The id of the Source associated with the Tracking Plan. Config API note: analogous to `sourceName`. This parameter exists in v1. | | + +### Return type + +[**RemoveSourceFromTrackingPlan200Response**](RemoveSourceFromTrackingPlan200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: replaceRulesInTrackingPlan + +> ReplaceRulesInTrackingPlan200Response replaceRulesInTrackingPlan(trackingPlanId, replaceRulesInTrackingPlanV1Input) + +Replace Rules in Tracking Plan + +Replaces Tracking Plan rules. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TrackingPlansApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TrackingPlansApi apiInstance = new TrackingPlansApi(defaultClient); + String trackingPlanId = "tp_sprout_rVGCC6WdrNxjCf6JpCHP"; // String | + ReplaceRulesInTrackingPlanV1Input replaceRulesInTrackingPlanV1Input = new ReplaceRulesInTrackingPlanV1Input(); // ReplaceRulesInTrackingPlanV1Input | + try { + ReplaceRulesInTrackingPlan200Response result = apiInstance.replaceRulesInTrackingPlan(trackingPlanId, replaceRulesInTrackingPlanV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TrackingPlansApi#replaceRulesInTrackingPlan"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **trackingPlanId** | **String**| | | +| **replaceRulesInTrackingPlanV1Input** | [**ReplaceRulesInTrackingPlanV1Input**](ReplaceRulesInTrackingPlanV1Input.md)| | | + +### Return type + +[**ReplaceRulesInTrackingPlan200Response**](ReplaceRulesInTrackingPlan200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateRulesInTrackingPlan + +> UpdateRulesInTrackingPlan200Response updateRulesInTrackingPlan(trackingPlanId, updateRulesInTrackingPlanV1Input) + +Update Rules in Tracking Plan + +Updates Tracking Plan rules. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TrackingPlansApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TrackingPlansApi apiInstance = new TrackingPlansApi(defaultClient); + String trackingPlanId = "tp_sprout_rVGCC6WdrNxjCf6JpCHP"; // String | + UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input = new UpdateRulesInTrackingPlanV1Input(); // UpdateRulesInTrackingPlanV1Input | + try { + UpdateRulesInTrackingPlan200Response result = apiInstance.updateRulesInTrackingPlan(trackingPlanId, updateRulesInTrackingPlanV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TrackingPlansApi#updateRulesInTrackingPlan"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **trackingPlanId** | **String**| | | +| **updateRulesInTrackingPlanV1Input** | [**UpdateRulesInTrackingPlanV1Input**](UpdateRulesInTrackingPlanV1Input.md)| | | + +### Return type + +[**UpdateRulesInTrackingPlan200Response**](UpdateRulesInTrackingPlan200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateTrackingPlan + +> UpdateTrackingPlan200Response updateTrackingPlan(trackingPlanId, updateTrackingPlanV1Input) + +Update Tracking Plan + +Updates a Tracking Plan. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. Config API omitted fields: - `updateMask` + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TrackingPlansApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TrackingPlansApi apiInstance = new TrackingPlansApi(defaultClient); + String trackingPlanId = "tp_sprout_rVGCC6WdrNxjCf6JpCHP"; // String | + UpdateTrackingPlanV1Input updateTrackingPlanV1Input = new UpdateTrackingPlanV1Input(); // UpdateTrackingPlanV1Input | + try { + UpdateTrackingPlan200Response result = apiInstance.updateTrackingPlan(trackingPlanId, updateTrackingPlanV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TrackingPlansApi#updateTrackingPlan"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **trackingPlanId** | **String**| | | +| **updateTrackingPlanV1Input** | [**UpdateTrackingPlanV1Input**](UpdateTrackingPlanV1Input.md)| | | + +### Return type + +[**UpdateTrackingPlan200Response**](UpdateTrackingPlan200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/TransformationsApi.md b/docs/TransformationsApi.md new file mode 100644 index 00000000..e838a5a2 --- /dev/null +++ b/docs/TransformationsApi.md @@ -0,0 +1,380 @@ +# TransformationsApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createTransformation**](TransformationsApi.md#createTransformation) | **POST** /transformations | Create Transformation | +| [**deleteTransformation**](TransformationsApi.md#deleteTransformation) | **DELETE** /transformations/{transformationId} | Delete Transformation | +| [**getTransformation**](TransformationsApi.md#getTransformation) | **GET** /transformations/{transformationId} | Get Transformation | +| [**listTransformations**](TransformationsApi.md#listTransformations) | **GET** /transformations | List Transformations | +| [**updateTransformation**](TransformationsApi.md#updateTransformation) | **PATCH** /transformations/{transformationId} | Update Transformation | + + + +## Operation: createTransformation + +> CreateTransformation200Response createTransformation(createTransformationV1Input) + +Create Transformation + +Creates a new Transformation. • When called, this endpoint may generate the `Transformation Created` event in the [audit trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TransformationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TransformationsApi apiInstance = new TransformationsApi(defaultClient); + CreateTransformationV1Input createTransformationV1Input = new CreateTransformationV1Input(); // CreateTransformationV1Input | + try { + CreateTransformation200Response result = apiInstance.createTransformation(createTransformationV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TransformationsApi#createTransformation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createTransformationV1Input** | [**CreateTransformationV1Input**](CreateTransformationV1Input.md)| | | + +### Return type + +[**CreateTransformation200Response**](CreateTransformation200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteTransformation + +> DeleteTransformation200Response deleteTransformation(transformationId) + +Delete Transformation + +Deletes a Transformation. • When called, this endpoint may generate the `Transformation Deleted` event in the [audit trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TransformationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TransformationsApi apiInstance = new TransformationsApi(defaultClient); + String transformationId = "2c0vVuRdDmJ3UQkVjd5WxaA3dar"; // String | + try { + DeleteTransformation200Response result = apiInstance.deleteTransformation(transformationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TransformationsApi#deleteTransformation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **transformationId** | **String**| | | + +### Return type + +[**DeleteTransformation200Response**](DeleteTransformation200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getTransformation + +> GetTransformation200Response getTransformation(transformationId) + +Get Transformation + +Gets a Transformation. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TransformationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TransformationsApi apiInstance = new TransformationsApi(defaultClient); + String transformationId = "pHrD51Ds35Zjfka84yXQE6"; // String | + try { + GetTransformation200Response result = apiInstance.getTransformation(transformationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TransformationsApi#getTransformation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **transformationId** | **String**| | | + +### Return type + +[**GetTransformation200Response**](GetTransformation200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listTransformations + +> ListTransformations200Response listTransformations(pagination) + +List Transformations + +Lists all Transformations in the Workspace. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TransformationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TransformationsApi apiInstance = new TransformationsApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Pagination options. This parameter exists in v1. + try { + ListTransformations200Response result = apiInstance.listTransformations(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TransformationsApi#listTransformations"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Pagination options. This parameter exists in v1. | [optional] | + +### Return type + +[**ListTransformations200Response**](ListTransformations200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateTransformation + +> UpdateTransformation200Response updateTransformation(transformationId, updateTransformationV1Input) + +Update Transformation + +Updates an existing Transformation. • When called, this endpoint may generate the `Transformation Updated` event in the [audit trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.TransformationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + TransformationsApi apiInstance = new TransformationsApi(defaultClient); + String transformationId = "pHrD51Ds35Zjfka84yXQE6"; // String | + UpdateTransformationV1Input updateTransformationV1Input = new UpdateTransformationV1Input(); // UpdateTransformationV1Input | + try { + UpdateTransformation200Response result = apiInstance.updateTransformation(transformationId, updateTransformationV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TransformationsApi#updateTransformation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **transformationId** | **String**| | | +| **updateTransformationV1Input** | [**UpdateTransformationV1Input**](UpdateTransformationV1Input.md)| | | + +### Return type + +[**UpdateTransformation200Response**](UpdateTransformation200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/WarehousesApi.md b/docs/WarehousesApi.md new file mode 100644 index 00000000..6073fc0e --- /dev/null +++ b/docs/WarehousesApi.md @@ -0,0 +1,756 @@ +# WarehousesApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addConnectionFromSourceToWarehouse**](WarehousesApi.md#addConnectionFromSourceToWarehouse) | **POST** /warehouses/{warehouseId}/connected-sources/{sourceId} | Add Connection from Source to Warehouse | +| [**createValidationInWarehouse**](WarehousesApi.md#createValidationInWarehouse) | **POST** /warehouses/validation | Create Validation in Warehouse | +| [**createWarehouse**](WarehousesApi.md#createWarehouse) | **POST** /warehouses | Create Warehouse | +| [**deleteWarehouse**](WarehousesApi.md#deleteWarehouse) | **DELETE** /warehouses/{warehouseId} | Delete Warehouse | +| [**getConnectionStateFromWarehouse**](WarehousesApi.md#getConnectionStateFromWarehouse) | **GET** /warehouses/{warehouseId}/connection-state | Get Connection State from Warehouse | +| [**getWarehouse**](WarehousesApi.md#getWarehouse) | **GET** /warehouses/{warehouseId} | Get Warehouse | +| [**listConnectedSourcesFromWarehouse**](WarehousesApi.md#listConnectedSourcesFromWarehouse) | **GET** /warehouses/{warehouseId}/connected-sources | List Connected Sources from Warehouse | +| [**listWarehouses**](WarehousesApi.md#listWarehouses) | **GET** /warehouses | List Warehouses | +| [**removeSourceConnectionFromWarehouse**](WarehousesApi.md#removeSourceConnectionFromWarehouse) | **DELETE** /warehouses/{warehouseId}/connected-sources/{sourceId} | Remove Source Connection from Warehouse | +| [**updateWarehouse**](WarehousesApi.md#updateWarehouse) | **PATCH** /warehouses/{warehouseId} | Update Warehouse | + + + +## Operation: addConnectionFromSourceToWarehouse + +> AddConnectionFromSourceToWarehouse201Response addConnectionFromSourceToWarehouse(warehouseId, sourceId) + +Add Connection from Source to Warehouse + +Connects a Source to a Warehouse. • When called, this endpoint may generate the `Storage Destination Modified` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.WarehousesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + WarehousesApi apiInstance = new WarehousesApi(defaultClient); + String warehouseId = "kjU72LCJexvrqL7G4TMHHN"; // String | + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | + try { + AddConnectionFromSourceToWarehouse201Response result = apiInstance.addConnectionFromSourceToWarehouse(warehouseId, sourceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WarehousesApi#addConnectionFromSourceToWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | +| **sourceId** | **String**| | | + +### Return type + +[**AddConnectionFromSourceToWarehouse201Response**](AddConnectionFromSourceToWarehouse201Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createValidationInWarehouse + +> CreateValidationInWarehouse200Response createValidationInWarehouse(createValidationInWarehouseV1Input) + +Create Validation in Warehouse + +Validates input settings against a Warehouse. • When called, this endpoint may generate the `Storage Destination Settings Validation` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.WarehousesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + WarehousesApi apiInstance = new WarehousesApi(defaultClient); + CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input = new CreateValidationInWarehouseV1Input(); // CreateValidationInWarehouseV1Input | + try { + CreateValidationInWarehouse200Response result = apiInstance.createValidationInWarehouse(createValidationInWarehouseV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WarehousesApi#createValidationInWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createValidationInWarehouseV1Input** | [**CreateValidationInWarehouseV1Input**](CreateValidationInWarehouseV1Input.md)| | | + +### Return type + +[**CreateValidationInWarehouse200Response**](CreateValidationInWarehouse200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: createWarehouse + +> CreateWarehouse201Response createWarehouse(createWarehouseV1Input) + +Create Warehouse + +Creates a new Warehouse. • When called, this endpoint may generate the `Storage Destination Created` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.WarehousesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + WarehousesApi apiInstance = new WarehousesApi(defaultClient); + CreateWarehouseV1Input createWarehouseV1Input = new CreateWarehouseV1Input(); // CreateWarehouseV1Input | + try { + CreateWarehouse201Response result = apiInstance.createWarehouse(createWarehouseV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WarehousesApi#createWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **createWarehouseV1Input** | [**CreateWarehouseV1Input**](CreateWarehouseV1Input.md)| | | + +### Return type + +[**CreateWarehouse201Response**](CreateWarehouse201Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: deleteWarehouse + +> DeleteWarehouse200Response deleteWarehouse(warehouseId) + +Delete Warehouse + +Deletes an existing Warehouse. • When called, this endpoint may generate the `Storage Destination Deleted` event in the [audit trail](/tag/Audit-Trail). + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.WarehousesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + WarehousesApi apiInstance = new WarehousesApi(defaultClient); + String warehouseId = "tmiTtiPi58udvDAjcxKUJY"; // String | + try { + DeleteWarehouse200Response result = apiInstance.deleteWarehouse(warehouseId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WarehousesApi#deleteWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | + +### Return type + +[**DeleteWarehouse200Response**](DeleteWarehouse200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getConnectionStateFromWarehouse + +> GetConnectionStateFromWarehouse200Response getConnectionStateFromWarehouse(warehouseId) + +Get Connection State from Warehouse + +Verifies the state of Warehouse connection settings. The rate limit for this endpoint is 200 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.WarehousesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + WarehousesApi apiInstance = new WarehousesApi(defaultClient); + String warehouseId = "kjU72LCJexvrqL7G4TMHHN"; // String | + try { + GetConnectionStateFromWarehouse200Response result = apiInstance.getConnectionStateFromWarehouse(warehouseId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WarehousesApi#getConnectionStateFromWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | + +### Return type + +[**GetConnectionStateFromWarehouse200Response**](GetConnectionStateFromWarehouse200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: getWarehouse + +> GetWarehouse200Response getWarehouse(warehouseId) + +Get Warehouse + +Returns a Warehouse by its id. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.WarehousesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + WarehousesApi apiInstance = new WarehousesApi(defaultClient); + String warehouseId = "kjU72LCJexvrqL7G4TMHHN"; // String | + try { + GetWarehouse200Response result = apiInstance.getWarehouse(warehouseId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WarehousesApi#getWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | + +### Return type + +[**GetWarehouse200Response**](GetWarehouse200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listConnectedSourcesFromWarehouse + +> ListConnectedSourcesFromWarehouse200Response listConnectedSourcesFromWarehouse(warehouseId, pagination) + +List Connected Sources from Warehouse + +Returns the list of Sources that are connected to a Warehouse. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.WarehousesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + WarehousesApi apiInstance = new WarehousesApi(defaultClient); + String warehouseId = "kjU72LCJexvrqL7G4TMHHN"; // String | + PaginationInput pagination = new PaginationInput(); // PaginationInput | Defines the pagination parameters. This parameter exists in v1. + try { + ListConnectedSourcesFromWarehouse200Response result = apiInstance.listConnectedSourcesFromWarehouse(warehouseId, pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WarehousesApi#listConnectedSourcesFromWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | +| **pagination** | [**PaginationInput**](.md)| Defines the pagination parameters. This parameter exists in v1. | [optional] | + +### Return type + +[**ListConnectedSourcesFromWarehouse200Response**](ListConnectedSourcesFromWarehouse200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: listWarehouses + +> ListWarehouses200Response listWarehouses(pagination) + +List Warehouses + +Returns a list of Warehouses. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.WarehousesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + WarehousesApi apiInstance = new WarehousesApi(defaultClient); + PaginationInput pagination = new PaginationInput(); // PaginationInput | Defines the pagination parameters. This parameter exists in v1. + try { + ListWarehouses200Response result = apiInstance.listWarehouses(pagination); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WarehousesApi#listWarehouses"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pagination** | [**PaginationInput**](.md)| Defines the pagination parameters. This parameter exists in v1. | [optional] | + +### Return type + +[**ListWarehouses200Response**](ListWarehouses200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: removeSourceConnectionFromWarehouse + +> RemoveSourceConnectionFromWarehouse200Response removeSourceConnectionFromWarehouse(warehouseId, sourceId) + +Remove Source Connection from Warehouse + +Disconnects a Source from a Warehouse. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.WarehousesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + WarehousesApi apiInstance = new WarehousesApi(defaultClient); + String warehouseId = "kjU72LCJexvrqL7G4TMHHN"; // String | + String sourceId = "rh5BDZp6QDHvXFCkibm1pR"; // String | + try { + RemoveSourceConnectionFromWarehouse200Response result = apiInstance.removeSourceConnectionFromWarehouse(warehouseId, sourceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WarehousesApi#removeSourceConnectionFromWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | +| **sourceId** | **String**| | | + +### Return type + +[**RemoveSourceConnectionFromWarehouse200Response**](RemoveSourceConnectionFromWarehouse200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + + +## Operation: updateWarehouse + +> UpdateWarehouse200Response updateWarehouse(warehouseId, updateWarehouseV1Input) + +Update Warehouse + +Updates an existing Warehouse. • When called, this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Storage Destination Modified * Storage Destination Enabled + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.WarehousesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + WarehousesApi apiInstance = new WarehousesApi(defaultClient); + String warehouseId = "kjU72LCJexvrqL7G4TMHHN"; // String | + UpdateWarehouseV1Input updateWarehouseV1Input = new UpdateWarehouseV1Input(); // UpdateWarehouseV1Input | + try { + UpdateWarehouse200Response result = apiInstance.updateWarehouse(warehouseId, updateWarehouseV1Input); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WarehousesApi#updateWarehouse"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **warehouseId** | **String**| | | +| **updateWarehouseV1Input** | [**UpdateWarehouseV1Input**](UpdateWarehouseV1Input.md)| | | + +### Return type + +[**UpdateWarehouse200Response**](UpdateWarehouse200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: application/json, application/vnd.segment.v1+json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/docs/WorkspacesApi.md b/docs/WorkspacesApi.md new file mode 100644 index 00000000..436cb2a5 --- /dev/null +++ b/docs/WorkspacesApi.md @@ -0,0 +1,78 @@ +# WorkspacesApi + +All URIs are relative to *https://api.segmentapis.com* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getWorkspace**](WorkspacesApi.md#getWorkspace) | **GET** / | Get Workspace | + + + +## Operation: getWorkspace + +> GetWorkspace200Response getWorkspace() + +Get Workspace + +Returns the Workspace associated with the token used to access this resource. + +### Example + +```java +// Import classes: +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.auth.*; +import com.segment.publicapi.models.*; +import com.segment.publicapi.api.WorkspacesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP bearer authorization: token + HttpBearerAuth token = (HttpBearerAuth) defaultClient.getAuthentication("token"); + token.setBearerToken("BEARER TOKEN"); + + WorkspacesApi apiInstance = new WorkspacesApi(defaultClient); + try { + GetWorkspace200Response result = apiInstance.getWorkspace(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WorkspacesApi#getWorkspace"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**GetWorkspace200Response**](GetWorkspace200Response.md) + +### Authorization + +[token](../README.md#token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.segment.v1+json, application/json, application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **404** | Resource not found | - | +| **422** | Validation failure | - | +| **429** | Too many requests | - | + diff --git a/pom.xml b/pom.xml index bb5da8f2..38d3eff8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,36 +1,43 @@ 4.0.0 - com.segment + com.segment.publicapi segment-publicapi jar segment-publicapi - 32.0.2 + 58.13.0 https://segment.com/docs/api/public-api/ Segment Public API - scm:git:git@github.com:openapitools/openapi-generator.git - scm:git:git@github.com:openapitools/openapi-generator.git - https://github.com/openapitools/openapi-generator + scm:git:git@github.com:segmentio/public-api-sdk-java.git + scm:git:ssh@github.com:segmentio/public-api-sdk-java.git + https://github.com/segmentio/public-api-sdk-java - - Unlicense - http://unlicense.org + MIT License + http://www.opensource.org/licenses/mit-license.php repo - + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + Segment - team@openapitools.org + friends@segment.com Segment https://segment.com/ - @@ -50,7 +57,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0 + 3.1.0 enforce-maven @@ -93,6 +100,7 @@ maven-dependency-plugin + 3.3.0 package @@ -109,7 +117,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.0 + 3.3.0 @@ -123,7 +131,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.2.0 + 3.3.0 add_sources @@ -154,7 +162,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.2 + 3.4.1 attach-javadocs @@ -177,7 +185,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.0 + 3.2.1 attach-sources @@ -218,7 +226,7 @@ - 1.8 + 1.18.0 true @@ -229,33 +237,40 @@ + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + true + + ossrh + https://oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + - - - sign-artifacts - - - - org.apache.maven.plugins - maven-gpg-plugin - 3.0.1 - - - sign-artifacts - verify - - sign - - - - - - - - - io.swagger @@ -340,17 +355,17 @@ ${java.version} 1.8.5 1.6.5 - 4.9.3 - 2.9.0 + 4.10.0 + 2.9.1 3.12.0 - 0.2.3 + 0.2.4 1.3.5 - 5.8.2 - 1.6.2 + 5.9.1 + 1.9.1 3.12.4 2.1.1 1.1.1 UTF-8 - 2.21.0 + 2.40.0 diff --git a/src/main/java/com/segment/publicapi/ApiCallback.java b/src/main/java/com/segment/publicapi/ApiCallback.java index ef2036bd..cb1f988c 100644 --- a/src/main/java/com/segment/publicapi/ApiCallback.java +++ b/src/main/java/com/segment/publicapi/ApiCallback.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,13 +9,10 @@ * Do not edit the class manually. */ - package com.segment.publicapi; -import java.io.IOException; - -import java.util.Map; import java.util.List; +import java.util.Map; /** * Callback for asynchronous API call. diff --git a/src/main/java/com/segment/publicapi/ApiClient.java b/src/main/java/com/segment/publicapi/ApiClient.java index 928329b5..f89365d8 100644 --- a/src/main/java/com/segment/publicapi/ApiClient.java +++ b/src/main/java/com/segment/publicapi/ApiClient.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,21 +9,13 @@ * Do not edit the class manually. */ - package com.segment.publicapi; +import com.segment.publicapi.auth.ApiKeyAuth; +import com.segment.publicapi.auth.Authentication; +import com.segment.publicapi.auth.HttpBasicAuth; +import com.segment.publicapi.auth.HttpBearerAuth; import com.segment.publicapi.models.PaginationInput; - -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; @@ -41,7 +32,6 @@ 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; @@ -51,15 +41,17 @@ import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.net.ssl.*; +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 com.segment.publicapi.auth.Authentication; -import com.segment.publicapi.auth.HttpBasicAuth; -import com.segment.publicapi.auth.HttpBearerAuth; -import com.segment.publicapi.auth.ApiKeyAuth; - -/** - *

ApiClient class.

- */ +/** ApiClient class. */ public class ApiClient { private String basePath = "https://api.segmentapis.com"; @@ -84,9 +76,7 @@ public class ApiClient { private HttpLoggingInterceptor loggingInterceptor; - /** - * Basic constructor for ApiClient - */ + /** Basic constructor for ApiClient */ public ApiClient() { init(); initHttpClient(); @@ -120,7 +110,7 @@ private void initHttpClient() { private void initHttpClient(List interceptors) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.addNetworkInterceptor(getProgressInterceptor()); - for (Interceptor interceptor: interceptors) { + for (Interceptor interceptor : interceptors) { builder.addInterceptor(interceptor); } @@ -133,7 +123,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/32.0.2/java"); + setUserAgent("Public API SDK 58.13.0 (Java)"); authentications = new HashMap(); } @@ -209,9 +199,9 @@ public boolean isVerifyingSsl() { } /** - * 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. + * 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 @@ -232,8 +222,8 @@ public InputStream getSslCaCert() { } /** - * Configure the CA certificate to be trusted when making https requests. - * Use null to reset to default. + * 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 @@ -245,7 +235,7 @@ public ApiClient setSslCaCert(InputStream sslCaCert) { } /** - *

Getter for the field keyManagers.

+ * Getter for the field keyManagers. * * @return an array of {@link javax.net.ssl.KeyManager} objects */ @@ -254,8 +244,8 @@ public KeyManager[] getKeyManagers() { } /** - * Configure client keys to use for authorization in an SSL session. - * Use null to reset to default. + * 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 @@ -267,7 +257,7 @@ public ApiClient setKeyManagers(KeyManager[] managers) { } /** - *

Getter for the field dateFormat.

+ * Getter for the field dateFormat. * * @return a {@link java.text.DateFormat} object */ @@ -276,7 +266,7 @@ public DateFormat getDateFormat() { } /** - *

Setter for the field dateFormat.

+ * Setter for the field dateFormat. * * @param dateFormat a {@link java.text.DateFormat} object * @return a {@link com.segment.publicapi.ApiClient} object @@ -287,7 +277,7 @@ public ApiClient setDateFormat(DateFormat dateFormat) { } /** - *

Set SqlDateFormat.

+ * Set SqlDateFormat. * * @param dateFormat a {@link java.text.DateFormat} object * @return a {@link com.segment.publicapi.ApiClient} object @@ -298,7 +288,7 @@ public ApiClient setSqlDateFormat(DateFormat dateFormat) { } /** - *

Set OffsetDateTimeFormat.

+ * Set OffsetDateTimeFormat. * * @param dateFormat a {@link java.time.format.DateTimeFormatter} object * @return a {@link com.segment.publicapi.ApiClient} object @@ -309,7 +299,7 @@ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { } /** - *

Set LocalDateFormat.

+ * Set LocalDateFormat. * * @param dateFormat a {@link java.time.format.DateTimeFormatter} object * @return a {@link com.segment.publicapi.ApiClient} object @@ -320,7 +310,7 @@ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { } /** - *

Set LenientOnJson.

+ * Set LenientOnJson. * * @param lenientOnJson a boolean * @return a {@link com.segment.publicapi.ApiClient} object @@ -349,10 +339,11 @@ public Authentication getAuthentication(String authName) { return authentications.get(authName); } - /** - * Helper method to set access token for the first Bearer authentication. - * @param bearerToken Bearer token - */ + /** + * 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) { @@ -500,11 +491,12 @@ public ApiClient setDebugging(boolean debugging) { } /** - * 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. + * 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 + * @see createTempFile * @return Temporary folder path */ public String getTempFolderPath() { @@ -532,15 +524,18 @@ public int getConnectTimeout() { } /** - * 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}. + * 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(); + httpClient = + httpClient + .newBuilder() + .connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS) + .build(); return this; } @@ -554,15 +549,15 @@ public int getReadTimeout() { } /** - * 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}. + * 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(); + httpClient = + httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); return this; } @@ -576,19 +571,18 @@ public int getWriteTimeout() { } /** - * 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}. + * 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(); + httpClient = + httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); return this; } - /** * Format the given parameter object into string. * @@ -598,8 +592,10 @@ public ApiClient setWriteTimeout(int writeTimeout) { 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 + } 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) { @@ -619,7 +615,7 @@ public String parameterToString(Object param) { /** * Formats the specified query parameter to a list containing a single {@code Pair} object. * - * Note that {@code value} must not be a collection. + *

Note that {@code value} must not be a collection. * * @param name The name of the parameter. * @param value The value of the parameter. @@ -653,7 +649,7 @@ public List parameterToPair(String name, Object value) { /** * 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. + *

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. @@ -689,13 +685,20 @@ public List parameterToPairs(String collectionFormat, String name, Collect delimiter = escapeString("|"); } + boolean quotesNeeded = + !value.isEmpty() && value.iterator().next().getClass().equals(String.class); + StringBuilder sb = new StringBuilder(); for (Object item : value) { sb.append(delimiter); - sb.append(escapeString(parameterToString(item))); + if (quotesNeeded) { + sb.append(escapeString("\"" + parameterToString(item) + "\"")); + } else { + sb.append(escapeString(parameterToString(item))); + } } - params.add(new Pair(name, sb.substring(delimiter.length()))); + params.add(new Pair(name, "[".concat(sb.substring(delimiter.length())).concat("]"))); return params; } @@ -725,7 +728,7 @@ public String collectionPathParameterToString(String collectionFormat, Collectio delimiter = "|"; } - StringBuilder sb = new StringBuilder() ; + StringBuilder sb = new StringBuilder(); for (Object item : value) { sb.append(delimiter); sb.append(parameterToString(item)); @@ -735,8 +738,7 @@ public String collectionPathParameterToString(String collectionFormat, Collectio } /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif + * Sanitize filename by removing path. e.g. ../../sun.gif becomes sun.gif * * @param filename The filename to be sanitized * @return The sanitized filename @@ -746,13 +748,10 @@ public String sanitizeFilename(String filename) { } /** - * 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 + * 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. */ @@ -762,13 +761,12 @@ public boolean isJsonMime(String mime) { } /** - * 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) + * 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). + * @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) { @@ -783,13 +781,12 @@ public String selectHeaderAccept(String[] 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. + * 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. + * @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) { @@ -824,15 +821,15 @@ public String escapeString(String str) { } /** - * Deserialize response body to Java object, according to the return type and - * the Content-Type response header. + * 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 com.segment.publicapi.ApiException If fail to deserialize response body, i.e. cannot read response body - * or the Content-Type of the response is not supported. + * @throws com.segment.publicapi.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 { @@ -854,10 +851,8 @@ public T deserialize(Response response, Type returnType) throws ApiException String respBody; try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; + if (response.body() != null) respBody = response.body().string(); + else respBody = null; } catch (IOException e) { throw new ApiException(e); } @@ -886,8 +881,8 @@ public T deserialize(Response response, Type returnType) throws ApiException } /** - * Serialize the given Java object into request body according to the object's - * class and the request Content-Type. + * 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 @@ -922,7 +917,8 @@ public RequestBody serialize(Object obj, String contentType) throws ApiException * Download file from the given response. * * @param response An instance of the Response object - * @throws com.segment.publicapi.ApiException If fail to read file content from response and write to disk + * @throws com.segment.publicapi.ApiException If fail to read file content from response and + * write to disk * @return Downloaded file */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -970,14 +966,11 @@ public File prepareDownloadFile(Response response) throws IOException { suffix = filename.substring(pos); } // Files.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; + 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(); + if (tempFolderPath == null) return Files.createTempFile(prefix, suffix).toFile(); + else return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); } /** @@ -998,9 +991,8 @@ public ApiResponse execute(Call call) throws ApiException { * @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. + * @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 com.segment.publicapi.ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { @@ -1035,27 +1027,32 @@ public void executeAsync(Call call, ApiCallback callback) { */ @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); - } + 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()); - } - }); + @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()); + } + }); } /** @@ -1066,7 +1063,7 @@ public void onResponse(Call call, Response response) throws IOException { * @param returnType Return type * @return Type * @throws com.segment.publicapi.ApiException If the response has an unsuccessful status code or - * fail to deserialize the response body + * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { if (response.isSuccessful()) { @@ -1077,7 +1074,11 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept try { response.body().close(); } catch (Exception e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + throw new ApiException( + response.message(), + e, + response.code(), + response.headers().toMultimap()); } } return null; @@ -1090,10 +1091,15 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept try { respBody = response.body().string(); } catch (IOException e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + throw new ApiException( + response.message(), + e, + response.code(), + response.headers().toMultimap()); } } - throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + throw new ApiException( + response.message(), response.code(), response.headers().toMultimap(), respBody); } } @@ -1102,7 +1108,8 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept * * @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 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 @@ -1114,8 +1121,32 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept * @return The HTTP call * @throws com.segment.publicapi.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); + 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); } @@ -1125,7 +1156,8 @@ public Call buildCall(String baseUrl, String path, String method, List que * * @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 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 @@ -1137,7 +1169,19 @@ public Call buildCall(String baseUrl, String path, String method, List que * @return The HTTP request * @throws com.segment.publicapi.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 { + 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); @@ -1160,14 +1204,23 @@ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams) { + public String buildUrl( + String baseUrl, String path, List queryParams, List collectionQueryParams) { final StringBuilder url = new StringBuilder(); if (baseUrl != null) { url.append(baseUrl).append(path); @@ -1218,7 +1272,9 @@ public String buildUrl(String baseUrl, String path, List queryParams, List url.append("&"); } String value = parameterToString(param.getValue()); - url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + url.append(escapeString(param.getName())) + .append("=") + .append(escapeString(value)); } } } @@ -1268,11 +1324,13 @@ public void processHeaderParams(Map headerParams, Request.Builde */ public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { for (Entry param : cookieParams.entrySet()) { - reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + 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())); + reqBuilder.addHeader( + "Cookie", String.format("%s=%s", param.getKey(), param.getValue())); } } } @@ -1289,8 +1347,15 @@ public void processCookieParams(Map cookieParams, Request.Builde * @param uri URI * @throws com.segment.publicapi.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 { + 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) { @@ -1315,8 +1380,8 @@ public RequestBody buildRequestBodyFormEncoding(Map formParams) } /** - * Build a multipart (file uploading) request body with the given form parameters, - * which could contain text fields and file fields. + * 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 @@ -1329,7 +1394,7 @@ public RequestBody buildRequestBodyMultipart(Map formParams) { addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); } else if (param.getValue() instanceof List) { List list = (List) param.getValue(); - for (Object item: list) { + for (Object item : list) { if (item instanceof File) { addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); } else { @@ -1361,24 +1426,29 @@ public String guessContentTypeFromFile(File file) { /** * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. * - * @param mpBuilder 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() + "\""); + 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. + * 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) { + 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")); @@ -1397,8 +1467,8 @@ private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String k } /** - * Get network interceptor to add it to the httpClient to track download progress for - * async requests. + * Get network interceptor to add it to the httpClient to track download progress for async + * requests. */ private Interceptor getProgressInterceptor() { return new Interceptor() { @@ -1408,9 +1478,10 @@ public Response intercept(Interceptor.Chain chain) throws IOException { 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 + .newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); } return originalResponse; } @@ -1418,47 +1489,54 @@ public Response intercept(Interceptor.Chain chain) throws IOException { } /** - * Apply SSL related settings to httpClient according to the current values of - * verifyingSsl and sslCaCert. + * 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 { + 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 java.security.cert.X509Certificate[] getAcceptedIssuers() { - return new java.security.cert.X509Certificate[]{}; + public boolean verify(String hostname, SSLSession session) { + return true; } - } - }; - hostnameVerifier = new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; + }; } else { - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + 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); + Collection certificates = + certificateFactory.generateCertificates(sslCaCert); if (certificates.isEmpty()) { - throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + throw new IllegalArgumentException( + "expected non-empty set of trusted certificates"); } KeyStore caKeyStore = newEmptyKeyStore(password); int index = 0; @@ -1474,8 +1552,12 @@ public boolean verify(String hostname, SSLSession session) { SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient = httpClient.newBuilder() - .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + httpClient = + httpClient + .newBuilder() + .sslSocketFactory( + sslContext.getSocketFactory(), + (X509TrustManager) trustManagers[0]) .hostnameVerifier(hostnameVerifier) .build(); } catch (GeneralSecurityException e) { @@ -1498,7 +1580,8 @@ private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityExcepti * * @param requestBody The HTTP request object * @return The string representation of the HTTP request body - * @throws com.segment.publicapi.ApiException If fail to serialize the request body object into a string + * @throws com.segment.publicapi.ApiException If fail to serialize the request body object into + * a string */ private String requestBodyToString(RequestBody requestBody) throws ApiException { if (requestBody != null) { diff --git a/src/main/java/com/segment/publicapi/ApiException.java b/src/main/java/com/segment/publicapi/ApiException.java index 15b7c7fa..eeacf735 100644 --- a/src/main/java/com/segment/publicapi/ApiException.java +++ b/src/main/java/com/segment/publicapi/ApiException.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,31 +9,23 @@ * Do not edit the class manually. */ - package com.segment.publicapi; -import java.util.Map; import java.util.List; +import java.util.Map; -import javax.ws.rs.core.GenericType; - -/** - *

ApiException class.

- */ +/** ApiException class. */ @SuppressWarnings("serial") - public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; private String responseBody = null; - - /** - *

Constructor for ApiException.

- */ + + /** Constructor for ApiException. */ public ApiException() {} /** - *

Constructor for ApiException.

+ * Constructor for ApiException. * * @param throwable a {@link java.lang.Throwable} object */ @@ -43,7 +34,7 @@ public ApiException(Throwable throwable) { } /** - *

Constructor for ApiException.

+ * Constructor for ApiException. * * @param message the error message */ @@ -52,7 +43,7 @@ public ApiException(String message) { } /** - *

Constructor for ApiException.

+ * Constructor for ApiException. * * @param message the error message * @param throwable a {@link java.lang.Throwable} object @@ -60,7 +51,12 @@ public ApiException(String message) { * @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) { + public ApiException( + String message, + Throwable throwable, + int code, + Map> responseHeaders, + String responseBody) { super(message, throwable); this.code = code; this.responseHeaders = responseHeaders; @@ -68,42 +64,55 @@ public ApiException(String message, Throwable throwable, int code, MapConstructor for ApiException.

+ * 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) { + public ApiException( + String message, + int code, + Map> responseHeaders, + String responseBody) { this(message, (Throwable) null, code, responseHeaders, responseBody); } /** - *

Constructor for ApiException.

+ * 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) { + public ApiException( + String message, + Throwable throwable, + int code, + Map> responseHeaders) { this(message, throwable, code, responseHeaders, null); } /** - *

Constructor for ApiException.

+ * 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((String) null, (Throwable) null, code, responseHeaders, responseBody); + this( + "Response Code: " + code + " Response Body: " + responseBody, + (Throwable) null, + code, + responseHeaders, + responseBody); } /** - *

Constructor for ApiException.

+ * Constructor for ApiException. * * @param code HTTP status code * @param message a {@link java.lang.String} object @@ -114,14 +123,18 @@ public ApiException(int code, String message) { } /** - *

Constructor for ApiException.

+ * 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) { + public ApiException( + int code, + String message, + Map> responseHeaders, + String responseBody) { this(code, message); this.responseHeaders = responseHeaders; this.responseBody = responseBody; @@ -160,7 +173,12 @@ public String getResponseBody() { * @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()); + 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/com/segment/publicapi/ApiResponse.java b/src/main/java/com/segment/publicapi/ApiResponse.java index 34468098..f2da2ac8 100644 --- a/src/main/java/com/segment/publicapi/ApiResponse.java +++ b/src/main/java/com/segment/publicapi/ApiResponse.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,22 +9,19 @@ * Do not edit the class manually. */ - package com.segment.publicapi; import java.util.List; import java.util.Map; -/** - * API response returned by API call. - */ +/** API response returned by API call. */ public class ApiResponse { - final private int statusCode; - final private Map> headers; - final private T data; + private final int statusCode; + private final Map> headers; + private final T data; /** - *

Constructor for ApiResponse.

+ * Constructor for ApiResponse. * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response @@ -35,7 +31,7 @@ public ApiResponse(int statusCode, Map> headers) { } /** - *

Constructor for ApiResponse.

+ * Constructor for ApiResponse. * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response @@ -48,7 +44,7 @@ public ApiResponse(int statusCode, Map> headers, T data) { } /** - *

Get the status code.

+ * Get the status code. * * @return the status code */ @@ -57,16 +53,16 @@ public int getStatusCode() { } /** - *

Get the headers.

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

Get the data.

+ * Get the data. * * @return the data */ diff --git a/src/main/java/com/segment/publicapi/Configuration.java b/src/main/java/com/segment/publicapi/Configuration.java index bfc4e3d5..1b49b628 100644 --- a/src/main/java/com/segment/publicapi/Configuration.java +++ b/src/main/java/com/segment/publicapi/Configuration.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,16 +9,16 @@ * Do not edit the class manually. */ - package com.segment.publicapi; - public class Configuration { + public static final String VERSION = "58.13.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. + * Get the default API client, which would be used when creating API instances without providing + * an API client. * * @return Default API client */ @@ -28,8 +27,8 @@ public static ApiClient getDefaultApiClient() { } /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. + * Set the default API client, which would be used when creating API instances without providing + * an API client. * * @param apiClient API client */ diff --git a/src/main/java/com/segment/publicapi/GzipRequestInterceptor.java b/src/main/java/com/segment/publicapi/GzipRequestInterceptor.java index a411ce50..657dfa59 100644 --- a/src/main/java/com/segment/publicapi/GzipRequestInterceptor.java +++ b/src/main/java/com/segment/publicapi/GzipRequestInterceptor.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,21 +9,19 @@ * Do not edit the class manually. */ - package com.segment.publicapi; +import java.io.IOException; 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 + *

Taken from https://github.com/square/okhttp/issues/350 */ class GzipRequestInterceptor implements Interceptor { @Override @@ -34,10 +31,14 @@ public Response intercept(Chain chain) throws IOException { return chain.proceed(originalRequest); } - Request compressedRequest = originalRequest.newBuilder() - .header("Content-Encoding", "gzip") - .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) - .build(); + Request compressedRequest = + originalRequest + .newBuilder() + .header("Content-Encoding", "gzip") + .method( + originalRequest.method(), + forceContentLength(gzip(originalRequest.body()))) + .build(); return chain.proceed(compressedRequest); } diff --git a/src/main/java/com/segment/publicapi/JSON.java b/src/main/java/com/segment/publicapi/JSON.java index 6471fcc6..4db4fb1c 100644 --- a/src/main/java/com/segment/publicapi/JSON.java +++ b/src/main/java/com/segment/publicapi/JSON.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,22 +9,17 @@ * Do not edit the class manually. */ - package com.segment.publicapi; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; 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; @@ -36,9 +30,8 @@ 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; +import okio.ByteString; /* * A JSON utility class @@ -51,37 +44,42 @@ public class JSON { 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 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() - ; + GsonFireBuilder fireBuilder = new GsonFireBuilder(); GsonBuilder builder = fireBuilder.createGsonBuilder(); return builder; } - private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + private static String getDiscriminatorValue( + JsonElement readElement, String discriminatorField) { JsonElement element = readElement.getAsJsonObject().get(discriminatorField); if (null == element) { - throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + throw new IllegalArgumentException( + "missing discriminator field: <" + discriminatorField + ">"); } return element.getAsString(); } /** - * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. + * 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) { + 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 + ">"); + throw new IllegalArgumentException( + "cannot determine model class of name: <" + discriminatorValue + ">"); } return clazz; } @@ -93,469 +91,1702 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.APICallSnapshotV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AccessPermissionV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddConnectionFromSourceToWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddConnectionFromSourceToWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddLabelsToSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddLabelsToSource200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddLabelsToSourceAlphaInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddLabelsToSourceAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddLabelsToSourceV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddLabelsToSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddPermissionsToUser200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddPermissionsToUserGroup200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddPermissionsToUserGroupV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddPermissionsToUserGroupV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddPermissionsToUserV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddPermissionsToUserV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddSourceToTrackingPlan200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddSourceToTrackingPlanV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddSourceToTrackingPlanV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddUsersToUserGroup200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddUsersToUserGroupV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AddUsersToUserGroupV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AdvancedWarehouseSyncScheduleV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AdvancedWarehouseSyncScheduleV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AllowedLabelBeta.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.AuditEventV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.BatchQueryMessagingSubscriptionsForSpace200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.BatchQueryMessagingSubscriptionsForSpaceAlphaInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.BreakdownBeta.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CommonSourceSettingsV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Contact.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateCloudSourceRegulation200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateCloudSourceRegulationV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateCloudSourceRegulationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateDestinationSubscription200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateDestinationSubscriptionAlphaInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateDestinationSubscriptionAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateDestinationV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateDestinationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateEdgeFunctions200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateEdgeFunctionsAlphaInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateEdgeFunctionsAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateFilterForDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateFilterForDestinationV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateFilterForDestinationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateFunction200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateFunctionDeployment200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateFunctionDeploymentV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateFunctionV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateFunctionV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateInvites200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateInvitesV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateInvitesV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateLabel200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateLabel200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateLabelAlphaInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateLabelAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateLabelV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateLabelV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateSource200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateSourceAlphaInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateSourceAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateSourceRegulation200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateSourceRegulationV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateSourceRegulationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateSourceV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateTrackingPlan200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateTrackingPlanV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateTrackingPlanV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateTransformation200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateTransformationBetaInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateTransformationBetaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateUserGroup200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateUserGroupV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateUserGroupV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateValidationInWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateValidationInWarehouseV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateValidationInWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateWarehouseV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateWorkspaceRegulation200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateWorkspaceRegulationV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.CreateWorkspaceRegulationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteDestinationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteFunction200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteFunctionV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteInvites200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteInvitesV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteLabel200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteLabel200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteLabelAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteLabelV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteRegulation200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteRegulationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteSource200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteSourceAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteTrackingPlan200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteTrackingPlanV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteTransformation200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteTransformationBetaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteUserGroup200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteUserGroupV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteUsers200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteUsersV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeleteWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeliveryMetricsSummary.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DeliveryMetricsSummaryBeta.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Destination.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Destination1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Destination2.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationFilterActionV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationFilterV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationMetadata.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationMetadataActionFieldV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationMetadataActionV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationMetadataComponentV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationMetadataFeaturesV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationMetadataMethodsV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationMetadataPlatformsV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationMetadataSubscriptionPresetV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationMetadataV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationStatusV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationSubscription.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationSubscriptionUpdateInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DestinationV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DisableEdgeFunctions200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.DisableEdgeFunctionsAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Echo200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Echo200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.EchoAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.EchoV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.EdgeFunctions.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.EdgeFunctions1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.EdgeFunctionsAlpha.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.EventSourceV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Filter.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Filter1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Filter2.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Filter3.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Function.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Function1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Function2.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.FunctionDeployment.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.FunctionSettingV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.FunctionV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GenerateUploadURLForEdgeFunctions200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GenerateUploadURLForEdgeFunctionsAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetAdvancedSyncScheduleFromWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetAdvancedSyncScheduleFromWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetConnectionStateFromWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetConnectionStateFromWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDailyPerSourceAPICallsUsage200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDailyPerSourceAPICallsUsageV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDailyPerSourceMTUUsage200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDailyPerSourceMTUUsageV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDailyWorkspaceAPICallsUsage200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDailyWorkspaceAPICallsUsageV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDailyWorkspaceMTUUsage200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDailyWorkspaceMTUUsageV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDestinationMetadata200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDestinationMetadataV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDestinationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDestinationsCatalog200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetDestinationsCatalogV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetEventsVolumeFromWorkspace200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetEventsVolumeFromWorkspaceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetFilterInDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetFilterInDestinationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetFunction200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetFunctionV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetLatestFromEdgeFunctions200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetLatestFromEdgeFunctionsAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetMessagingSubscriptionFailureResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetMessagingSubscriptionSuccessResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetRegulation200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetRegulationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSource200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSourceAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSourceMetadata200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSourceMetadataV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSourcesCatalog200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSourcesCatalogV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSpace200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSpaceAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSubscriptionFromDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSubscriptionFromDestinationAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetSubscriptionRequest.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetTrackingPlan200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetTrackingPlanV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetTransformation200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetTransformationBetaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetUser200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetUserGroup200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetUserGroupV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetUserV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetWarehouseMetadata200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetWarehouseMetadataV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetWarehousesCatalog200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetWarehousesCatalogV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetWorkspace200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GetWorkspaceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Group.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.GroupSourceSettingsV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Identify.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.IdentifySourceSettingsV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.IntegrationOptionBeta.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.InvitePermissionV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.InviteV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Label.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Label1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Label2.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.LabelAlpha.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.LabelV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListAuditEvents200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListAuditEventsV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListConnectedDestinationsFromSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListConnectedDestinationsFromSource200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListConnectedDestinationsFromSourceAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListConnectedDestinationsFromSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListConnectedSourcesFromWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListConnectedSourcesFromWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListConnectedWarehousesFromSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListConnectedWarehousesFromSource200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListConnectedWarehousesFromSourceAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListConnectedWarehousesFromSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListDeliveryMetricsSummaryFromDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListDeliveryMetricsSummaryFromDestinationBetaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListDestinations200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListDestinationsV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListFiltersFromDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListFiltersFromDestinationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListFunctionItemV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListFunctions200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListFunctionsV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListInvites200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListInvitesFromUserGroup200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListInvitesFromUserGroupV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListInvitesV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListLabels200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListLabels200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListLabelsAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListLabelsV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListRegulationsFromSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListRegulationsFromSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListRoles200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListRolesV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListRulesFromTrackingPlan200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListRulesFromTrackingPlanV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSchemaSettingsInSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSchemaSettingsInSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSelectiveSyncsFromWarehouseAndSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSelectiveSyncsFromWarehouseAndSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSources200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSources200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSourcesAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSourcesFromTrackingPlan200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSourcesFromTrackingPlanV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSourcesV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSubscriptionsFromDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSubscriptionsFromDestinationAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSuppressions200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSuppressionsV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSyncsFromWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSyncsFromWarehouseAndSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSyncsFromWarehouseAndSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListSyncsFromWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListTrackingPlans200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListTrackingPlansV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListTransformations200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListTransformationsBetaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListUserGroups200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListUserGroupsFromUser200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListUserGroupsFromUserV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListUserGroupsV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListUsers200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListUsersFromUserGroup200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListUsersFromUserGroupV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListUsersV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListWarehouses200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListWarehousesV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListWorkspaceRegulations200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ListWorkspaceRegulationsV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Logos.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Logos1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Logos2.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.LogosBeta.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.MessageSubscriptionResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.MessageSubscriptionResponseError.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.MessagesSubscriptionRequest.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Metadata.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Metadata1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Metadata2.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.MetricBeta.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.MinimalUserGroupV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.MinimalUserV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.MtuSnapshotV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Pagination.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.PaginationInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.PaginationOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.PermissionInputV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.PermissionResourceV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.PermissionV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.PreviewDestinationFilter200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.PreviewDestinationFilterV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.PreviewDestinationFilterV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.PreviewDestinationFilterV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.PropertyRenameBeta.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Regulation.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RegulationListEntryV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveFilterFromDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveFilterFromDestinationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveRuleV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveRulesFromTrackingPlan200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveRulesFromTrackingPlanV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveSourceConnectionFromWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveSourceConnectionFromWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveSourceFromTrackingPlan200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveSourceFromTrackingPlanV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveSubscriptionFromDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveSubscriptionFromDestinationAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveUsersFromUserGroup200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RemoveUsersFromUserGroupV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceAdvancedSyncScheduleForWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceAdvancedSyncScheduleForWarehouseV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceAdvancedSyncScheduleForWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceLabelsInSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceLabelsInSource200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceLabelsInSourceAlphaInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceLabelsInSourceAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceLabelsInSourceV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceLabelsInSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceMessagingSubscriptionsInSpaces200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceMessagingSubscriptionsInSpacesAlphaInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceMessagingSubscriptionsInSpacesAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplacePermissionsForUser200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplacePermissionsForUserGroup200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplacePermissionsForUserGroupV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplacePermissionsForUserGroupV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplacePermissionsForUserV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplacePermissionsForUserV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceRulesInTrackingPlan200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceRulesInTrackingPlanV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceRulesInTrackingPlanV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceUsersInUserGroup200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceUsersInUserGroupV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ReplaceUsersInUserGroupV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RequestError.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RequestErrorEnvelope.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.ResourceV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RoleV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.RuleV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Schedule.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Schedule1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Schedule2.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Settings.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Settings1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Source.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Source1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Source2.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Source3.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Source4.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Source5.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Source6.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SourceAPICallSnapshotV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SourceAlpha.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SourceEventVolumeDatapointV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SourceEventVolumeV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SourceMetadata.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SourceMetadataV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SourceSettingsOutputV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SourceV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Space.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.StreamStatusV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Subscription.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SupportedFeatures.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SupportedMethods.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SupportedPlatforms.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SuppressedInner.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SyncNoticeV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.SyncV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Track.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.TrackSourceSettingsV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.TrackingPlan.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.TrackingPlan1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.TrackingPlanV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Transformation.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Transformation1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Transformation2.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.TransformationBeta.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateDestinationV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateDestinationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateFilterForDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateFilterForDestinationV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateFilterForDestinationV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateFunction200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateFunctionV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateFunctionV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateRulesInTrackingPlan200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateRulesInTrackingPlanV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateRulesInTrackingPlanV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSchemaSettingsInSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSchemaSettingsInSourceV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSchemaSettingsInSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSelectiveSyncForWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSelectiveSyncForWarehouseV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSelectiveSyncForWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSource200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSource200Response1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSourceAlphaInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSourceAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSourceV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSourceV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSubscriptionForDestination200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSubscriptionForDestinationAlphaInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateSubscriptionForDestinationAlphaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateTrackingPlan200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateTrackingPlanV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateTrackingPlanV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateTransformation200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateTransformationBetaInput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateTransformationBetaOutput.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateUserGroup200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateUserGroupV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateUserGroupV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateWarehouse200Response.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateWarehouseV1Input.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpdateWarehouseV1Output.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UpsertRuleV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.User.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UserGroup.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UserGroup1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UserGroup2.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UserGroup3.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UserGroupV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UserV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.UsersPerSourceSnapshotV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Warehouse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Warehouse1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Warehouse2.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.WarehouseAdvancedSyncV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.WarehouseMetadata.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.WarehouseMetadataV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.WarehouseSelectiveSyncItemV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.WarehouseSyncOverrideV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.WarehouseV1.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.Workspace.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.segment.publicapi.models.WorkspaceV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.APICallSnapshotV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AccessPermissionV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ActivationSummaryOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddActivationToAudience200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddActivationToAudienceAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddActivationToAudienceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddConnectionFromSourceToWarehouse201Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddConnectionFromSourceToWarehouseV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddDestinationToAudience200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddDestinationToAudienceAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddDestinationToAudienceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddLabelsToSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddLabelsToSource200Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddLabelsToSourceAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddLabelsToSourceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddLabelsToSourceV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddLabelsToSourceV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddPermissionsToUser200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddPermissionsToUserGroup200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddPermissionsToUserGroupV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddPermissionsToUserGroupV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddPermissionsToUserV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddPermissionsToUserV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddSourceToTrackingPlan200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddSourceToTrackingPlanV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddSourceToTrackingPlanV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddUsersToUserGroup200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddUsersToUserGroupV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AddUsersToUserGroupV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AdvancedWarehouseSyncScheduleV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AdvancedWarehouseSyncScheduleV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AllowedLabelBeta.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudienceComputeCadence.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudienceDefinition.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudienceDefinitionWithoutType + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudienceOptions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudienceOptionsWithLookback + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudiencePreview.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudiencePreviewAccountResult + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudiencePreviewIdentifier + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudiencePreviewProfileResult + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudiencePreviewResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudienceSchedule.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudienceSize.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudienceSummary.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AudienceSummaryWithAudienceTypeAndLookback + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.AuditEventV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.BatchQueryMessagingSubscriptionsForSpace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.BatchQueryMessagingSubscriptionsForSpaceAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.BatchQueryMessagingSubscriptionsForSpaceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.BreakdownBeta.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CancelReverseETLSyncForModel200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CancelReverseETLSyncForModelInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CancelReverseETLSyncForModelOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CommonSourceSettingsV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ComputedTraitSummary.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ComputedTraitsDefinition + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.Config.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.Config1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.Connection.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.Contact.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateAudience200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateAudienceAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateAudienceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateAudiencePreview200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateAudiencePreviewAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateAudiencePreviewAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateAudiencePreviewOptions + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateCloudSourceRegulation200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateCloudSourceRegulationV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateCloudSourceRegulationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateComputedTrait200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateComputedTraitAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateComputedTraitAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateDbtModelSyncTrigger200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateDbtModelSyncTriggerInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateDbtModelSyncTriggerOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateDestinationSubscription200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateDestinationSubscriptionAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateDestinationSubscriptionAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateDestinationV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateDestinationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateDownload200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateDownloadAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateDownloadAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateEdgeFunctions200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateEdgeFunctionsAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateEdgeFunctionsAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateFilterForDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateFilterForDestinationV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateFilterForDestinationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateFilterForSpace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateFilterForSpaceInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateFilterForSpaceOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateFunction200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateFunctionDeployment200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateFunctionDeploymentV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateFunctionV1Input.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateFunctionV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateInsertFunctionInstance200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateInsertFunctionInstanceAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateInsertFunctionInstanceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateInvites201Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateInvitesV1Input.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateInvitesV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateLabel201Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateLabelV1Input.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateLabelV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateProfilesWarehouse201Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateProfilesWarehouseAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateProfilesWarehouseAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateReverseETLManualSync200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateReverseETLManualSyncInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateReverseETLManualSyncOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateReverseEtlModel201Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateReverseEtlModelInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateReverseEtlModelOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateSource201Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateSource201Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateSourceAlphaInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateSourceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateSourceRegulation200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateSourceRegulationV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateSourceRegulationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateSourceV1Input.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateSourceV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateTrackingPlan200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateTrackingPlanV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateTrackingPlanV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateTransformation200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateTransformationBetaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateTransformationBetaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateTransformationV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateTransformationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateUserGroup200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateUserGroupV1Input.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateUserGroupV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateValidationInWarehouse200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateValidationInWarehouseV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateValidationInWarehouseV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateWarehouse201Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateWarehouseV1Input.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateWarehouseV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateWorkspaceRegulation200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateWorkspaceRegulationV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateWorkspaceRegulationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateWriteKeyForSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.CreateWriteKeyForSourceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DbtModelSyncTrigger.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteActivationAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteDestinationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteFilterById200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteFilterByIdOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteFunction200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteFunctionV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteInsertFunctionInstance200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteInsertFunctionInstanceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteInvites200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteInvitesV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteLabel200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteLabel200Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteLabelAlphaOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteLabelV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteRegulation200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteRegulationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteReverseEtlModel200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteReverseEtlModelOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteSource200Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteSourceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteSourceV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteTrackingPlan200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteTrackingPlanV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteTransformation200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteTransformationBetaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteTransformationBetaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteTransformationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteUserGroup200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteUserGroupV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteUsers200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteUsersV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteWarehouse200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeleteWarehouseV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeliveryMetricsSummaryBeta + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeliveryOverviewDestinationFilterBy + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeliveryOverviewMetricsDatapoint + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeliveryOverviewMetricsDataset + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeliveryOverviewSourceFilterBy + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DeliveryOverviewSuccessfullyReceivedFilterBy + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationFilterActionV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationFilterV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationMetadataActionFieldV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationMetadataActionV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationMetadataComponentV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationMetadataFeaturesV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationMetadataMethodsV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationMetadataPlatformsV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationMetadataSubscriptionPresetV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationMetadataV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationStatusV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationSubscription + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationSubscriptionUpdateInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DestinationV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DisableEdgeFunctions200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.DisableEdgeFunctionsAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.Download.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.Echo200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.Echo200Response1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.EchoAlphaOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.EchoV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.EdgeFunctionsAlpha.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.EntityDetails.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.EventSourceV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.FQLDefinedPropertyV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.Filter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.FunctionDeployment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.FunctionSettingV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.FunctionV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GenerateUploadURLForEdgeFunctions200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GenerateUploadURLForEdgeFunctionsAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetActivationFromAudience200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetActivationFromAudienceOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetAdvancedSyncScheduleFromWarehouse200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetAdvancedSyncScheduleFromWarehouseV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetAudience200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetAudience200Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetAudienceAlphaOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetAudienceBetaOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetAudiencePreview200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetAudiencePreviewAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetAudienceScheduleFromSpaceAndAudience200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetAudienceScheduleFromSpaceAndAudienceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetComputedTrait200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetComputedTraitAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetConnectionStateFromWarehouse200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetConnectionStateFromWarehouseV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDailyPerSourceAPICallsUsage200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDailyPerSourceAPICallsUsageV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDailyPerSourceMTUUsage200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDailyPerSourceMTUUsageV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDailyWorkspaceAPICallsUsage200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDailyWorkspaceAPICallsUsageV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDailyWorkspaceMTUUsage200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDailyWorkspaceMTUUsageV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDeliveryOverviewMetricsBetaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDestinationMetadata200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDestinationMetadataV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDestinationV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDestinationsCatalog200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetDestinationsCatalogV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models + .GetEgressFailedMetricsFromDeliveryOverview200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetEventsVolumeFromWorkspace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetEventsVolumeFromWorkspaceV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetEventsVolumeFromWorkspaceV1Query + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetFilterById200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetFilterByIdOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetFilterInDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetFilterInDestinationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetFunction200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetFunctionV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetFunctionVersion200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetFunctionVersionAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetInsertFunctionInstance200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetInsertFunctionInstanceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetLatestFromEdgeFunctions200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetLatestFromEdgeFunctionsAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetMessagingSubscriptionFailureResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetMessagingSubscriptionSuccessResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetRegulation200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetRegulationV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetReverseETLSyncStatus200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetReverseETLSyncStatusOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetReverseEtlModel200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetReverseEtlModelOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSource200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSource200Response1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSourceAlphaOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSourceMetadata200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSourceMetadataV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSourceV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSourcesCatalog200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSourcesCatalogV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSpace200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSpaceAlphaOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSubscriptionFromDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSubscriptionFromDestinationAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetSubscriptionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetTrackingPlan200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetTrackingPlanV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetTransformation200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetTransformationBetaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetTransformationBetaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetTransformationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetUser200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetUserGroup200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetUserGroupV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetUserV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetWarehouse200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetWarehouseMetadata200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetWarehouseMetadataV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetWarehouseV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetWarehousesCatalog200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetWarehousesCatalogV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetWorkspace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GetWorkspaceV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GroupSourceSettingsV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GroupSubscriptionStatus + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.GroupSubscriptionStatusResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.HandleWebhookInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.HandleWebhookOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.HashPropertiesConfiguration + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.IdentifySourceSettingsV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.InsertFunctionInstanceAlpha + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.IntegrationOptionBeta.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.InvitePermissionV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.InviteV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.LabelAlpha.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.LabelV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListActivationsAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListActivationsFromAudience200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListActivationsFromAudienceOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models + .ListAudienceConsumersFromSpaceAndAudience200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models + .ListAudienceConsumersFromSpaceAndAudienceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListAudienceConsumersSortInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models + .ListAudienceSchedulesFromSpaceAndAudience200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models + .ListAudienceSchedulesFromSpaceAndAudienceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListAudienceSearchInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListAudiences200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListAudiences200Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListAudiencesAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListAudiencesBetaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListAudiencesPaginationInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListAuditEvents200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListAuditEventsV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListComputedTraits200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListComputedTraitsAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListConnectedDestinationsFromSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListConnectedDestinationsFromSource200Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListConnectedDestinationsFromSourceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListConnectedDestinationsFromSourceV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListConnectedSourcesFromWarehouse200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListConnectedSourcesFromWarehouseV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListConnectedWarehousesFromSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListConnectedWarehousesFromSource200Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListConnectedWarehousesFromSourceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListConnectedWarehousesFromSourceV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models + .ListDeliveryMetricsSummaryFromDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListDeliveryMetricsSummaryFromDestinationBetaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListDestinations200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListDestinationsV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListFiltersForSpace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListFiltersForSpaceOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListFiltersFromDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListFiltersFromDestinationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListFiltersPaginationInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListFiltersPaginationOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListFunctionItemV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListFunctionVersions200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListFunctionVersionsAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListFunctions200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListFunctionsV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListInsertFunctionInstances200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListInsertFunctionInstancesAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListInvites200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListInvitesFromUserGroup200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListInvitesFromUserGroupV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListInvitesV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListLabels200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListLabels200Response1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListLabelsAlphaOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListLabelsV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListProfilesWarehouseInSpace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListProfilesWarehouseInSpaceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListRegulationsFromSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListRegulationsFromSourceV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models + .ListReverseETLSyncStatusesFromModelAndSubscriptionId200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models + .ListReverseETLSyncStatusesFromModelAndSubscriptionIdOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListReverseEtlModels200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListReverseEtlModelsOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListRoles200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListRolesV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListRulesFromTrackingPlan200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListRulesFromTrackingPlanV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSchemaSettingsInSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSchemaSettingsInSourceV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSelectiveSyncsFromWarehouseAndSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSelectiveSyncsFromWarehouseAndSourceV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSelectiveSyncsFromWarehouseAndSpace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSelectiveSyncsFromWarehouseAndSpaceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSources200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSources200Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSourcesAlphaOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSourcesFromTrackingPlan200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSourcesFromTrackingPlanV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSourcesV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSpaces200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSpacesAlphaOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSubscriptionsFromDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSubscriptionsFromDestinationAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSuppressions200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSuppressionsV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSyncsFromWarehouse200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSyncsFromWarehouseAndSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSyncsFromWarehouseAndSourceV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListSyncsFromWarehouseV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListTrackingPlans200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListTrackingPlansV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListTransformations200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListTransformationsBetaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListTransformationsBetaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListTransformationsV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListUserGroups200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListUserGroupsFromUser200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListUserGroupsFromUserV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListUserGroupsV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListUsers200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListUsersFromUserGroup200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListUsersFromUserGroupV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListUsersV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListWarehouses200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListWarehousesV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListWorkspaceRegulations200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ListWorkspaceRegulationsV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.LogosBeta.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.MessageSubscriptionResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.MessageSubscriptionResponseError + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.MessagesSubscriptionRequest + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.MetricBeta.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.MinimalUserGroupV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.MinimalUserV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.MtuSnapshotV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PaginationInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PaginationOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PeriodicConfig.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PermissionInputV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PermissionResourceV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PermissionV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PreviewDestinationFilter200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PreviewDestinationFilterV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PreviewDestinationFilterV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PreviewDestinationFilterV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ProfilesWarehouseAlpha.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PropertyRenameBeta.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PropertyRenameV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PropertyValueTransformationBeta + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.PropertyValueTransformationV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReadAudiencePreviewOptions + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.Regulation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RegulationListEntryV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveActivationFromAudience200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveActivationFromAudienceOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveAudienceFromSpace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveAudienceFromSpaceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveComputedTraitFromSpace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveComputedTraitFromSpaceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveFilterFromDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveFilterFromDestinationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveProfilesWarehouseFromSpace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveProfilesWarehouseFromSpaceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveRuleV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveRulesFromTrackingPlan200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveRulesFromTrackingPlanV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveSourceConnectionFromWarehouse200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveSourceConnectionFromWarehouseV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveSourceFromTrackingPlan200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveSourceFromTrackingPlanV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveSubscriptionFromDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveSubscriptionFromDestinationAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveUsersFromUserGroup200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveUsersFromUserGroupV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveWriteKeyFromSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RemoveWriteKeyFromSourceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceAdvancedSyncScheduleForWarehouse200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceAdvancedSyncScheduleForWarehouseV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceAdvancedSyncScheduleForWarehouseV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceLabelsInSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceLabelsInSource200Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceLabelsInSourceAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceLabelsInSourceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceLabelsInSourceV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceLabelsInSourceV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceMessagingSubscriptionsInSpaces200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceMessagingSubscriptionsInSpacesAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceMessagingSubscriptionsInSpacesAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplacePermissionsForUser200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplacePermissionsForUserGroup200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplacePermissionsForUserGroupV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplacePermissionsForUserGroupV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplacePermissionsForUserV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplacePermissionsForUserV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceRulesInTrackingPlan200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceRulesInTrackingPlanV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceRulesInTrackingPlanV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceUsersInUserGroup200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceUsersInUserGroupV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReplaceUsersInUserGroupV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RequestError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RequestErrorEnvelope.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ResourceV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RestoreFunctionVersion200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RestoreFunctionVersionAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RestoreFunctionVersionAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReverseETLManualSyncJobOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReverseETLSyncStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReverseEtlCronScheduleConfig + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReverseEtlDbtCloudScheduleConfig + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReverseEtlModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReverseEtlPeriodicScheduleConfig + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReverseEtlScheduleConfig + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReverseEtlScheduleDefinition + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.ReverseEtlSpecificTimeScheduleConfig + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RoleV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RuleInputV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.RuleV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SourceAPICallSnapshotV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SourceAlpha.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SourceEventVolumeDatapointV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SourceEventVolumeV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SourceMetadataV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SourceSettingsOutputV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SourceV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.Space.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SpaceWarehouseSchemaOverride + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SpaceWarehouseSelectiveSyncItemAlpha + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SpecificDaysConfig.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.StreamStatusV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SuppressedInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SyncExtractPhase.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SyncLoadPhase.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SyncNoticeV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.SyncV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.TrackSourceSettingsV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.TrackingPlanV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.TraitDefinition.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.TraitOptions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.TransformationBeta.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.TransformationV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateActivationForAudience200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateActivationForAudienceAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateActivationForAudienceOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateAudienceForSpace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateAudienceForSpaceAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateAudienceForSpaceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateComputedTraitForSpace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateComputedTraitForSpaceAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateComputedTraitForSpaceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateDestinationV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateDestinationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateFilterById200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateFilterByIdInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateFilterByIdOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateFilterForDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateFilterForDestinationV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateFilterForDestinationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateFunction200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateFunctionV1Input.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateFunctionV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateGroupSubscriptionStatusResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateInsertFunctionInstance200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateInsertFunctionInstanceAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateInsertFunctionInstanceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateProfilesWarehouseForSpaceWarehouse200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateProfilesWarehouseForSpaceWarehouseAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateReverseEtlModel200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateReverseEtlModelInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateReverseEtlModelOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateRulesInTrackingPlan200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateRulesInTrackingPlanV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateRulesInTrackingPlanV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSchemaSettingsInSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSchemaSettingsInSourceV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSchemaSettingsInSourceV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSelectiveSyncForWarehouse200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSelectiveSyncForWarehouseAndSpace200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSelectiveSyncForWarehouseV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSelectiveSyncForWarehouseV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSource200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSource200Response1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSourceAlphaInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSourceAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSourceV1Input.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSourceV1Output.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSubscriptionForDestination200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSubscriptionForDestinationAlphaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateSubscriptionForDestinationAlphaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateTrackingPlan200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateTrackingPlanV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateTrackingPlanV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateTransformation200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateTransformationBetaInput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateTransformationBetaOutput + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateTransformationV1Input + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateTransformationV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateUserGroup200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateUserGroupV1Input.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateUserGroupV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateWarehouse200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateWarehouseV1Input.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpdateWarehouseV1Output + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UpsertRuleV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UserGroupV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UserV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.UsersPerSourceSnapshotV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.Version.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.WarehouseAdvancedSyncV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.WarehouseMetadataV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.WarehouseSelectiveSyncItemV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.WarehouseSyncOverrideV1 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.WarehouseV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.segment.publicapi.models.WorkspaceV1.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } @@ -594,8 +1825,8 @@ public static String serialize(Object obj) { /** * Deserialize the given JSON string to Java object. * - * @param Type - * @param body The JSON string + * @param Type + * @param body The JSON string * @param returnType The type to deserialize into * @return The deserialized Java object */ @@ -604,7 +1835,8 @@ 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) + // 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 { @@ -621,9 +1853,7 @@ public static T deserialize(String body, Type returnType) { } } - /** - * Gson TypeAdapter for Byte Array type - */ + /** Gson TypeAdapter for Byte Array type */ public static class ByteArrayAdapter extends TypeAdapter { @Override @@ -649,9 +1879,7 @@ public byte[] read(JsonReader in) throws IOException { } } - /** - * Gson TypeAdapter for JSR310 OffsetDateTime type - */ + /** Gson TypeAdapter for JSR310 OffsetDateTime type */ public static class OffsetDateTimeTypeAdapter extends TypeAdapter { private DateTimeFormatter formatter; @@ -686,16 +1914,14 @@ public OffsetDateTime read(JsonReader in) throws IOException { default: String date = in.nextString(); if (date.endsWith("+0000")) { - date = date.substring(0, date.length()-5) + "Z"; + date = date.substring(0, date.length() - 5) + "Z"; } return OffsetDateTime.parse(date, formatter); } } } - /** - * Gson TypeAdapter for JSR310 LocalDate type - */ + /** Gson TypeAdapter for JSR310 LocalDate type */ public static class LocalDateTypeAdapter extends TypeAdapter { private DateTimeFormatter formatter; @@ -743,9 +1969,8 @@ public static void setLocalDateFormat(DateTimeFormatter 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). + * 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 { @@ -788,7 +2013,8 @@ public java.sql.Date read(JsonReader in) throws IOException { if (dateFormat != null) { return new java.sql.Date(dateFormat.parse(date).getTime()); } - return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + return new java.sql.Date( + ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); } catch (ParseException e) { throw new JsonParseException(e); } @@ -797,8 +2023,8 @@ public java.sql.Date read(JsonReader in) throws IOException { } /** - * Gson TypeAdapter for java.util.Date type - * If the dateFormat is null, ISO8601Utils will be used. + * Gson TypeAdapter for java.util.Date type If the dateFormat is null, ISO8601Utils will be + * used. */ public static class DateTypeAdapter extends TypeAdapter { diff --git a/src/main/java/com/segment/publicapi/Pair.java b/src/main/java/com/segment/publicapi/Pair.java index db9bcb16..22993e8a 100644 --- a/src/main/java/com/segment/publicapi/Pair.java +++ b/src/main/java/com/segment/publicapi/Pair.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,15 +9,13 @@ * Do not edit the class manually. */ - package com.segment.publicapi; - public class Pair { private String name = ""; private String value = ""; - public Pair (String name, String value) { + public Pair(String name, String value) { setName(name); setValue(value); } diff --git a/src/main/java/com/segment/publicapi/ProgressRequestBody.java b/src/main/java/com/segment/publicapi/ProgressRequestBody.java index 88cb6fd7..b8d01658 100644 --- a/src/main/java/com/segment/publicapi/ProgressRequestBody.java +++ b/src/main/java/com/segment/publicapi/ProgressRequestBody.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,14 +9,11 @@ * Do not edit the class manually. */ - package com.segment.publicapi; +import java.io.IOException; import okhttp3.MediaType; import okhttp3.RequestBody; - -import java.io.IOException; - import okio.Buffer; import okio.BufferedSink; import okio.ForwardingSink; @@ -66,7 +62,8 @@ public void write(Buffer source, long byteCount) throws IOException { } bytesWritten += byteCount; - callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + callback.onUploadProgress( + bytesWritten, contentLength, bytesWritten == contentLength); } }; } diff --git a/src/main/java/com/segment/publicapi/ProgressResponseBody.java b/src/main/java/com/segment/publicapi/ProgressResponseBody.java index 8b88d2e0..74a488e6 100644 --- a/src/main/java/com/segment/publicapi/ProgressResponseBody.java +++ b/src/main/java/com/segment/publicapi/ProgressResponseBody.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,14 +9,11 @@ * Do not edit the class manually. */ - package com.segment.publicapi; +import java.io.IOException; import okhttp3.MediaType; import okhttp3.ResponseBody; - -import java.io.IOException; - import okio.Buffer; import okio.BufferedSource; import okio.ForwardingSource; @@ -62,7 +58,8 @@ 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); + callback.onDownloadProgress( + totalBytesRead, responseBody.contentLength(), bytesRead == -1); return bytesRead; } }; diff --git a/src/main/java/com/segment/publicapi/ServerConfiguration.java b/src/main/java/com/segment/publicapi/ServerConfiguration.java index c956ba6b..33dcb234 100644 --- a/src/main/java/com/segment/publicapi/ServerConfiguration.java +++ b/src/main/java/com/segment/publicapi/ServerConfiguration.java @@ -2,9 +2,7 @@ import java.util.Map; -/** - * Representing a Server configuration. - */ +/** Representing a Server configuration. */ public class ServerConfiguration { public String URL; public String description; @@ -13,9 +11,11 @@ public class ServerConfiguration { /** * @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. + * @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) { + public ServerConfiguration( + String URL, String description, Map variables) { this.URL = URL; this.description = description; this.variables = variables; @@ -31,18 +31,24 @@ public String URL(Map variables) { String url = this.URL; // go through variables and replace placeholders - for (Map.Entry variable: this.variables.entrySet()) { + 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 + "."); + 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.replaceAll("\\{" + name + "\\}", value); + url = url.replace("{" + name + "}", value); } return url; } diff --git a/src/main/java/com/segment/publicapi/ServerVariable.java b/src/main/java/com/segment/publicapi/ServerVariable.java index b2f416f1..4335b8b0 100644 --- a/src/main/java/com/segment/publicapi/ServerVariable.java +++ b/src/main/java/com/segment/publicapi/ServerVariable.java @@ -2,9 +2,7 @@ import java.util.HashSet; -/** - * Representing a Server Variable for server URL template substitution. - */ +/** Representing a Server Variable for server URL template substitution. */ public class ServerVariable { public String description; public String defaultValue; @@ -13,7 +11,8 @@ public class ServerVariable { /** * @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. + * @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; diff --git a/src/main/java/com/segment/publicapi/StringUtil.java b/src/main/java/com/segment/publicapi/StringUtil.java index d4b08fb0..d9ecccc2 100644 --- a/src/main/java/com/segment/publicapi/StringUtil.java +++ b/src/main/java/com/segment/publicapi/StringUtil.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,74 +9,71 @@ * Do not edit the class manually. */ - package com.segment.publicapi; import java.util.Collection; import java.util.Iterator; - 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; - } + /** + * 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; } - 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 ""; - } + /** + * 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]); + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); } - 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()); + /** + * 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(); } - return out.toString(); - } } diff --git a/src/main/java/com/segment/publicapi/api/ActivationsApi.java b/src/main/java/com/segment/publicapi/api/ActivationsApi.java new file mode 100644 index 00000000..e5290091 --- /dev/null +++ b/src/main/java/com/segment/publicapi/api/ActivationsApi.java @@ -0,0 +1,1505 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.api; + +import com.google.gson.reflect.TypeToken; +import com.segment.publicapi.ApiCallback; +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.ApiResponse; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.Pair; +import com.segment.publicapi.models.AddActivationToAudience200Response; +import com.segment.publicapi.models.AddActivationToAudienceAlphaInput; +import com.segment.publicapi.models.AddDestinationToAudience200Response; +import com.segment.publicapi.models.AddDestinationToAudienceAlphaInput; +import com.segment.publicapi.models.GetActivationFromAudience200Response; +import com.segment.publicapi.models.ListActivationsFromAudience200Response; +import com.segment.publicapi.models.PaginationInput; +import com.segment.publicapi.models.RemoveActivationFromAudience200Response; +import com.segment.publicapi.models.UpdateActivationForAudience200Response; +import com.segment.publicapi.models.UpdateActivationForAudienceAlphaInput; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ActivationsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ActivationsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ActivationsApi(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 addActivationToAudience + * + * @param spaceId (required) + * @param audienceId (required) + * @param connectionId (required) + * @param addActivationToAudienceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call addActivationToAudienceCall( + String spaceId, + String audienceId, + String connectionId, + AddActivationToAudienceAlphaInput addActivationToAudienceAlphaInput, + 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 = addActivationToAudienceAlphaInput; + + // create path and map variables + String localVarPath = + "/spaces/{spaceId}/audiences/{audienceId}/{connectionId}/activations" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace( + "{" + "audienceId" + "}", + localVarApiClient.escapeString(audienceId.toString())) + .replace( + "{" + "connectionId" + "}", + localVarApiClient.escapeString(connectionId.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addActivationToAudienceValidateBeforeCall( + String spaceId, + String audienceId, + String connectionId, + AddActivationToAudienceAlphaInput addActivationToAudienceAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " addActivationToAudience(Async)"); + } + + // verify the required parameter 'audienceId' is set + if (audienceId == null) { + throw new ApiException( + "Missing the required parameter 'audienceId' when calling" + + " addActivationToAudience(Async)"); + } + + // verify the required parameter 'connectionId' is set + if (connectionId == null) { + throw new ApiException( + "Missing the required parameter 'connectionId' when calling" + + " addActivationToAudience(Async)"); + } + + // verify the required parameter 'addActivationToAudienceAlphaInput' is set + if (addActivationToAudienceAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'addActivationToAudienceAlphaInput' when" + + " calling addActivationToAudience(Async)"); + } + + return addActivationToAudienceCall( + spaceId, audienceId, connectionId, addActivationToAudienceAlphaInput, _callback); + } + + /** + * Add Activation to Audience Creates Activation. • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Audience feature + * enabled. Please reach out to your customer success manager for more information. • When + * called, this endpoint may generate the `Activation Created` event in the [audit + * trail](/tag/Audit-Trail). The rate limit for this endpoint is 10 requests per minute, which + * is lower than the default due to access pattern restrictions. Once reached, this endpoint + * will respond with the 429 HTTP status code with headers indicating the limit parameters. See + * [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param connectionId (required) + * @param addActivationToAudienceAlphaInput (required) + * @return AddActivationToAudience200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public AddActivationToAudience200Response addActivationToAudience( + String spaceId, + String audienceId, + String connectionId, + AddActivationToAudienceAlphaInput addActivationToAudienceAlphaInput) + throws ApiException { + ApiResponse localVarResp = + addActivationToAudienceWithHttpInfo( + spaceId, audienceId, connectionId, addActivationToAudienceAlphaInput); + return localVarResp.getData(); + } + + /** + * Add Activation to Audience Creates Activation. • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Audience feature + * enabled. Please reach out to your customer success manager for more information. • When + * called, this endpoint may generate the `Activation Created` event in the [audit + * trail](/tag/Audit-Trail). The rate limit for this endpoint is 10 requests per minute, which + * is lower than the default due to access pattern restrictions. Once reached, this endpoint + * will respond with the 429 HTTP status code with headers indicating the limit parameters. See + * [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param connectionId (required) + * @param addActivationToAudienceAlphaInput (required) + * @return ApiResponse<AddActivationToAudience200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse addActivationToAudienceWithHttpInfo( + String spaceId, + String audienceId, + String connectionId, + AddActivationToAudienceAlphaInput addActivationToAudienceAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + addActivationToAudienceValidateBeforeCall( + spaceId, audienceId, connectionId, addActivationToAudienceAlphaInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Add Activation to Audience (asynchronously) Creates Activation. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Audience feature enabled. Please reach out to your customer success manager for more + * information. • When called, this endpoint may generate the `Activation Created` + * event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 10 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param connectionId (required) + * @param addActivationToAudienceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call addActivationToAudienceAsync( + String spaceId, + String audienceId, + String connectionId, + AddActivationToAudienceAlphaInput addActivationToAudienceAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addActivationToAudienceValidateBeforeCall( + spaceId, + audienceId, + connectionId, + addActivationToAudienceAlphaInput, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for addDestinationToAudience + * + * @param spaceId (required) + * @param audienceId (required) + * @param addDestinationToAudienceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call addDestinationToAudienceCall( + String spaceId, + String audienceId, + AddDestinationToAudienceAlphaInput addDestinationToAudienceAlphaInput, + 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 = addDestinationToAudienceAlphaInput; + + // create path and map variables + String localVarPath = + "/spaces/{spaceId}/audiences/{audienceId}/destinations" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace( + "{" + "audienceId" + "}", + localVarApiClient.escapeString(audienceId.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addDestinationToAudienceValidateBeforeCall( + String spaceId, + String audienceId, + AddDestinationToAudienceAlphaInput addDestinationToAudienceAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " addDestinationToAudience(Async)"); + } + + // verify the required parameter 'audienceId' is set + if (audienceId == null) { + throw new ApiException( + "Missing the required parameter 'audienceId' when calling" + + " addDestinationToAudience(Async)"); + } + + // verify the required parameter 'addDestinationToAudienceAlphaInput' is set + if (addDestinationToAudienceAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'addDestinationToAudienceAlphaInput' when" + + " calling addDestinationToAudience(Async)"); + } + + return addDestinationToAudienceCall( + spaceId, audienceId, addDestinationToAudienceAlphaInput, _callback); + } + + /** + * Add Destination to Audience Adds a Destination to an Audience. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Audience feature enabled. Please reach out to your customer success manager for more + * information. • When called, this endpoint may generate the `Destination Added into + * Audience` event in the [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param audienceId (required) + * @param addDestinationToAudienceAlphaInput (required) + * @return AddDestinationToAudience200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public AddDestinationToAudience200Response addDestinationToAudience( + String spaceId, + String audienceId, + AddDestinationToAudienceAlphaInput addDestinationToAudienceAlphaInput) + throws ApiException { + ApiResponse localVarResp = + addDestinationToAudienceWithHttpInfo( + spaceId, audienceId, addDestinationToAudienceAlphaInput); + return localVarResp.getData(); + } + + /** + * Add Destination to Audience Adds a Destination to an Audience. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Audience feature enabled. Please reach out to your customer success manager for more + * information. • When called, this endpoint may generate the `Destination Added into + * Audience` event in the [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param audienceId (required) + * @param addDestinationToAudienceAlphaInput (required) + * @return ApiResponse<AddDestinationToAudience200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse addDestinationToAudienceWithHttpInfo( + String spaceId, + String audienceId, + AddDestinationToAudienceAlphaInput addDestinationToAudienceAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + addDestinationToAudienceValidateBeforeCall( + spaceId, audienceId, addDestinationToAudienceAlphaInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Add Destination to Audience (asynchronously) Adds a Destination to an Audience. • This + * endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Audience feature enabled. Please reach out to your customer success manager + * for more information. • When called, this endpoint may generate the `Destination Added + * into Audience` event in the [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param audienceId (required) + * @param addDestinationToAudienceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call addDestinationToAudienceAsync( + String spaceId, + String audienceId, + AddDestinationToAudienceAlphaInput addDestinationToAudienceAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addDestinationToAudienceValidateBeforeCall( + spaceId, audienceId, addDestinationToAudienceAlphaInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getActivationFromAudience + * + * @param spaceId (required) + * @param audienceId (required) + * @param id (required) + * @param workspaceId The workspace id This parameter exists in alpha. (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getActivationFromAudienceCall( + String spaceId, + String audienceId, + String id, + String workspaceId, + 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 = + "/spaces/{spaceId}/audiences/{audienceId}/activations/{id}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace( + "{" + "audienceId" + "}", + localVarApiClient.escapeString(audienceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (workspaceId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("workspaceId", workspaceId)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getActivationFromAudienceValidateBeforeCall( + String spaceId, + String audienceId, + String id, + String workspaceId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " getActivationFromAudience(Async)"); + } + + // verify the required parameter 'audienceId' is set + if (audienceId == null) { + throw new ApiException( + "Missing the required parameter 'audienceId' when calling" + + " getActivationFromAudience(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " getActivationFromAudience(Async)"); + } + + // verify the required parameter 'workspaceId' is set + if (workspaceId == null) { + throw new ApiException( + "Missing the required parameter 'workspaceId' when calling" + + " getActivationFromAudience(Async)"); + } + + return getActivationFromAudienceCall(spaceId, audienceId, id, workspaceId, _callback); + } + + /** + * Get Activation from Audience Gets a single Activation by id. The rate limit for this endpoint + * is 60 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param id (required) + * @param workspaceId The workspace id This parameter exists in alpha. (required) + * @return GetActivationFromAudience200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetActivationFromAudience200Response getActivationFromAudience( + String spaceId, String audienceId, String id, String workspaceId) throws ApiException { + ApiResponse localVarResp = + getActivationFromAudienceWithHttpInfo(spaceId, audienceId, id, workspaceId); + return localVarResp.getData(); + } + + /** + * Get Activation from Audience Gets a single Activation by id. The rate limit for this endpoint + * is 60 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param id (required) + * @param workspaceId The workspace id This parameter exists in alpha. (required) + * @return ApiResponse<GetActivationFromAudience200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse getActivationFromAudienceWithHttpInfo( + String spaceId, String audienceId, String id, String workspaceId) throws ApiException { + okhttp3.Call localVarCall = + getActivationFromAudienceValidateBeforeCall( + spaceId, audienceId, id, workspaceId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Activation from Audience (asynchronously) Gets a single Activation by id. The rate limit + * for this endpoint is 60 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param id (required) + * @param workspaceId The workspace id This parameter exists in alpha. (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getActivationFromAudienceAsync( + String spaceId, + String audienceId, + String id, + String workspaceId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getActivationFromAudienceValidateBeforeCall( + spaceId, audienceId, id, workspaceId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listActivationsFromAudience + * + * @param spaceId (required) + * @param audienceId (required) + * @param workspaceId The workspace id This parameter exists in alpha. (required) + * @param pagination Optional pagination. This parameter exists in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listActivationsFromAudienceCall( + String spaceId, + String audienceId, + String workspaceId, + PaginationInput pagination, + 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 = + "/spaces/{spaceId}/audiences/{audienceId}/activations" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace( + "{" + "audienceId" + "}", + localVarApiClient.escapeString(audienceId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (workspaceId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("workspaceId", workspaceId)); + } + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listActivationsFromAudienceValidateBeforeCall( + String spaceId, + String audienceId, + String workspaceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " listActivationsFromAudience(Async)"); + } + + // verify the required parameter 'audienceId' is set + if (audienceId == null) { + throw new ApiException( + "Missing the required parameter 'audienceId' when calling" + + " listActivationsFromAudience(Async)"); + } + + // verify the required parameter 'workspaceId' is set + if (workspaceId == null) { + throw new ApiException( + "Missing the required parameter 'workspaceId' when calling" + + " listActivationsFromAudience(Async)"); + } + + return listActivationsFromAudienceCall( + spaceId, audienceId, workspaceId, pagination, _callback); + } + + /** + * List Activations from Audience Lists all Activations. The rate limit for this endpoint is 60 + * requests per minute, which is lower than the default due to access pattern restrictions. Once + * reached, this endpoint will respond with the 429 HTTP status code with headers indicating the + * limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param workspaceId The workspace id This parameter exists in alpha. (required) + * @param pagination Optional pagination. This parameter exists in alpha. (optional) + * @return ListActivationsFromAudience200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListActivationsFromAudience200Response listActivationsFromAudience( + String spaceId, String audienceId, String workspaceId, PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listActivationsFromAudienceWithHttpInfo( + spaceId, audienceId, workspaceId, pagination); + return localVarResp.getData(); + } + + /** + * List Activations from Audience Lists all Activations. The rate limit for this endpoint is 60 + * requests per minute, which is lower than the default due to access pattern restrictions. Once + * reached, this endpoint will respond with the 429 HTTP status code with headers indicating the + * limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param workspaceId The workspace id This parameter exists in alpha. (required) + * @param pagination Optional pagination. This parameter exists in alpha. (optional) + * @return ApiResponse<ListActivationsFromAudience200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + listActivationsFromAudienceWithHttpInfo( + String spaceId, + String audienceId, + String workspaceId, + PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + listActivationsFromAudienceValidateBeforeCall( + spaceId, audienceId, workspaceId, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Activations from Audience (asynchronously) Lists all Activations. The rate limit for + * this endpoint is 60 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param workspaceId The workspace id This parameter exists in alpha. (required) + * @param pagination Optional pagination. This parameter exists in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listActivationsFromAudienceAsync( + String spaceId, + String audienceId, + String workspaceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listActivationsFromAudienceValidateBeforeCall( + spaceId, audienceId, workspaceId, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for removeActivationFromAudience + * + * @param spaceId (required) + * @param audienceId (required) + * @param id (required) + * @param workspaceId The workspace id This parameter exists in alpha. (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call removeActivationFromAudienceCall( + String spaceId, + String audienceId, + String id, + String workspaceId, + 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 = + "/spaces/{spaceId}/audiences/{audienceId}/activations/{id}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace( + "{" + "audienceId" + "}", + localVarApiClient.escapeString(audienceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (workspaceId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("workspaceId", workspaceId)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call removeActivationFromAudienceValidateBeforeCall( + String spaceId, + String audienceId, + String id, + String workspaceId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " removeActivationFromAudience(Async)"); + } + + // verify the required parameter 'audienceId' is set + if (audienceId == null) { + throw new ApiException( + "Missing the required parameter 'audienceId' when calling" + + " removeActivationFromAudience(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " removeActivationFromAudience(Async)"); + } + + // verify the required parameter 'workspaceId' is set + if (workspaceId == null) { + throw new ApiException( + "Missing the required parameter 'workspaceId' when calling" + + " removeActivationFromAudience(Async)"); + } + + return removeActivationFromAudienceCall(spaceId, audienceId, id, workspaceId, _callback); + } + + /** + * Remove Activation from Audience Deletes an Activation. The rate limit for this endpoint is 10 + * requests per minute, which is lower than the default due to access pattern restrictions. Once + * reached, this endpoint will respond with the 429 HTTP status code with headers indicating the + * limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param id (required) + * @param workspaceId The workspace id This parameter exists in alpha. (required) + * @return RemoveActivationFromAudience200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public RemoveActivationFromAudience200Response removeActivationFromAudience( + String spaceId, String audienceId, String id, String workspaceId) throws ApiException { + ApiResponse localVarResp = + removeActivationFromAudienceWithHttpInfo(spaceId, audienceId, id, workspaceId); + return localVarResp.getData(); + } + + /** + * Remove Activation from Audience Deletes an Activation. The rate limit for this endpoint is 10 + * requests per minute, which is lower than the default due to access pattern restrictions. Once + * reached, this endpoint will respond with the 429 HTTP status code with headers indicating the + * limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param id (required) + * @param workspaceId The workspace id This parameter exists in alpha. (required) + * @return ApiResponse<RemoveActivationFromAudience200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + removeActivationFromAudienceWithHttpInfo( + String spaceId, String audienceId, String id, String workspaceId) + throws ApiException { + okhttp3.Call localVarCall = + removeActivationFromAudienceValidateBeforeCall( + spaceId, audienceId, id, workspaceId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Remove Activation from Audience (asynchronously) Deletes an Activation. The rate limit for + * this endpoint is 10 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param id (required) + * @param workspaceId The workspace id This parameter exists in alpha. (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call removeActivationFromAudienceAsync( + String spaceId, + String audienceId, + String id, + String workspaceId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeActivationFromAudienceValidateBeforeCall( + spaceId, audienceId, id, workspaceId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateActivationForAudience + * + * @param spaceId (required) + * @param audienceId (required) + * @param id (required) + * @param updateActivationForAudienceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateActivationForAudienceCall( + String spaceId, + String audienceId, + String id, + UpdateActivationForAudienceAlphaInput updateActivationForAudienceAlphaInput, + 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 = updateActivationForAudienceAlphaInput; + + // create path and map variables + String localVarPath = + "/spaces/{spaceId}/audiences/{audienceId}/activations/{id}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace( + "{" + "audienceId" + "}", + localVarApiClient.escapeString(audienceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateActivationForAudienceValidateBeforeCall( + String spaceId, + String audienceId, + String id, + UpdateActivationForAudienceAlphaInput updateActivationForAudienceAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " updateActivationForAudience(Async)"); + } + + // verify the required parameter 'audienceId' is set + if (audienceId == null) { + throw new ApiException( + "Missing the required parameter 'audienceId' when calling" + + " updateActivationForAudience(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " updateActivationForAudience(Async)"); + } + + // verify the required parameter 'updateActivationForAudienceAlphaInput' is set + if (updateActivationForAudienceAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'updateActivationForAudienceAlphaInput' when" + + " calling updateActivationForAudience(Async)"); + } + + return updateActivationForAudienceCall( + spaceId, audienceId, id, updateActivationForAudienceAlphaInput, _callback); + } + + /** + * Update Activation for Audience Updates an Activation. The rate limit for this endpoint is 10 + * requests per minute, which is lower than the default due to access pattern restrictions. Once + * reached, this endpoint will respond with the 429 HTTP status code with headers indicating the + * limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param id (required) + * @param updateActivationForAudienceAlphaInput (required) + * @return UpdateActivationForAudience200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public UpdateActivationForAudience200Response updateActivationForAudience( + String spaceId, + String audienceId, + String id, + UpdateActivationForAudienceAlphaInput updateActivationForAudienceAlphaInput) + throws ApiException { + ApiResponse localVarResp = + updateActivationForAudienceWithHttpInfo( + spaceId, audienceId, id, updateActivationForAudienceAlphaInput); + return localVarResp.getData(); + } + + /** + * Update Activation for Audience Updates an Activation. The rate limit for this endpoint is 10 + * requests per minute, which is lower than the default due to access pattern restrictions. Once + * reached, this endpoint will respond with the 429 HTTP status code with headers indicating the + * limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param id (required) + * @param updateActivationForAudienceAlphaInput (required) + * @return ApiResponse<UpdateActivationForAudience200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + updateActivationForAudienceWithHttpInfo( + String spaceId, + String audienceId, + String id, + UpdateActivationForAudienceAlphaInput updateActivationForAudienceAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + updateActivationForAudienceValidateBeforeCall( + spaceId, audienceId, id, updateActivationForAudienceAlphaInput, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Activation for Audience (asynchronously) Updates an Activation. The rate limit for + * this endpoint is 10 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param audienceId (required) + * @param id (required) + * @param updateActivationForAudienceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateActivationForAudienceAsync( + String spaceId, + String audienceId, + String id, + UpdateActivationForAudienceAlphaInput updateActivationForAudienceAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateActivationForAudienceValidateBeforeCall( + spaceId, audienceId, id, updateActivationForAudienceAlphaInput, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/segment/publicapi/api/ApiCallsApi.java b/src/main/java/com/segment/publicapi/api/ApiCallsApi.java index 236a1ad0..1f8ffd0f 100644 --- a/src/main/java/com/segment/publicapi/api/ApiCallsApi.java +++ b/src/main/java/com/segment/publicapi/api/ApiCallsApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,34 +9,23 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.GetDailyPerSourceAPICallsUsage200Response; import com.segment.publicapi.models.GetDailyWorkspaceAPICallsUsage200Response; import com.segment.publicapi.models.PaginationInput; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class ApiCallsApi { private ApiClient localVarApiClient; @@ -78,29 +66,34 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getDailyPerSourceAPICallsUsage - * @param period The start of the usage month in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for per Source API calls counts. This parameter exists in alpha. (required) + * + * @param period The start of the usage month in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for per Source API calls counts. This parameter exists in + * v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDailyPerSourceAPICallsUsageCall(String period, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getDailyPerSourceAPICallsUsageCall( + String period, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -126,136 +119,174 @@ public okhttp3.Call getDailyPerSourceAPICallsUsageCall(String period, Pagination } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getDailyPerSourceAPICallsUsageValidateBeforeCall(String period, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getDailyPerSourceAPICallsUsageValidateBeforeCall( + String period, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'period' is set if (period == null) { - throw new ApiException("Missing the required parameter 'period' when calling getDailyPerSourceAPICallsUsage(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling getDailyPerSourceAPICallsUsage(Async)"); + throw new ApiException( + "Missing the required parameter 'period' when calling" + + " getDailyPerSourceAPICallsUsage(Async)"); } - - - okhttp3.Call localVarCall = getDailyPerSourceAPICallsUsageCall(period, pagination, _callback); - return localVarCall; + return getDailyPerSourceAPICallsUsageCall(period, pagination, _callback); } /** - * Get Daily Per Source API Calls Usage - * Provides daily cumulative per-source API call counts for a usage period. - * @param period The start of the usage month in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for per Source API calls counts. This parameter exists in alpha. (required) + * Get Daily Per Source API Calls Usage Provides daily cumulative per-source API call counts for + * a usage period. + * + * @param period The start of the usage month in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for per Source API calls counts. This parameter exists in + * v1. (optional) * @return GetDailyPerSourceAPICallsUsage200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetDailyPerSourceAPICallsUsage200Response getDailyPerSourceAPICallsUsage(String period, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = getDailyPerSourceAPICallsUsageWithHttpInfo(period, pagination); + public GetDailyPerSourceAPICallsUsage200Response getDailyPerSourceAPICallsUsage( + String period, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + getDailyPerSourceAPICallsUsageWithHttpInfo(period, pagination); return localVarResp.getData(); } /** - * Get Daily Per Source API Calls Usage - * Provides daily cumulative per-source API call counts for a usage period. - * @param period The start of the usage month in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for per Source API calls counts. This parameter exists in alpha. (required) + * Get Daily Per Source API Calls Usage Provides daily cumulative per-source API call counts for + * a usage period. + * + * @param period The start of the usage month in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for per Source API calls counts. This parameter exists in + * v1. (optional) * @return ApiResponse<GetDailyPerSourceAPICallsUsage200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getDailyPerSourceAPICallsUsageWithHttpInfo(String period, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = getDailyPerSourceAPICallsUsageValidateBeforeCall(period, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + getDailyPerSourceAPICallsUsageWithHttpInfo(String period, PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + getDailyPerSourceAPICallsUsageValidateBeforeCall(period, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Daily Per Source API Calls Usage (asynchronously) - * Provides daily cumulative per-source API call counts for a usage period. - * @param period The start of the usage month in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for per Source API calls counts. This parameter exists in alpha. (required) + * Get Daily Per Source API Calls Usage (asynchronously) Provides daily cumulative per-source + * API call counts for a usage period. + * + * @param period The start of the usage month in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for per Source API calls counts. This parameter exists in + * v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDailyPerSourceAPICallsUsageAsync(String period, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getDailyPerSourceAPICallsUsageValidateBeforeCall(period, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getDailyPerSourceAPICallsUsageAsync( + String period, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getDailyPerSourceAPICallsUsageValidateBeforeCall(period, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getDailyWorkspaceAPICallsUsage - * @param period The start of the usage month in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for Workspace API call counts. This parameter exists in alpha. (required) + * + * @param period The start of the usage month in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for Workspace API call counts. This parameter exists in + * v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDailyWorkspaceAPICallsUsageCall(String period, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getDailyWorkspaceAPICallsUsageCall( + String period, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -281,108 +312,140 @@ public okhttp3.Call getDailyWorkspaceAPICallsUsageCall(String period, Pagination } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getDailyWorkspaceAPICallsUsageValidateBeforeCall(String period, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getDailyWorkspaceAPICallsUsageValidateBeforeCall( + String period, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'period' is set if (period == null) { - throw new ApiException("Missing the required parameter 'period' when calling getDailyWorkspaceAPICallsUsage(Async)"); + throw new ApiException( + "Missing the required parameter 'period' when calling" + + " getDailyWorkspaceAPICallsUsage(Async)"); } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling getDailyWorkspaceAPICallsUsage(Async)"); - } - - - okhttp3.Call localVarCall = getDailyWorkspaceAPICallsUsageCall(period, pagination, _callback); - return localVarCall; + return getDailyWorkspaceAPICallsUsageCall(period, pagination, _callback); } /** - * Get Daily Workspace API Calls Usage - * Provides daily cumulative API call counts for a usage period. - * @param period The start of the usage month in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for Workspace API call counts. This parameter exists in alpha. (required) + * Get Daily Workspace API Calls Usage Provides daily cumulative API call counts for a usage + * period. + * + * @param period The start of the usage month in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for Workspace API call counts. This parameter exists in + * v1. (optional) * @return GetDailyWorkspaceAPICallsUsage200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetDailyWorkspaceAPICallsUsage200Response getDailyWorkspaceAPICallsUsage(String period, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = getDailyWorkspaceAPICallsUsageWithHttpInfo(period, pagination); + public GetDailyWorkspaceAPICallsUsage200Response getDailyWorkspaceAPICallsUsage( + String period, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + getDailyWorkspaceAPICallsUsageWithHttpInfo(period, pagination); return localVarResp.getData(); } /** - * Get Daily Workspace API Calls Usage - * Provides daily cumulative API call counts for a usage period. - * @param period The start of the usage month in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for Workspace API call counts. This parameter exists in alpha. (required) + * Get Daily Workspace API Calls Usage Provides daily cumulative API call counts for a usage + * period. + * + * @param period The start of the usage month in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for Workspace API call counts. This parameter exists in + * v1. (optional) * @return ApiResponse<GetDailyWorkspaceAPICallsUsage200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getDailyWorkspaceAPICallsUsageWithHttpInfo(String period, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = getDailyWorkspaceAPICallsUsageValidateBeforeCall(period, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + getDailyWorkspaceAPICallsUsageWithHttpInfo(String period, PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + getDailyWorkspaceAPICallsUsageValidateBeforeCall(period, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Daily Workspace API Calls Usage (asynchronously) - * Provides daily cumulative API call counts for a usage period. - * @param period The start of the usage month in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for Workspace API call counts. This parameter exists in alpha. (required) + * Get Daily Workspace API Calls Usage (asynchronously) Provides daily cumulative API call + * counts for a usage period. + * + * @param period The start of the usage month in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for Workspace API call counts. This parameter exists in + * v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDailyWorkspaceAPICallsUsageAsync(String period, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getDailyWorkspaceAPICallsUsageValidateBeforeCall(period, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getDailyWorkspaceAPICallsUsageAsync( + String period, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getDailyWorkspaceAPICallsUsageValidateBeforeCall(period, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/AudiencesApi.java b/src/main/java/com/segment/publicapi/api/AudiencesApi.java new file mode 100644 index 00000000..b7b34f88 --- /dev/null +++ b/src/main/java/com/segment/publicapi/api/AudiencesApi.java @@ -0,0 +1,2281 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.api; + +import com.google.gson.reflect.TypeToken; +import com.segment.publicapi.ApiCallback; +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.ApiResponse; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.Pair; +import com.segment.publicapi.models.CreateAudience200Response; +import com.segment.publicapi.models.CreateAudienceAlphaInput; +import com.segment.publicapi.models.CreateAudiencePreview200Response; +import com.segment.publicapi.models.CreateAudiencePreviewAlphaInput; +import com.segment.publicapi.models.GetAudience200Response; +import com.segment.publicapi.models.GetAudiencePreview200Response; +import com.segment.publicapi.models.GetAudienceScheduleFromSpaceAndAudience200Response; +import com.segment.publicapi.models.ListAudienceConsumersFromSpaceAndAudience200Response; +import com.segment.publicapi.models.ListAudienceConsumersSortInput; +import com.segment.publicapi.models.ListAudienceSchedulesFromSpaceAndAudience200Response; +import com.segment.publicapi.models.ListAudienceSearchInput; +import com.segment.publicapi.models.ListAudiences200Response; +import com.segment.publicapi.models.ListAudiencesPaginationInput; +import com.segment.publicapi.models.PaginationInput; +import com.segment.publicapi.models.RemoveAudienceFromSpace200Response; +import com.segment.publicapi.models.UpdateAudienceForSpace200Response; +import com.segment.publicapi.models.UpdateAudienceForSpaceAlphaInput; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AudiencesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AudiencesApi() { + this(Configuration.getDefaultApiClient()); + } + + public AudiencesApi(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 createAudience + * + * @param spaceId (required) + * @param createAudienceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createAudienceCall( + String spaceId, + CreateAudienceAlphaInput createAudienceAlphaInput, + 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 = createAudienceAlphaInput; + + // create path and map variables + String localVarPath = + "/spaces/{spaceId}/audiences" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createAudienceValidateBeforeCall( + String spaceId, + CreateAudienceAlphaInput createAudienceAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling createAudience(Async)"); + } + + // verify the required parameter 'createAudienceAlphaInput' is set + if (createAudienceAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'createAudienceAlphaInput' when calling" + + " createAudience(Async)"); + } + + return createAudienceCall(spaceId, createAudienceAlphaInput, _callback); + } + + /** + * Create Audience Creates Audience. • This endpoint is in **Alpha** testing. Please submit any + * feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach + * out to your customer success manager for more information. • When called, this endpoint may + * generate the `Audience Created` event in the [audit trail](/tag/Audit-Trail). Note: + * The definition for an Audience created using the API is not editable through the Segment App. + * The rate limit for this endpoint is 10 requests per minute, which is lower than the default + * due to access pattern restrictions. Once reached, this endpoint will respond with the 429 + * HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param createAudienceAlphaInput (required) + * @return CreateAudience200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateAudience200Response createAudience( + String spaceId, CreateAudienceAlphaInput createAudienceAlphaInput) throws ApiException { + ApiResponse localVarResp = + createAudienceWithHttpInfo(spaceId, createAudienceAlphaInput); + return localVarResp.getData(); + } + + /** + * Create Audience Creates Audience. • This endpoint is in **Alpha** testing. Please submit any + * feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach + * out to your customer success manager for more information. • When called, this endpoint may + * generate the `Audience Created` event in the [audit trail](/tag/Audit-Trail). Note: + * The definition for an Audience created using the API is not editable through the Segment App. + * The rate limit for this endpoint is 10 requests per minute, which is lower than the default + * due to access pattern restrictions. Once reached, this endpoint will respond with the 429 + * HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param createAudienceAlphaInput (required) + * @return ApiResponse<CreateAudience200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse createAudienceWithHttpInfo( + String spaceId, CreateAudienceAlphaInput createAudienceAlphaInput) throws ApiException { + okhttp3.Call localVarCall = + createAudienceValidateBeforeCall(spaceId, createAudienceAlphaInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Audience (asynchronously) Creates Audience. • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Audience feature + * enabled. Please reach out to your customer success manager for more information. • When + * called, this endpoint may generate the `Audience Created` event in the [audit + * trail](/tag/Audit-Trail). Note: The definition for an Audience created using the API is not + * editable through the Segment App. The rate limit for this endpoint is 10 requests per minute, + * which is lower than the default due to access pattern restrictions. Once reached, this + * endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param createAudienceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createAudienceAsync( + String spaceId, + CreateAudienceAlphaInput createAudienceAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createAudienceValidateBeforeCall(spaceId, createAudienceAlphaInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createAudiencePreview + * + * @param spaceId (required) + * @param createAudiencePreviewAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createAudiencePreviewCall( + String spaceId, + CreateAudiencePreviewAlphaInput createAudiencePreviewAlphaInput, + 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 = createAudiencePreviewAlphaInput; + + // create path and map variables + String localVarPath = + "/spaces/{spaceId}/audiences/previews" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createAudiencePreviewValidateBeforeCall( + String spaceId, + CreateAudiencePreviewAlphaInput createAudiencePreviewAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " createAudiencePreview(Async)"); + } + + // verify the required parameter 'createAudiencePreviewAlphaInput' is set + if (createAudiencePreviewAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'createAudiencePreviewAlphaInput' when calling" + + " createAudiencePreview(Async)"); + } + + return createAudiencePreviewCall(spaceId, createAudiencePreviewAlphaInput, _callback); + } + + /** + * Create Audience Preview Previews Audience. • This endpoint is in **Alpha** testing. Please + * submit any feedback by sending an email to friends@segment.com. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Audience feature enabled. + * Please reach out to your customer success manager for more information. • When called, this + * endpoint may generate the `Audience Preview Created` event in the [audit + * trail](/tag/Audit-Trail). The rate limit for this endpoint is 5 requests per minute, which is + * lower than the default due to access pattern restrictions. Once reached, this endpoint will + * respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. This endpoint also has a rate limit of 700 + * requests per month per spaceId, which is lower than the default due to access pattern + * restrictions. + * + * @param spaceId (required) + * @param createAudiencePreviewAlphaInput (required) + * @return CreateAudiencePreview200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateAudiencePreview200Response createAudiencePreview( + String spaceId, CreateAudiencePreviewAlphaInput createAudiencePreviewAlphaInput) + throws ApiException { + ApiResponse localVarResp = + createAudiencePreviewWithHttpInfo(spaceId, createAudiencePreviewAlphaInput); + return localVarResp.getData(); + } + + /** + * Create Audience Preview Previews Audience. • This endpoint is in **Alpha** testing. Please + * submit any feedback by sending an email to friends@segment.com. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Audience feature enabled. + * Please reach out to your customer success manager for more information. • When called, this + * endpoint may generate the `Audience Preview Created` event in the [audit + * trail](/tag/Audit-Trail). The rate limit for this endpoint is 5 requests per minute, which is + * lower than the default due to access pattern restrictions. Once reached, this endpoint will + * respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. This endpoint also has a rate limit of 700 + * requests per month per spaceId, which is lower than the default due to access pattern + * restrictions. + * + * @param spaceId (required) + * @param createAudiencePreviewAlphaInput (required) + * @return ApiResponse<CreateAudiencePreview200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse createAudiencePreviewWithHttpInfo( + String spaceId, CreateAudiencePreviewAlphaInput createAudiencePreviewAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + createAudiencePreviewValidateBeforeCall( + spaceId, createAudiencePreviewAlphaInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Audience Preview (asynchronously) Previews Audience. • This endpoint is in **Alpha** + * testing. Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Audience feature + * enabled. Please reach out to your customer success manager for more information. • When + * called, this endpoint may generate the `Audience Preview Created` event in the + * [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 5 requests per minute, + * which is lower than the default due to access pattern restrictions. Once reached, this + * endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. This endpoint also + * has a rate limit of 700 requests per month per spaceId, which is lower than the default due + * to access pattern restrictions. + * + * @param spaceId (required) + * @param createAudiencePreviewAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createAudiencePreviewAsync( + String spaceId, + CreateAudiencePreviewAlphaInput createAudiencePreviewAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createAudiencePreviewValidateBeforeCall( + spaceId, createAudiencePreviewAlphaInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getAudience + * + * @param spaceId (required) + * @param id (required) + * @param include Additional resource to include, support schedules only. This parameter exists + * in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getAudienceCall( + String spaceId, String id, 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 = + "/spaces/{spaceId}/audiences/{id}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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.segment.v1beta+json", + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAudienceValidateBeforeCall( + String spaceId, String id, String include, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling getAudience(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling getAudience(Async)"); + } + + return getAudienceCall(spaceId, id, include, _callback); + } + + /** + * Get Audience Returns the Audience by id and spaceId. Supports including audience schedules + * via `?include=schedules`. • This endpoint is in **Beta** testing. Please + * submit any feedback by sending an email to friends@segment.com. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Audience feature enabled. + * Please reach out to your customer success manager for more information. The rate limit for + * this endpoint is 100 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param id (required) + * @param include Additional resource to include, support schedules only. This parameter exists + * in alpha. (optional) + * @return GetAudience200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetAudience200Response getAudience(String spaceId, String id, String include) + throws ApiException { + ApiResponse localVarResp = + getAudienceWithHttpInfo(spaceId, id, include); + return localVarResp.getData(); + } + + /** + * Get Audience Returns the Audience by id and spaceId. Supports including audience schedules + * via `?include=schedules`. • This endpoint is in **Beta** testing. Please + * submit any feedback by sending an email to friends@segment.com. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Audience feature enabled. + * Please reach out to your customer success manager for more information. The rate limit for + * this endpoint is 100 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param id (required) + * @param include Additional resource to include, support schedules only. This parameter exists + * in alpha. (optional) + * @return ApiResponse<GetAudience200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse getAudienceWithHttpInfo( + String spaceId, String id, String include) throws ApiException { + okhttp3.Call localVarCall = getAudienceValidateBeforeCall(spaceId, id, include, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Audience (asynchronously) Returns the Audience by id and spaceId. Supports including + * audience schedules via `?include=schedules`. • This endpoint is in **Beta** + * testing. Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Audience feature + * enabled. Please reach out to your customer success manager for more information. The rate + * limit for this endpoint is 100 requests per minute, which is lower than the default due to + * access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @param include Additional resource to include, support schedules only. This parameter exists + * in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getAudienceAsync( + String spaceId, + String id, + String include, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getAudienceValidateBeforeCall(spaceId, id, include, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getAudiencePreview + * + * @param spaceId (required) + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getAudiencePreviewCall( + String spaceId, String id, 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 = + "/spaces/{spaceId}/audiences/previews/{id}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAudiencePreviewValidateBeforeCall( + String spaceId, String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " getAudiencePreview(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling getAudiencePreview(Async)"); + } + + return getAudiencePreviewCall(spaceId, id, _callback); + } + + /** + * Get Audience Preview Reads the results of an audience preview. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Audience feature enabled. Please reach out to your customer success manager for more + * information. The rate limit for this endpoint is 100 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @return GetAudiencePreview200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetAudiencePreview200Response getAudiencePreview(String spaceId, String id) + throws ApiException { + ApiResponse localVarResp = + getAudiencePreviewWithHttpInfo(spaceId, id); + return localVarResp.getData(); + } + + /** + * Get Audience Preview Reads the results of an audience preview. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Audience feature enabled. Please reach out to your customer success manager for more + * information. The rate limit for this endpoint is 100 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @return ApiResponse<GetAudiencePreview200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse getAudiencePreviewWithHttpInfo( + String spaceId, String id) throws ApiException { + okhttp3.Call localVarCall = getAudiencePreviewValidateBeforeCall(spaceId, id, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Audience Preview (asynchronously) Reads the results of an audience preview. • This + * endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Audience feature enabled. Please reach out to your customer success manager + * for more information. The rate limit for this endpoint is 100 requests per minute, which is + * lower than the default due to access pattern restrictions. Once reached, this endpoint will + * respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getAudiencePreviewAsync( + String spaceId, String id, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getAudiencePreviewValidateBeforeCall(spaceId, id, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getAudienceScheduleFromSpaceAndAudience + * + * @param spaceId (required) + * @param id (required) + * @param scheduleId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getAudienceScheduleFromSpaceAndAudienceCall( + String spaceId, String id, String scheduleId, 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 = + "/spaces/{spaceId}/audiences/{id}/schedules/{scheduleId}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())) + .replace( + "{" + "scheduleId" + "}", + localVarApiClient.escapeString(scheduleId.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.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAudienceScheduleFromSpaceAndAudienceValidateBeforeCall( + String spaceId, String id, String scheduleId, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " getAudienceScheduleFromSpaceAndAudience(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " getAudienceScheduleFromSpaceAndAudience(Async)"); + } + + // verify the required parameter 'scheduleId' is set + if (scheduleId == null) { + throw new ApiException( + "Missing the required parameter 'scheduleId' when calling" + + " getAudienceScheduleFromSpaceAndAudience(Async)"); + } + + return getAudienceScheduleFromSpaceAndAudienceCall(spaceId, id, scheduleId, _callback); + } + + /** + * Get Audience Schedule from Space And Audience Returns the schedule for the given audience and + * scheduleId. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an + * email to friends@segment.com. • In order to successfully call this endpoint, the specified + * Workspace needs to have the Audience feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param spaceId (required) + * @param id (required) + * @param scheduleId (required) + * @return GetAudienceScheduleFromSpaceAndAudience200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetAudienceScheduleFromSpaceAndAudience200Response + getAudienceScheduleFromSpaceAndAudience(String spaceId, String id, String scheduleId) + throws ApiException { + ApiResponse localVarResp = + getAudienceScheduleFromSpaceAndAudienceWithHttpInfo(spaceId, id, scheduleId); + return localVarResp.getData(); + } + + /** + * Get Audience Schedule from Space And Audience Returns the schedule for the given audience and + * scheduleId. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an + * email to friends@segment.com. • In order to successfully call this endpoint, the specified + * Workspace needs to have the Audience feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param spaceId (required) + * @param id (required) + * @param scheduleId (required) + * @return ApiResponse<GetAudienceScheduleFromSpaceAndAudience200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getAudienceScheduleFromSpaceAndAudienceWithHttpInfo( + String spaceId, String id, String scheduleId) throws ApiException { + okhttp3.Call localVarCall = + getAudienceScheduleFromSpaceAndAudienceValidateBeforeCall( + spaceId, id, scheduleId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Audience Schedule from Space And Audience (asynchronously) Returns the schedule for the + * given audience and scheduleId. • This endpoint is in **Alpha** testing. Please submit any + * feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach + * out to your customer success manager for more information. + * + * @param spaceId (required) + * @param id (required) + * @param scheduleId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getAudienceScheduleFromSpaceAndAudienceAsync( + String spaceId, + String id, + String scheduleId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getAudienceScheduleFromSpaceAndAudienceValidateBeforeCall( + spaceId, id, scheduleId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listAudienceConsumersFromSpaceAndAudience + * + * @param spaceId (required) + * @param id (required) + * @param pagination Information about the pagination of this response. [See + * pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) + * for more info. This parameter exists in alpha. (optional) + * @param search Optional search criteria This parameter exists in alpha. (optional) + * @param sort Optional sort criteria This parameter exists in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listAudienceConsumersFromSpaceAndAudienceCall( + String spaceId, + String id, + PaginationInput pagination, + ListAudienceSearchInput search, + ListAudienceConsumersSortInput 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 = + "/spaces/{spaceId}/audiences/{id}/audience-references" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + if (search != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("search", search)); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listAudienceConsumersFromSpaceAndAudienceValidateBeforeCall( + String spaceId, + String id, + PaginationInput pagination, + ListAudienceSearchInput search, + ListAudienceConsumersSortInput sort, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " listAudienceConsumersFromSpaceAndAudience(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " listAudienceConsumersFromSpaceAndAudience(Async)"); + } + + return listAudienceConsumersFromSpaceAndAudienceCall( + spaceId, id, pagination, search, sort, _callback); + } + + /** + * List Audience Consumers from Space And Audience Returns the list of consumers for the given + * audience. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an + * email to friends@segment.com. • In order to successfully call this endpoint, the specified + * Workspace needs to have the Audience feature enabled. Please reach out to your customer + * success manager for more information. The rate limit for this endpoint is 25 requests per + * minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @param pagination Information about the pagination of this response. [See + * pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) + * for more info. This parameter exists in alpha. (optional) + * @param search Optional search criteria This parameter exists in alpha. (optional) + * @param sort Optional sort criteria This parameter exists in alpha. (optional) + * @return ListAudienceConsumersFromSpaceAndAudience200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListAudienceConsumersFromSpaceAndAudience200Response + listAudienceConsumersFromSpaceAndAudience( + String spaceId, + String id, + PaginationInput pagination, + ListAudienceSearchInput search, + ListAudienceConsumersSortInput sort) + throws ApiException { + ApiResponse localVarResp = + listAudienceConsumersFromSpaceAndAudienceWithHttpInfo( + spaceId, id, pagination, search, sort); + return localVarResp.getData(); + } + + /** + * List Audience Consumers from Space And Audience Returns the list of consumers for the given + * audience. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an + * email to friends@segment.com. • In order to successfully call this endpoint, the specified + * Workspace needs to have the Audience feature enabled. Please reach out to your customer + * success manager for more information. The rate limit for this endpoint is 25 requests per + * minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @param pagination Information about the pagination of this response. [See + * pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) + * for more info. This parameter exists in alpha. (optional) + * @param search Optional search criteria This parameter exists in alpha. (optional) + * @param sort Optional sort criteria This parameter exists in alpha. (optional) + * @return ApiResponse<ListAudienceConsumersFromSpaceAndAudience200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + listAudienceConsumersFromSpaceAndAudienceWithHttpInfo( + String spaceId, + String id, + PaginationInput pagination, + ListAudienceSearchInput search, + ListAudienceConsumersSortInput sort) + throws ApiException { + okhttp3.Call localVarCall = + listAudienceConsumersFromSpaceAndAudienceValidateBeforeCall( + spaceId, id, pagination, search, sort, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Audience Consumers from Space And Audience (asynchronously) Returns the list of + * consumers for the given audience. • This endpoint is in **Alpha** testing. Please submit any + * feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach + * out to your customer success manager for more information. The rate limit for this endpoint + * is 25 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param id (required) + * @param pagination Information about the pagination of this response. [See + * pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) + * for more info. This parameter exists in alpha. (optional) + * @param search Optional search criteria This parameter exists in alpha. (optional) + * @param sort Optional sort criteria This parameter exists in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listAudienceConsumersFromSpaceAndAudienceAsync( + String spaceId, + String id, + PaginationInput pagination, + ListAudienceSearchInput search, + ListAudienceConsumersSortInput sort, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listAudienceConsumersFromSpaceAndAudienceValidateBeforeCall( + spaceId, id, pagination, search, sort, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listAudienceSchedulesFromSpaceAndAudience + * + * @param spaceId (required) + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listAudienceSchedulesFromSpaceAndAudienceCall( + String spaceId, String id, 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 = + "/spaces/{spaceId}/audiences/{id}/schedules" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listAudienceSchedulesFromSpaceAndAudienceValidateBeforeCall( + String spaceId, String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " listAudienceSchedulesFromSpaceAndAudience(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " listAudienceSchedulesFromSpaceAndAudience(Async)"); + } + + return listAudienceSchedulesFromSpaceAndAudienceCall(spaceId, id, _callback); + } + + /** + * List Audience Schedules from Space And Audience Returns the list of schedules for the given + * audience. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an + * email to friends@segment.com. • In order to successfully call this endpoint, the specified + * Workspace needs to have the Audience feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param spaceId (required) + * @param id (required) + * @return ListAudienceSchedulesFromSpaceAndAudience200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListAudienceSchedulesFromSpaceAndAudience200Response + listAudienceSchedulesFromSpaceAndAudience(String spaceId, String id) + throws ApiException { + ApiResponse localVarResp = + listAudienceSchedulesFromSpaceAndAudienceWithHttpInfo(spaceId, id); + return localVarResp.getData(); + } + + /** + * List Audience Schedules from Space And Audience Returns the list of schedules for the given + * audience. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an + * email to friends@segment.com. • In order to successfully call this endpoint, the specified + * Workspace needs to have the Audience feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param spaceId (required) + * @param id (required) + * @return ApiResponse<ListAudienceSchedulesFromSpaceAndAudience200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + listAudienceSchedulesFromSpaceAndAudienceWithHttpInfo(String spaceId, String id) + throws ApiException { + okhttp3.Call localVarCall = + listAudienceSchedulesFromSpaceAndAudienceValidateBeforeCall(spaceId, id, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Audience Schedules from Space And Audience (asynchronously) Returns the list of + * schedules for the given audience. • This endpoint is in **Alpha** testing. Please submit any + * feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach + * out to your customer success manager for more information. + * + * @param spaceId (required) + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listAudienceSchedulesFromSpaceAndAudienceAsync( + String spaceId, + String id, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listAudienceSchedulesFromSpaceAndAudienceValidateBeforeCall(spaceId, id, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listAudiences + * + * @param spaceId (required) + * @param search Optional search criteria This parameter exists in alpha. (optional) + * @param pagination Information about the pagination of this response. [See + * pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) + * for more info. This parameter exists in alpha. (optional) + * @param include Additional resource to include, support schedules only. This parameter exists + * in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listAudiencesCall( + String spaceId, + ListAudienceSearchInput search, + ListAudiencesPaginationInput pagination, + 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 = + "/spaces/{spaceId}/audiences" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (search != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("search", search)); + } + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + if (include != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include", include)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listAudiencesValidateBeforeCall( + String spaceId, + ListAudienceSearchInput search, + ListAudiencesPaginationInput pagination, + String include, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling listAudiences(Async)"); + } + + return listAudiencesCall(spaceId, search, pagination, include, _callback); + } + + /** + * List Audiences Returns Audiences by spaceId. Supports including audience schedules via + * `?include=schedules`. • This endpoint is in **Beta** testing. Please submit + * any feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach + * out to your customer success manager for more information. The rate limit for this endpoint + * is 25 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param search Optional search criteria This parameter exists in alpha. (optional) + * @param pagination Information about the pagination of this response. [See + * pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) + * for more info. This parameter exists in alpha. (optional) + * @param include Additional resource to include, support schedules only. This parameter exists + * in alpha. (optional) + * @return ListAudiences200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListAudiences200Response listAudiences( + String spaceId, + ListAudienceSearchInput search, + ListAudiencesPaginationInput pagination, + String include) + throws ApiException { + ApiResponse localVarResp = + listAudiencesWithHttpInfo(spaceId, search, pagination, include); + return localVarResp.getData(); + } + + /** + * List Audiences Returns Audiences by spaceId. Supports including audience schedules via + * `?include=schedules`. • This endpoint is in **Beta** testing. Please submit + * any feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Audience feature enabled. Please reach + * out to your customer success manager for more information. The rate limit for this endpoint + * is 25 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param search Optional search criteria This parameter exists in alpha. (optional) + * @param pagination Information about the pagination of this response. [See + * pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) + * for more info. This parameter exists in alpha. (optional) + * @param include Additional resource to include, support schedules only. This parameter exists + * in alpha. (optional) + * @return ApiResponse<ListAudiences200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse listAudiencesWithHttpInfo( + String spaceId, + ListAudienceSearchInput search, + ListAudiencesPaginationInput pagination, + String include) + throws ApiException { + okhttp3.Call localVarCall = + listAudiencesValidateBeforeCall(spaceId, search, pagination, include, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Audiences (asynchronously) Returns Audiences by spaceId. Supports including audience + * schedules via `?include=schedules`. • This endpoint is in **Beta** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Audience feature + * enabled. Please reach out to your customer success manager for more information. The rate + * limit for this endpoint is 25 requests per minute, which is lower than the default due to + * access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param search Optional search criteria This parameter exists in alpha. (optional) + * @param pagination Information about the pagination of this response. [See + * pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) + * for more info. This parameter exists in alpha. (optional) + * @param include Additional resource to include, support schedules only. This parameter exists + * in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listAudiencesAsync( + String spaceId, + ListAudienceSearchInput search, + ListAudiencesPaginationInput pagination, + String include, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listAudiencesValidateBeforeCall(spaceId, search, pagination, include, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for removeAudienceFromSpace + * + * @param spaceId (required) + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call removeAudienceFromSpaceCall( + String spaceId, String id, 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 = + "/spaces/{spaceId}/audiences/{id}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call removeAudienceFromSpaceValidateBeforeCall( + String spaceId, String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " removeAudienceFromSpace(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " removeAudienceFromSpace(Async)"); + } + + return removeAudienceFromSpaceCall(spaceId, id, _callback); + } + + /** + * Remove Audience from Space Deletes an Audience by id and spaceId. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Audience feature enabled. Please reach out to your customer success manager for more + * information. • When called, this endpoint may generate the `Audience Deleted` event + * in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 20 requests per + * minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @return RemoveAudienceFromSpace200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public RemoveAudienceFromSpace200Response removeAudienceFromSpace(String spaceId, String id) + throws ApiException { + ApiResponse localVarResp = + removeAudienceFromSpaceWithHttpInfo(spaceId, id); + return localVarResp.getData(); + } + + /** + * Remove Audience from Space Deletes an Audience by id and spaceId. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Audience feature enabled. Please reach out to your customer success manager for more + * information. • When called, this endpoint may generate the `Audience Deleted` event + * in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 20 requests per + * minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @return ApiResponse<RemoveAudienceFromSpace200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse removeAudienceFromSpaceWithHttpInfo( + String spaceId, String id) throws ApiException { + okhttp3.Call localVarCall = removeAudienceFromSpaceValidateBeforeCall(spaceId, id, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Remove Audience from Space (asynchronously) Deletes an Audience by id and spaceId. • This + * endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Audience feature enabled. Please reach out to your customer success manager + * for more information. • When called, this endpoint may generate the `Audience + * Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint + * is 20 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call removeAudienceFromSpaceAsync( + String spaceId, + String id, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeAudienceFromSpaceValidateBeforeCall(spaceId, id, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateAudienceForSpace + * + * @param spaceId (required) + * @param id (required) + * @param updateAudienceForSpaceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateAudienceForSpaceCall( + String spaceId, + String id, + UpdateAudienceForSpaceAlphaInput updateAudienceForSpaceAlphaInput, + 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 = updateAudienceForSpaceAlphaInput; + + // create path and map variables + String localVarPath = + "/spaces/{spaceId}/audiences/{id}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateAudienceForSpaceValidateBeforeCall( + String spaceId, + String id, + UpdateAudienceForSpaceAlphaInput updateAudienceForSpaceAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " updateAudienceForSpace(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " updateAudienceForSpace(Async)"); + } + + // verify the required parameter 'updateAudienceForSpaceAlphaInput' is set + if (updateAudienceForSpaceAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'updateAudienceForSpaceAlphaInput' when calling" + + " updateAudienceForSpace(Async)"); + } + + return updateAudienceForSpaceCall(spaceId, id, updateAudienceForSpaceAlphaInput, _callback); + } + + /** + * Update Audience for Space Updates the Audience. • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Audience feature + * enabled. Please reach out to your customer success manager for more information. • When + * called, this endpoint may generate the `Audience Modified` event in the [audit + * trail](/tag/Audit-Trail). • Note that when an Audience is updated, the Audience will be + * locked from future edits until the changes have been incorporated. You can find more + * information [in the Segment + * docs](https://segment-docs.netlify.app/docs/engage/audiences/#editing-realtime-audiences-and-traits). + * Note: The definition for an Audience updated using the API is not editable through the + * Segment App. The rate limit for this endpoint is 10 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @param updateAudienceForSpaceAlphaInput (required) + * @return UpdateAudienceForSpace200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public UpdateAudienceForSpace200Response updateAudienceForSpace( + String spaceId, + String id, + UpdateAudienceForSpaceAlphaInput updateAudienceForSpaceAlphaInput) + throws ApiException { + ApiResponse localVarResp = + updateAudienceForSpaceWithHttpInfo(spaceId, id, updateAudienceForSpaceAlphaInput); + return localVarResp.getData(); + } + + /** + * Update Audience for Space Updates the Audience. • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Audience feature + * enabled. Please reach out to your customer success manager for more information. • When + * called, this endpoint may generate the `Audience Modified` event in the [audit + * trail](/tag/Audit-Trail). • Note that when an Audience is updated, the Audience will be + * locked from future edits until the changes have been incorporated. You can find more + * information [in the Segment + * docs](https://segment-docs.netlify.app/docs/engage/audiences/#editing-realtime-audiences-and-traits). + * Note: The definition for an Audience updated using the API is not editable through the + * Segment App. The rate limit for this endpoint is 10 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @param updateAudienceForSpaceAlphaInput (required) + * @return ApiResponse<UpdateAudienceForSpace200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse updateAudienceForSpaceWithHttpInfo( + String spaceId, + String id, + UpdateAudienceForSpaceAlphaInput updateAudienceForSpaceAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + updateAudienceForSpaceValidateBeforeCall( + spaceId, id, updateAudienceForSpaceAlphaInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Audience for Space (asynchronously) Updates the Audience. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Audience feature enabled. Please reach out to your customer success manager for more + * information. • When called, this endpoint may generate the `Audience Modified` + * event in the [audit trail](/tag/Audit-Trail). • Note that when an Audience is updated, the + * Audience will be locked from future edits until the changes have been incorporated. You can + * find more information [in the Segment + * docs](https://segment-docs.netlify.app/docs/engage/audiences/#editing-realtime-audiences-and-traits). + * Note: The definition for an Audience updated using the API is not editable through the + * Segment App. The rate limit for this endpoint is 10 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @param updateAudienceForSpaceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateAudienceForSpaceAsync( + String spaceId, + String id, + UpdateAudienceForSpaceAlphaInput updateAudienceForSpaceAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateAudienceForSpaceValidateBeforeCall( + spaceId, id, updateAudienceForSpaceAlphaInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/segment/publicapi/api/AuditTrailApi.java b/src/main/java/com/segment/publicapi/api/AuditTrailApi.java index 65ebacd7..cc8982fd 100644 --- a/src/main/java/com/segment/publicapi/api/AuditTrailApi.java +++ b/src/main/java/com/segment/publicapi/api/AuditTrailApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,33 +9,22 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.ListAuditEvents200Response; import com.segment.publicapi.models.PaginationInput; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class AuditTrailApi { private ApiClient localVarApiClient; @@ -77,32 +65,45 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for listAuditEvents - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) - * @param startTime Filter response to events that happened after this time. This parameter exists in alpha. (optional) - * @param endTime Filter response to events that happened before this time. Defaults to the current time, or the end time from the pagination cursor. This parameter exists in alpha. (optional) - * @param resourceId Filter response to events that affect a specific resource, for example, a single Source. This parameter exists in alpha. (optional) - * @param resourceType Filter response to events that affect a specific type, for example, Sources, Warehouses, and Tracking Plans. This parameter exists in alpha. (optional) + * + * @param startTime Filter response to events that happened after this time. This parameter + * exists in v1. (optional) + * @param endTime Filter response to events that happened before this time. Defaults to the + * current time, or the end time from the pagination cursor. This parameter exists in v1. + * (optional) + * @param resourceId Filter response to events that affect a specific resource, for example, a + * single Source. This parameter exists in v1. (optional) + * @param resourceType Filter response to events that affect a specific type, for example, + * Sources, Warehouses, and Tracking Plans. This parameter exists in v1. (optional) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listAuditEventsCall(PaginationInput pagination, String startTime, String endTime, String resourceId, String resourceType, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listAuditEventsCall( + String startTime, + String endTime, + String resourceId, + String resourceType, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -132,7 +133,8 @@ public okhttp3.Call listAuditEventsCall(PaginationInput pagination, String start } if (resourceType != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("resourceType", resourceType)); + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("resourceType", resourceType)); } if (pagination != null) { @@ -140,112 +142,167 @@ public okhttp3.Call listAuditEventsCall(PaginationInput pagination, String start } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listAuditEventsValidateBeforeCall(PaginationInput pagination, String startTime, String endTime, String resourceId, String resourceType, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listAuditEvents(Async)"); - } - - - okhttp3.Call localVarCall = listAuditEventsCall(pagination, startTime, endTime, resourceId, resourceType, _callback); - return localVarCall; - + private okhttp3.Call listAuditEventsValidateBeforeCall( + String startTime, + String endTime, + String resourceId, + String resourceType, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + return listAuditEventsCall( + startTime, endTime, resourceId, resourceType, pagination, _callback); } /** - * List Audit Events - * Returns a list of Audit Trail events. - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) - * @param startTime Filter response to events that happened after this time. This parameter exists in alpha. (optional) - * @param endTime Filter response to events that happened before this time. Defaults to the current time, or the end time from the pagination cursor. This parameter exists in alpha. (optional) - * @param resourceId Filter response to events that affect a specific resource, for example, a single Source. This parameter exists in alpha. (optional) - * @param resourceType Filter response to events that affect a specific type, for example, Sources, Warehouses, and Tracking Plans. This parameter exists in alpha. (optional) + * List Audit Events Returns a list of Audit Trail events. + * + * @param startTime Filter response to events that happened after this time. This parameter + * exists in v1. (optional) + * @param endTime Filter response to events that happened before this time. Defaults to the + * current time, or the end time from the pagination cursor. This parameter exists in v1. + * (optional) + * @param resourceId Filter response to events that affect a specific resource, for example, a + * single Source. This parameter exists in v1. (optional) + * @param resourceType Filter response to events that affect a specific type, for example, + * Sources, Warehouses, and Tracking Plans. This parameter exists in v1. (optional) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ListAuditEvents200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListAuditEvents200Response listAuditEvents(PaginationInput pagination, String startTime, String endTime, String resourceId, String resourceType) throws ApiException { - ApiResponse localVarResp = listAuditEventsWithHttpInfo(pagination, startTime, endTime, resourceId, resourceType); + public ListAuditEvents200Response listAuditEvents( + String startTime, + String endTime, + String resourceId, + String resourceType, + PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listAuditEventsWithHttpInfo( + startTime, endTime, resourceId, resourceType, pagination); return localVarResp.getData(); } /** - * List Audit Events - * Returns a list of Audit Trail events. - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) - * @param startTime Filter response to events that happened after this time. This parameter exists in alpha. (optional) - * @param endTime Filter response to events that happened before this time. Defaults to the current time, or the end time from the pagination cursor. This parameter exists in alpha. (optional) - * @param resourceId Filter response to events that affect a specific resource, for example, a single Source. This parameter exists in alpha. (optional) - * @param resourceType Filter response to events that affect a specific type, for example, Sources, Warehouses, and Tracking Plans. This parameter exists in alpha. (optional) + * List Audit Events Returns a list of Audit Trail events. + * + * @param startTime Filter response to events that happened after this time. This parameter + * exists in v1. (optional) + * @param endTime Filter response to events that happened before this time. Defaults to the + * current time, or the end time from the pagination cursor. This parameter exists in v1. + * (optional) + * @param resourceId Filter response to events that affect a specific resource, for example, a + * single Source. This parameter exists in v1. (optional) + * @param resourceType Filter response to events that affect a specific type, for example, + * Sources, Warehouses, and Tracking Plans. This parameter exists in v1. (optional) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ApiResponse<ListAuditEvents200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listAuditEventsWithHttpInfo(PaginationInput pagination, String startTime, String endTime, String resourceId, String resourceType) throws ApiException { - okhttp3.Call localVarCall = listAuditEventsValidateBeforeCall(pagination, startTime, endTime, resourceId, resourceType, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse listAuditEventsWithHttpInfo( + String startTime, + String endTime, + String resourceId, + String resourceType, + PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + listAuditEventsValidateBeforeCall( + startTime, endTime, resourceId, resourceType, pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Audit Events (asynchronously) - * Returns a list of Audit Trail events. - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) - * @param startTime Filter response to events that happened after this time. This parameter exists in alpha. (optional) - * @param endTime Filter response to events that happened before this time. Defaults to the current time, or the end time from the pagination cursor. This parameter exists in alpha. (optional) - * @param resourceId Filter response to events that affect a specific resource, for example, a single Source. This parameter exists in alpha. (optional) - * @param resourceType Filter response to events that affect a specific type, for example, Sources, Warehouses, and Tracking Plans. This parameter exists in alpha. (optional) + * List Audit Events (asynchronously) Returns a list of Audit Trail events. + * + * @param startTime Filter response to events that happened after this time. This parameter + * exists in v1. (optional) + * @param endTime Filter response to events that happened before this time. Defaults to the + * current time, or the end time from the pagination cursor. This parameter exists in v1. + * (optional) + * @param resourceId Filter response to events that affect a specific resource, for example, a + * single Source. This parameter exists in v1. (optional) + * @param resourceType Filter response to events that affect a specific type, for example, + * Sources, Warehouses, and Tracking Plans. This parameter exists in v1. (optional) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listAuditEventsAsync(PaginationInput pagination, String startTime, String endTime, String resourceId, String resourceType, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listAuditEventsValidateBeforeCall(pagination, startTime, endTime, resourceId, resourceType, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listAuditEventsAsync( + String startTime, + String endTime, + String resourceId, + String resourceType, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listAuditEventsValidateBeforeCall( + startTime, endTime, resourceId, resourceType, pagination, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/CatalogApi.java b/src/main/java/com/segment/publicapi/api/CatalogApi.java index 7d6cf720..de950756 100644 --- a/src/main/java/com/segment/publicapi/api/CatalogApi.java +++ b/src/main/java/com/segment/publicapi/api/CatalogApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,23 +9,15 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.GetDestinationMetadata200Response; import com.segment.publicapi.models.GetDestinationsCatalog200Response; import com.segment.publicapi.models.GetSourceMetadata200Response; @@ -34,14 +25,11 @@ import com.segment.publicapi.models.GetWarehouseMetadata200Response; import com.segment.publicapi.models.GetWarehousesCatalog200Response; import com.segment.publicapi.models.PaginationInput; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class CatalogApi { private ApiClient localVarApiClient; @@ -82,28 +70,30 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getDestinationMetadata - * @param destinationMetadataId (required) + * + * @param destinationMetadataId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDestinationMetadataCall(String destinationMetadataId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getDestinationMetadataCall( + String destinationMetadataId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -112,8 +102,11 @@ public okhttp3.Call getDestinationMetadataCall(String destinationMetadataId, fin Object localVarPostBody = null; // create path and map variables - String localVarPath = "/catalog/destinations/{destinationMetadataId}" - .replaceAll("\\{" + "destinationMetadataId" + "\\}", localVarApiClient.escapeString(destinationMetadataId.toString())); + String localVarPath = + "/catalog/destinations/{destinationMetadataId}" + .replace( + "{" + "destinationMetadataId" + "}", + localVarApiClient.escapeString(destinationMetadataId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -122,127 +115,154 @@ public okhttp3.Call getDestinationMetadataCall(String destinationMetadataId, fin Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getDestinationMetadataValidateBeforeCall(String destinationMetadataId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getDestinationMetadataValidateBeforeCall( + String destinationMetadataId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'destinationMetadataId' is set if (destinationMetadataId == null) { - throw new ApiException("Missing the required parameter 'destinationMetadataId' when calling getDestinationMetadata(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationMetadataId' when calling" + + " getDestinationMetadata(Async)"); } - - - okhttp3.Call localVarCall = getDestinationMetadataCall(destinationMetadataId, _callback); - return localVarCall; + return getDestinationMetadataCall(destinationMetadataId, _callback); } /** - * Get Destination Metadata - * Returns a Destination catalog item by its id. - * @param destinationMetadataId (required) + * Get Destination Metadata Returns a Destination catalog item by its id. + * + * @param destinationMetadataId (required) * @return GetDestinationMetadata200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetDestinationMetadata200Response getDestinationMetadata(String destinationMetadataId) throws ApiException { - ApiResponse localVarResp = getDestinationMetadataWithHttpInfo(destinationMetadataId); + public GetDestinationMetadata200Response getDestinationMetadata(String destinationMetadataId) + throws ApiException { + ApiResponse localVarResp = + getDestinationMetadataWithHttpInfo(destinationMetadataId); return localVarResp.getData(); } /** - * Get Destination Metadata - * Returns a Destination catalog item by its id. - * @param destinationMetadataId (required) + * Get Destination Metadata Returns a Destination catalog item by its id. + * + * @param destinationMetadataId (required) * @return ApiResponse<GetDestinationMetadata200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getDestinationMetadataWithHttpInfo(String destinationMetadataId) throws ApiException { - okhttp3.Call localVarCall = getDestinationMetadataValidateBeforeCall(destinationMetadataId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse getDestinationMetadataWithHttpInfo( + String destinationMetadataId) throws ApiException { + okhttp3.Call localVarCall = + getDestinationMetadataValidateBeforeCall(destinationMetadataId, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Destination Metadata (asynchronously) - * Returns a Destination catalog item by its id. - * @param destinationMetadataId (required) + * Get Destination Metadata (asynchronously) Returns a Destination catalog item by its id. + * + * @param destinationMetadataId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDestinationMetadataAsync(String destinationMetadataId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getDestinationMetadataValidateBeforeCall(destinationMetadataId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getDestinationMetadataAsync( + String destinationMetadataId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getDestinationMetadataValidateBeforeCall(destinationMetadataId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getDestinationsCatalog - * @param pagination Required pagination parameters used to filter the Destinations catalog. This parameter exists in alpha. (required) + * + * @param pagination Required pagination parameters used to filter the Destinations catalog. + * This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDestinationsCatalogCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getDestinationsCatalogCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -264,127 +284,148 @@ public okhttp3.Call getDestinationsCatalogCall(PaginationInput pagination, final } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getDestinationsCatalogValidateBeforeCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling getDestinationsCatalog(Async)"); - } - - - okhttp3.Call localVarCall = getDestinationsCatalogCall(pagination, _callback); - return localVarCall; - + private okhttp3.Call getDestinationsCatalogValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return getDestinationsCatalogCall(pagination, _callback); } /** - * Get Destinations Catalog - * Returns a list of all available Destinations in the Segment catalog. - * @param pagination Required pagination parameters used to filter the Destinations catalog. This parameter exists in alpha. (required) + * Get Destinations Catalog Returns a list of all available Destinations in the Segment catalog. + * + * @param pagination Required pagination parameters used to filter the Destinations catalog. + * This parameter exists in v1. (optional) * @return GetDestinationsCatalog200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetDestinationsCatalog200Response getDestinationsCatalog(PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = getDestinationsCatalogWithHttpInfo(pagination); + public GetDestinationsCatalog200Response getDestinationsCatalog(PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + getDestinationsCatalogWithHttpInfo(pagination); return localVarResp.getData(); } /** - * Get Destinations Catalog - * Returns a list of all available Destinations in the Segment catalog. - * @param pagination Required pagination parameters used to filter the Destinations catalog. This parameter exists in alpha. (required) + * Get Destinations Catalog Returns a list of all available Destinations in the Segment catalog. + * + * @param pagination Required pagination parameters used to filter the Destinations catalog. + * This parameter exists in v1. (optional) * @return ApiResponse<GetDestinationsCatalog200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getDestinationsCatalogWithHttpInfo(PaginationInput pagination) throws ApiException { + public ApiResponse getDestinationsCatalogWithHttpInfo( + PaginationInput pagination) throws ApiException { okhttp3.Call localVarCall = getDestinationsCatalogValidateBeforeCall(pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Destinations Catalog (asynchronously) - * Returns a list of all available Destinations in the Segment catalog. - * @param pagination Required pagination parameters used to filter the Destinations catalog. This parameter exists in alpha. (required) + * Get Destinations Catalog (asynchronously) Returns a list of all available Destinations in the + * Segment catalog. + * + * @param pagination Required pagination parameters used to filter the Destinations catalog. + * This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDestinationsCatalogAsync(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getDestinationsCatalogAsync( + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = getDestinationsCatalogValidateBeforeCall(pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getSourceMetadata - * @param sourceMetadataId (required) + * + * @param sourceMetadataId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getSourceMetadataCall(String sourceMetadataId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSourceMetadataCall(String sourceMetadataId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -393,8 +434,11 @@ public okhttp3.Call getSourceMetadataCall(String sourceMetadataId, final ApiCall Object localVarPostBody = null; // create path and map variables - String localVarPath = "/catalog/sources/{sourceMetadataId}" - .replaceAll("\\{" + "sourceMetadataId" + "\\}", localVarApiClient.escapeString(sourceMetadataId.toString())); + String localVarPath = + "/catalog/sources/{sourceMetadataId}" + .replace( + "{" + "sourceMetadataId" + "}", + localVarApiClient.escapeString(sourceMetadataId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -403,127 +447,151 @@ public okhttp3.Call getSourceMetadataCall(String sourceMetadataId, final ApiCall Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSourceMetadataValidateBeforeCall(String sourceMetadataId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getSourceMetadataValidateBeforeCall( + String sourceMetadataId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'sourceMetadataId' is set if (sourceMetadataId == null) { - throw new ApiException("Missing the required parameter 'sourceMetadataId' when calling getSourceMetadata(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceMetadataId' when calling" + + " getSourceMetadata(Async)"); } - - - okhttp3.Call localVarCall = getSourceMetadataCall(sourceMetadataId, _callback); - return localVarCall; + return getSourceMetadataCall(sourceMetadataId, _callback); } /** - * Get Source Metadata - * Returns a Source catalog item by its id. - * @param sourceMetadataId (required) + * Get Source Metadata Returns a Source catalog item by its id. + * + * @param sourceMetadataId (required) * @return GetSourceMetadata200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetSourceMetadata200Response getSourceMetadata(String sourceMetadataId) throws ApiException { - ApiResponse localVarResp = getSourceMetadataWithHttpInfo(sourceMetadataId); + public GetSourceMetadata200Response getSourceMetadata(String sourceMetadataId) + throws ApiException { + ApiResponse localVarResp = + getSourceMetadataWithHttpInfo(sourceMetadataId); return localVarResp.getData(); } /** - * Get Source Metadata - * Returns a Source catalog item by its id. - * @param sourceMetadataId (required) + * Get Source Metadata Returns a Source catalog item by its id. + * + * @param sourceMetadataId (required) * @return ApiResponse<GetSourceMetadata200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getSourceMetadataWithHttpInfo(String sourceMetadataId) throws ApiException { + public ApiResponse getSourceMetadataWithHttpInfo( + String sourceMetadataId) throws ApiException { okhttp3.Call localVarCall = getSourceMetadataValidateBeforeCall(sourceMetadataId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Source Metadata (asynchronously) - * Returns a Source catalog item by its id. - * @param sourceMetadataId (required) + * Get Source Metadata (asynchronously) Returns a Source catalog item by its id. + * + * @param sourceMetadataId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getSourceMetadataAsync(String sourceMetadataId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSourceMetadataAsync( + String sourceMetadataId, final ApiCallback _callback) + throws ApiException { - okhttp3.Call localVarCall = getSourceMetadataValidateBeforeCall(sourceMetadataId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + okhttp3.Call localVarCall = + getSourceMetadataValidateBeforeCall(sourceMetadataId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getSourcesCatalog - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getSourcesCatalogCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSourcesCatalogCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -545,127 +613,144 @@ public okhttp3.Call getSourcesCatalogCall(PaginationInput pagination, final ApiC } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSourcesCatalogValidateBeforeCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling getSourcesCatalog(Async)"); - } - - - okhttp3.Call localVarCall = getSourcesCatalogCall(pagination, _callback); - return localVarCall; - + private okhttp3.Call getSourcesCatalogValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return getSourcesCatalogCall(pagination, _callback); } /** - * Get Sources Catalog - * Returns a list of all available Sources in the Segment catalog. - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * Get Sources Catalog Returns a list of all available Sources in the Segment catalog. + * + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return GetSourcesCatalog200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetSourcesCatalog200Response getSourcesCatalog(PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = getSourcesCatalogWithHttpInfo(pagination); + public GetSourcesCatalog200Response getSourcesCatalog(PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + getSourcesCatalogWithHttpInfo(pagination); return localVarResp.getData(); } /** - * Get Sources Catalog - * Returns a list of all available Sources in the Segment catalog. - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * Get Sources Catalog Returns a list of all available Sources in the Segment catalog. + * + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ApiResponse<GetSourcesCatalog200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getSourcesCatalogWithHttpInfo(PaginationInput pagination) throws ApiException { + public ApiResponse getSourcesCatalogWithHttpInfo( + PaginationInput pagination) throws ApiException { okhttp3.Call localVarCall = getSourcesCatalogValidateBeforeCall(pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Sources Catalog (asynchronously) - * Returns a list of all available Sources in the Segment catalog. - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * Get Sources Catalog (asynchronously) Returns a list of all available Sources in the Segment + * catalog. + * + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getSourcesCatalogAsync(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSourcesCatalogAsync( + PaginationInput pagination, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = getSourcesCatalogValidateBeforeCall(pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getWarehouseMetadata - * @param warehouseMetadataId (required) + * + * @param warehouseMetadataId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getWarehouseMetadataCall(String warehouseMetadataId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getWarehouseMetadataCall( + String warehouseMetadataId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -674,8 +759,11 @@ public okhttp3.Call getWarehouseMetadataCall(String warehouseMetadataId, final A Object localVarPostBody = null; // create path and map variables - String localVarPath = "/catalog/warehouses/{warehouseMetadataId}" - .replaceAll("\\{" + "warehouseMetadataId" + "\\}", localVarApiClient.escapeString(warehouseMetadataId.toString())); + String localVarPath = + "/catalog/warehouses/{warehouseMetadataId}" + .replace( + "{" + "warehouseMetadataId" + "}", + localVarApiClient.escapeString(warehouseMetadataId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -684,127 +772,154 @@ public okhttp3.Call getWarehouseMetadataCall(String warehouseMetadataId, final A Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getWarehouseMetadataValidateBeforeCall(String warehouseMetadataId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getWarehouseMetadataValidateBeforeCall( + String warehouseMetadataId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'warehouseMetadataId' is set if (warehouseMetadataId == null) { - throw new ApiException("Missing the required parameter 'warehouseMetadataId' when calling getWarehouseMetadata(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseMetadataId' when calling" + + " getWarehouseMetadata(Async)"); } - - - okhttp3.Call localVarCall = getWarehouseMetadataCall(warehouseMetadataId, _callback); - return localVarCall; + return getWarehouseMetadataCall(warehouseMetadataId, _callback); } /** - * Get Warehouse Metadata - * Returns a Warehouse catalog item by its id. - * @param warehouseMetadataId (required) + * Get Warehouse Metadata Returns a Warehouse catalog item by its id. + * + * @param warehouseMetadataId (required) * @return GetWarehouseMetadata200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetWarehouseMetadata200Response getWarehouseMetadata(String warehouseMetadataId) throws ApiException { - ApiResponse localVarResp = getWarehouseMetadataWithHttpInfo(warehouseMetadataId); + public GetWarehouseMetadata200Response getWarehouseMetadata(String warehouseMetadataId) + throws ApiException { + ApiResponse localVarResp = + getWarehouseMetadataWithHttpInfo(warehouseMetadataId); return localVarResp.getData(); } /** - * Get Warehouse Metadata - * Returns a Warehouse catalog item by its id. - * @param warehouseMetadataId (required) + * Get Warehouse Metadata Returns a Warehouse catalog item by its id. + * + * @param warehouseMetadataId (required) * @return ApiResponse<GetWarehouseMetadata200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getWarehouseMetadataWithHttpInfo(String warehouseMetadataId) throws ApiException { - okhttp3.Call localVarCall = getWarehouseMetadataValidateBeforeCall(warehouseMetadataId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse getWarehouseMetadataWithHttpInfo( + String warehouseMetadataId) throws ApiException { + okhttp3.Call localVarCall = + getWarehouseMetadataValidateBeforeCall(warehouseMetadataId, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Warehouse Metadata (asynchronously) - * Returns a Warehouse catalog item by its id. - * @param warehouseMetadataId (required) + * Get Warehouse Metadata (asynchronously) Returns a Warehouse catalog item by its id. + * + * @param warehouseMetadataId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getWarehouseMetadataAsync(String warehouseMetadataId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getWarehouseMetadataValidateBeforeCall(warehouseMetadataId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getWarehouseMetadataAsync( + String warehouseMetadataId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getWarehouseMetadataValidateBeforeCall(warehouseMetadataId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getWarehousesCatalog - * @param pagination Required pagination params used to filter the Warehouses catalog. This parameter exists in alpha. (required) + * + * @param pagination Optional pagination params used to filter the Warehouses catalog. This + * parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getWarehousesCatalogCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getWarehousesCatalogCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -826,100 +941,118 @@ public okhttp3.Call getWarehousesCatalogCall(PaginationInput pagination, final A } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getWarehousesCatalogValidateBeforeCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling getWarehousesCatalog(Async)"); - } - - - okhttp3.Call localVarCall = getWarehousesCatalogCall(pagination, _callback); - return localVarCall; - + private okhttp3.Call getWarehousesCatalogValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return getWarehousesCatalogCall(pagination, _callback); } /** - * Get Warehouses Catalog - * Returns a list of all available Warehouses in the Segment catalog. - * @param pagination Required pagination params used to filter the Warehouses catalog. This parameter exists in alpha. (required) + * Get Warehouses Catalog Returns a list of all available Warehouses in the Segment catalog. + * + * @param pagination Optional pagination params used to filter the Warehouses catalog. This + * parameter exists in v1. (optional) * @return GetWarehousesCatalog200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetWarehousesCatalog200Response getWarehousesCatalog(PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = getWarehousesCatalogWithHttpInfo(pagination); + public GetWarehousesCatalog200Response getWarehousesCatalog(PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + getWarehousesCatalogWithHttpInfo(pagination); return localVarResp.getData(); } /** - * Get Warehouses Catalog - * Returns a list of all available Warehouses in the Segment catalog. - * @param pagination Required pagination params used to filter the Warehouses catalog. This parameter exists in alpha. (required) + * Get Warehouses Catalog Returns a list of all available Warehouses in the Segment catalog. + * + * @param pagination Optional pagination params used to filter the Warehouses catalog. This + * parameter exists in v1. (optional) * @return ApiResponse<GetWarehousesCatalog200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getWarehousesCatalogWithHttpInfo(PaginationInput pagination) throws ApiException { + public ApiResponse getWarehousesCatalogWithHttpInfo( + PaginationInput pagination) throws ApiException { okhttp3.Call localVarCall = getWarehousesCatalogValidateBeforeCall(pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Warehouses Catalog (asynchronously) - * Returns a list of all available Warehouses in the Segment catalog. - * @param pagination Required pagination params used to filter the Warehouses catalog. This parameter exists in alpha. (required) + * Get Warehouses Catalog (asynchronously) Returns a list of all available Warehouses in the + * Segment catalog. + * + * @param pagination Optional pagination params used to filter the Warehouses catalog. This + * parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getWarehousesCatalogAsync(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getWarehousesCatalogAsync( + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = getWarehousesCatalogValidateBeforeCall(pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/ComputedTraitsApi.java b/src/main/java/com/segment/publicapi/api/ComputedTraitsApi.java new file mode 100644 index 00000000..2fe74eab --- /dev/null +++ b/src/main/java/com/segment/publicapi/api/ComputedTraitsApi.java @@ -0,0 +1,1141 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.api; + +import com.google.gson.reflect.TypeToken; +import com.segment.publicapi.ApiCallback; +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.ApiResponse; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.Pair; +import com.segment.publicapi.models.CreateComputedTrait200Response; +import com.segment.publicapi.models.CreateComputedTraitAlphaInput; +import com.segment.publicapi.models.GetComputedTrait200Response; +import com.segment.publicapi.models.ListComputedTraits200Response; +import com.segment.publicapi.models.PaginationInput; +import com.segment.publicapi.models.RemoveComputedTraitFromSpace200Response; +import com.segment.publicapi.models.UpdateComputedTraitForSpace200Response; +import com.segment.publicapi.models.UpdateComputedTraitForSpaceAlphaInput; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ComputedTraitsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ComputedTraitsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ComputedTraitsApi(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 createComputedTrait + * + * @param spaceId (required) + * @param createComputedTraitAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createComputedTraitCall( + String spaceId, + CreateComputedTraitAlphaInput createComputedTraitAlphaInput, + 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 = createComputedTraitAlphaInput; + + // create path and map variables + String localVarPath = + "/spaces/{spaceId}/computed-traits" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createComputedTraitValidateBeforeCall( + String spaceId, + CreateComputedTraitAlphaInput createComputedTraitAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " createComputedTrait(Async)"); + } + + // verify the required parameter 'createComputedTraitAlphaInput' is set + if (createComputedTraitAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'createComputedTraitAlphaInput' when calling" + + " createComputedTrait(Async)"); + } + + return createComputedTraitCall(spaceId, createComputedTraitAlphaInput, _callback); + } + + /** + * Create Computed Trait Creates a Computed Trait • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Computed Trait + * feature enabled. Please reach out to your customer success manager for more information. • + * When called, this endpoint may generate the `Computed Trait Created` event in the + * [audit trail](/tag/Audit-Trail). Note: The definition for a Computed Trait created using the + * API is not editable through the Segment App. The rate limit for this endpoint is 10 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param createComputedTraitAlphaInput (required) + * @return CreateComputedTrait200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateComputedTrait200Response createComputedTrait( + String spaceId, CreateComputedTraitAlphaInput createComputedTraitAlphaInput) + throws ApiException { + ApiResponse localVarResp = + createComputedTraitWithHttpInfo(spaceId, createComputedTraitAlphaInput); + return localVarResp.getData(); + } + + /** + * Create Computed Trait Creates a Computed Trait • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Computed Trait + * feature enabled. Please reach out to your customer success manager for more information. • + * When called, this endpoint may generate the `Computed Trait Created` event in the + * [audit trail](/tag/Audit-Trail). Note: The definition for a Computed Trait created using the + * API is not editable through the Segment App. The rate limit for this endpoint is 10 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param createComputedTraitAlphaInput (required) + * @return ApiResponse<CreateComputedTrait200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse createComputedTraitWithHttpInfo( + String spaceId, CreateComputedTraitAlphaInput createComputedTraitAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + createComputedTraitValidateBeforeCall(spaceId, createComputedTraitAlphaInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Computed Trait (asynchronously) Creates a Computed Trait • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Computed Trait feature enabled. Please reach out to your customer success manager for more + * information. • When called, this endpoint may generate the `Computed Trait Created` + * event in the [audit trail](/tag/Audit-Trail). Note: The definition for a Computed Trait + * created using the API is not editable through the Segment App. The rate limit for this + * endpoint is 10 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param createComputedTraitAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createComputedTraitAsync( + String spaceId, + CreateComputedTraitAlphaInput createComputedTraitAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createComputedTraitValidateBeforeCall( + spaceId, createComputedTraitAlphaInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getComputedTrait + * + * @param spaceId (required) + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getComputedTraitCall(String spaceId, String id, 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 = + "/spaces/{spaceId}/computed-traits/{id}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getComputedTraitValidateBeforeCall( + String spaceId, String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " getComputedTrait(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling getComputedTrait(Async)"); + } + + return getComputedTraitCall(spaceId, id, _callback); + } + + /** + * Get Computed Trait Returns the Computed Trait by id and spaceId • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Computed Trait feature enabled. Please reach out to your customer success manager for more + * information. The rate limit for this endpoint is 100 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @return GetComputedTrait200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetComputedTrait200Response getComputedTrait(String spaceId, String id) + throws ApiException { + ApiResponse localVarResp = + getComputedTraitWithHttpInfo(spaceId, id); + return localVarResp.getData(); + } + + /** + * Get Computed Trait Returns the Computed Trait by id and spaceId • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Computed Trait feature enabled. Please reach out to your customer success manager for more + * information. The rate limit for this endpoint is 100 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @return ApiResponse<GetComputedTrait200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse getComputedTraitWithHttpInfo( + String spaceId, String id) throws ApiException { + okhttp3.Call localVarCall = getComputedTraitValidateBeforeCall(spaceId, id, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Computed Trait (asynchronously) Returns the Computed Trait by id and spaceId • This + * endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Computed Trait feature enabled. Please reach out to your customer success + * manager for more information. The rate limit for this endpoint is 100 requests per minute, + * which is lower than the default due to access pattern restrictions. Once reached, this + * endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getComputedTraitAsync( + String spaceId, String id, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getComputedTraitValidateBeforeCall(spaceId, id, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listComputedTraits + * + * @param spaceId (required) + * @param pagination Information about the pagination of this response. [See + * pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) + * for more info. This parameter exists in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listComputedTraitsCall( + String spaceId, PaginationInput pagination, 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 = + "/spaces/{spaceId}/computed-traits" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listComputedTraitsValidateBeforeCall( + String spaceId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " listComputedTraits(Async)"); + } + + return listComputedTraitsCall(spaceId, pagination, _callback); + } + + /** + * List Computed Traits Returns Computed Traits by spaceId. • This endpoint is in **Alpha** + * testing. Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Computed Trait + * feature enabled. Please reach out to your customer success manager for more information. The + * rate limit for this endpoint is 25 requests per minute, which is lower than the default due + * to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param pagination Information about the pagination of this response. [See + * pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) + * for more info. This parameter exists in alpha. (optional) + * @return ListComputedTraits200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListComputedTraits200Response listComputedTraits( + String spaceId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listComputedTraitsWithHttpInfo(spaceId, pagination); + return localVarResp.getData(); + } + + /** + * List Computed Traits Returns Computed Traits by spaceId. • This endpoint is in **Alpha** + * testing. Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Computed Trait + * feature enabled. Please reach out to your customer success manager for more information. The + * rate limit for this endpoint is 25 requests per minute, which is lower than the default due + * to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param pagination Information about the pagination of this response. [See + * pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) + * for more info. This parameter exists in alpha. (optional) + * @return ApiResponse<ListComputedTraits200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse listComputedTraitsWithHttpInfo( + String spaceId, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = listComputedTraitsValidateBeforeCall(spaceId, pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Computed Traits (asynchronously) Returns Computed Traits by spaceId. • This endpoint is + * in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. + * • In order to successfully call this endpoint, the specified Workspace needs to have the + * Computed Trait feature enabled. Please reach out to your customer success manager for more + * information. The rate limit for this endpoint is 25 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param pagination Information about the pagination of this response. [See + * pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) + * for more info. This parameter exists in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listComputedTraitsAsync( + String spaceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listComputedTraitsValidateBeforeCall(spaceId, pagination, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for removeComputedTraitFromSpace + * + * @param spaceId (required) + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call removeComputedTraitFromSpaceCall( + String spaceId, String id, 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 = + "/spaces/{spaceId}/computed-traits/{id}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call removeComputedTraitFromSpaceValidateBeforeCall( + String spaceId, String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " removeComputedTraitFromSpace(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " removeComputedTraitFromSpace(Async)"); + } + + return removeComputedTraitFromSpaceCall(spaceId, id, _callback); + } + + /** + * Remove Computed Trait from Space Deletes a Computed Trait by id and spaceId. • This endpoint + * is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Computed Trait feature enabled. Please reach out to your customer success + * manager for more information. • When called, this endpoint may generate the `Computed + * Trait Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this + * endpoint is 20 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param id (required) + * @return RemoveComputedTraitFromSpace200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public RemoveComputedTraitFromSpace200Response removeComputedTraitFromSpace( + String spaceId, String id) throws ApiException { + ApiResponse localVarResp = + removeComputedTraitFromSpaceWithHttpInfo(spaceId, id); + return localVarResp.getData(); + } + + /** + * Remove Computed Trait from Space Deletes a Computed Trait by id and spaceId. • This endpoint + * is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Computed Trait feature enabled. Please reach out to your customer success + * manager for more information. • When called, this endpoint may generate the `Computed + * Trait Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this + * endpoint is 20 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param id (required) + * @return ApiResponse<RemoveComputedTraitFromSpace200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + removeComputedTraitFromSpaceWithHttpInfo(String spaceId, String id) + throws ApiException { + okhttp3.Call localVarCall = + removeComputedTraitFromSpaceValidateBeforeCall(spaceId, id, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Remove Computed Trait from Space (asynchronously) Deletes a Computed Trait by id and spaceId. + * • This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Computed Trait feature enabled. Please reach out to your customer success + * manager for more information. • When called, this endpoint may generate the `Computed + * Trait Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this + * endpoint is 20 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param spaceId (required) + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call removeComputedTraitFromSpaceAsync( + String spaceId, + String id, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeComputedTraitFromSpaceValidateBeforeCall(spaceId, id, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateComputedTraitForSpace + * + * @param spaceId (required) + * @param id (required) + * @param updateComputedTraitForSpaceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateComputedTraitForSpaceCall( + String spaceId, + String id, + UpdateComputedTraitForSpaceAlphaInput updateComputedTraitForSpaceAlphaInput, + 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 = updateComputedTraitForSpaceAlphaInput; + + // create path and map variables + String localVarPath = + "/spaces/{spaceId}/computed-traits/{id}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateComputedTraitForSpaceValidateBeforeCall( + String spaceId, + String id, + UpdateComputedTraitForSpaceAlphaInput updateComputedTraitForSpaceAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " updateComputedTraitForSpace(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " updateComputedTraitForSpace(Async)"); + } + + // verify the required parameter 'updateComputedTraitForSpaceAlphaInput' is set + if (updateComputedTraitForSpaceAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'updateComputedTraitForSpaceAlphaInput' when" + + " calling updateComputedTraitForSpace(Async)"); + } + + return updateComputedTraitForSpaceCall( + spaceId, id, updateComputedTraitForSpaceAlphaInput, _callback); + } + + /** + * Update Computed Trait for Space Updates the Computed Trait. • This endpoint is in **Alpha** + * testing. Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Computed Trait + * feature enabled. Please reach out to your customer success manager for more information. • + * When called, this endpoint may generate the `Computed Trait Modified` event in the + * [audit trail](/tag/Audit-Trail). • Note that when a Computed Trait is updated, the Computed + * Trait will be locked from future edits until the changes have been incorporated. You can find + * more information [in the Segment + * docs](https://segment-docs.netlify.app/docs/unify/traits/computed-traits/#editing-realtime-traits). + * Note: The definition for a Computed Trait updated using the API is not editable through the + * Segment App. The rate limit for this endpoint is 10 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @param updateComputedTraitForSpaceAlphaInput (required) + * @return UpdateComputedTraitForSpace200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public UpdateComputedTraitForSpace200Response updateComputedTraitForSpace( + String spaceId, + String id, + UpdateComputedTraitForSpaceAlphaInput updateComputedTraitForSpaceAlphaInput) + throws ApiException { + ApiResponse localVarResp = + updateComputedTraitForSpaceWithHttpInfo( + spaceId, id, updateComputedTraitForSpaceAlphaInput); + return localVarResp.getData(); + } + + /** + * Update Computed Trait for Space Updates the Computed Trait. • This endpoint is in **Alpha** + * testing. Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Computed Trait + * feature enabled. Please reach out to your customer success manager for more information. • + * When called, this endpoint may generate the `Computed Trait Modified` event in the + * [audit trail](/tag/Audit-Trail). • Note that when a Computed Trait is updated, the Computed + * Trait will be locked from future edits until the changes have been incorporated. You can find + * more information [in the Segment + * docs](https://segment-docs.netlify.app/docs/unify/traits/computed-traits/#editing-realtime-traits). + * Note: The definition for a Computed Trait updated using the API is not editable through the + * Segment App. The rate limit for this endpoint is 10 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @param updateComputedTraitForSpaceAlphaInput (required) + * @return ApiResponse<UpdateComputedTraitForSpace200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + updateComputedTraitForSpaceWithHttpInfo( + String spaceId, + String id, + UpdateComputedTraitForSpaceAlphaInput updateComputedTraitForSpaceAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + updateComputedTraitForSpaceValidateBeforeCall( + spaceId, id, updateComputedTraitForSpaceAlphaInput, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Computed Trait for Space (asynchronously) Updates the Computed Trait. • This endpoint + * is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Computed Trait feature enabled. Please reach out to your customer success + * manager for more information. • When called, this endpoint may generate the `Computed + * Trait Modified` event in the [audit trail](/tag/Audit-Trail). • Note that when a + * Computed Trait is updated, the Computed Trait will be locked from future edits until the + * changes have been incorporated. You can find more information [in the Segment + * docs](https://segment-docs.netlify.app/docs/unify/traits/computed-traits/#editing-realtime-traits). + * Note: The definition for a Computed Trait updated using the API is not editable through the + * Segment App. The rate limit for this endpoint is 10 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param id (required) + * @param updateComputedTraitForSpaceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateComputedTraitForSpaceAsync( + String spaceId, + String id, + UpdateComputedTraitForSpaceAlphaInput updateComputedTraitForSpaceAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateComputedTraitForSpaceValidateBeforeCall( + spaceId, id, updateComputedTraitForSpaceAlphaInput, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/segment/publicapi/api/CustomerInsightsApi.java b/src/main/java/com/segment/publicapi/api/CustomerInsightsApi.java new file mode 100644 index 00000000..c1a0a7a5 --- /dev/null +++ b/src/main/java/com/segment/publicapi/api/CustomerInsightsApi.java @@ -0,0 +1,240 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.api; + +import com.google.gson.reflect.TypeToken; +import com.segment.publicapi.ApiCallback; +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.ApiResponse; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.Pair; +import com.segment.publicapi.models.CreateDownload200Response; +import com.segment.publicapi.models.CreateDownloadAlphaInput; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CustomerInsightsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CustomerInsightsApi() { + this(Configuration.getDefaultApiClient()); + } + + public CustomerInsightsApi(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 createDownload + * + * @param createDownloadAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createDownloadCall( + CreateDownloadAlphaInput createDownloadAlphaInput, 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 = createDownloadAlphaInput; + + // create path and map variables + String localVarPath = "/customer-insights/download"; + + 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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createDownloadValidateBeforeCall( + CreateDownloadAlphaInput createDownloadAlphaInput, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'createDownloadAlphaInput' is set + if (createDownloadAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'createDownloadAlphaInput' when calling" + + " createDownload(Async)"); + } + + return createDownloadCall(createDownloadAlphaInput, _callback); + } + + /** + * Create Download Create Customer Insights Presigned URLsThe rate limit for this endpoint is + * 120 requests per day per workspaceId, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param createDownloadAlphaInput (required) + * @return CreateDownload200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateDownload200Response createDownload( + CreateDownloadAlphaInput createDownloadAlphaInput) throws ApiException { + ApiResponse localVarResp = + createDownloadWithHttpInfo(createDownloadAlphaInput); + return localVarResp.getData(); + } + + /** + * Create Download Create Customer Insights Presigned URLsThe rate limit for this endpoint is + * 120 requests per day per workspaceId, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param createDownloadAlphaInput (required) + * @return ApiResponse<CreateDownload200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse createDownloadWithHttpInfo( + CreateDownloadAlphaInput createDownloadAlphaInput) throws ApiException { + okhttp3.Call localVarCall = + createDownloadValidateBeforeCall(createDownloadAlphaInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Download (asynchronously) Create Customer Insights Presigned URLsThe rate limit for + * this endpoint is 120 requests per day per workspaceId, which is lower than the default due to + * access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param createDownloadAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createDownloadAsync( + CreateDownloadAlphaInput createDownloadAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createDownloadValidateBeforeCall(createDownloadAlphaInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/segment/publicapi/api/DbtApi.java b/src/main/java/com/segment/publicapi/api/DbtApi.java new file mode 100644 index 00000000..37dc5d6a --- /dev/null +++ b/src/main/java/com/segment/publicapi/api/DbtApi.java @@ -0,0 +1,245 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.api; + +import com.google.gson.reflect.TypeToken; +import com.segment.publicapi.ApiCallback; +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.ApiResponse; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.Pair; +import com.segment.publicapi.models.CreateDbtModelSyncTrigger200Response; +import com.segment.publicapi.models.CreateDbtModelSyncTriggerInput; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DbtApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DbtApi() { + this(Configuration.getDefaultApiClient()); + } + + public DbtApi(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 createDbtModelSyncTrigger + * + * @param createDbtModelSyncTriggerInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createDbtModelSyncTriggerCall( + CreateDbtModelSyncTriggerInput createDbtModelSyncTriggerInput, + 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 = createDbtModelSyncTriggerInput; + + // create path and map variables + String localVarPath = "/dbt-model-syncs/trigger"; + + 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.segment.v1beta+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1beta+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createDbtModelSyncTriggerValidateBeforeCall( + CreateDbtModelSyncTriggerInput createDbtModelSyncTriggerInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'createDbtModelSyncTriggerInput' is set + if (createDbtModelSyncTriggerInput == null) { + throw new ApiException( + "Missing the required parameter 'createDbtModelSyncTriggerInput' when calling" + + " createDbtModelSyncTrigger(Async)"); + } + + return createDbtModelSyncTriggerCall(createDbtModelSyncTriggerInput, _callback); + } + + /** + * Create Dbt Model Sync Trigger Creates a trigger for a new dbt model sync for a Source. The + * rate limit for this endpoint is 10 requests per minute, which is lower than the default due + * to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param createDbtModelSyncTriggerInput (required) + * @return CreateDbtModelSyncTrigger200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateDbtModelSyncTrigger200Response createDbtModelSyncTrigger( + CreateDbtModelSyncTriggerInput createDbtModelSyncTriggerInput) throws ApiException { + ApiResponse localVarResp = + createDbtModelSyncTriggerWithHttpInfo(createDbtModelSyncTriggerInput); + return localVarResp.getData(); + } + + /** + * Create Dbt Model Sync Trigger Creates a trigger for a new dbt model sync for a Source. The + * rate limit for this endpoint is 10 requests per minute, which is lower than the default due + * to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param createDbtModelSyncTriggerInput (required) + * @return ApiResponse<CreateDbtModelSyncTrigger200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse createDbtModelSyncTriggerWithHttpInfo( + CreateDbtModelSyncTriggerInput createDbtModelSyncTriggerInput) throws ApiException { + okhttp3.Call localVarCall = + createDbtModelSyncTriggerValidateBeforeCall(createDbtModelSyncTriggerInput, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Dbt Model Sync Trigger (asynchronously) Creates a trigger for a new dbt model sync for + * a Source. The rate limit for this endpoint is 10 requests per minute, which is lower than the + * default due to access pattern restrictions. Once reached, this endpoint will respond with the + * 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param createDbtModelSyncTriggerInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createDbtModelSyncTriggerAsync( + CreateDbtModelSyncTriggerInput createDbtModelSyncTriggerInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createDbtModelSyncTriggerValidateBeforeCall( + createDbtModelSyncTriggerInput, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/segment/publicapi/api/DeletionAndSuppressionApi.java b/src/main/java/com/segment/publicapi/api/DeletionAndSuppressionApi.java index d0cdb807..1d56031c 100644 --- a/src/main/java/com/segment/publicapi/api/DeletionAndSuppressionApi.java +++ b/src/main/java/com/segment/publicapi/api/DeletionAndSuppressionApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,23 +9,15 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.CreateCloudSourceRegulation200Response; import com.segment.publicapi.models.CreateCloudSourceRegulationV1Input; import com.segment.publicapi.models.CreateSourceRegulation200Response; @@ -39,14 +30,11 @@ import com.segment.publicapi.models.ListSuppressions200Response; import com.segment.publicapi.models.ListWorkspaceRegulations200Response; import com.segment.publicapi.models.PaginationInput; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class DeletionAndSuppressionApi { private ApiClient localVarApiClient; @@ -87,29 +75,34 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createCloudSourceRegulation - * @param sourceId (required) - * @param createCloudSourceRegulationV1Input (required) + * + * @param sourceId (required) + * @param createCloudSourceRegulationV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createCloudSourceRegulationCall(String sourceId, CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createCloudSourceRegulationCall( + String sourceId, + CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -118,8 +111,11 @@ public okhttp3.Call createCloudSourceRegulationCall(String sourceId, CreateCloud Object localVarPostBody = createCloudSourceRegulationV1Input; // create path and map variables - String localVarPath = "/regulations/cloudsources/{sourceId}" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/regulations/cloudsources/{sourceId}" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -128,7 +124,10 @@ public okhttp3.Call createCloudSourceRegulationCall(String sourceId, CreateCloud Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -136,128 +135,187 @@ public okhttp3.Call createCloudSourceRegulationCall(String sourceId, CreateCloud } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createCloudSourceRegulationValidateBeforeCall(String sourceId, CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createCloudSourceRegulationValidateBeforeCall( + String sourceId, + CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling createCloudSourceRegulation(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " createCloudSourceRegulation(Async)"); } - + // verify the required parameter 'createCloudSourceRegulationV1Input' is set if (createCloudSourceRegulationV1Input == null) { - throw new ApiException("Missing the required parameter 'createCloudSourceRegulationV1Input' when calling createCloudSourceRegulation(Async)"); + throw new ApiException( + "Missing the required parameter 'createCloudSourceRegulationV1Input' when" + + " calling createCloudSourceRegulation(Async)"); } - - - okhttp3.Call localVarCall = createCloudSourceRegulationCall(sourceId, createCloudSourceRegulationV1Input, _callback); - return localVarCall; + return createCloudSourceRegulationCall( + sourceId, createCloudSourceRegulationV1Input, _callback); } /** - * Create Cloud Source Regulation - * Creates a Source-scoped regulation. Config API omitted fields: - `attributes`, - `userAgent` - * @param sourceId (required) - * @param createCloudSourceRegulationV1Input (required) + * Create Cloud Source Regulation Creates a Source-scoped regulation. Please Note: Suppression + * rules at the Workspace level take precedence over those at the Source level. If a user has + * been suppressed at the Workspace level, any attempt to un-suppress at the Source level is not + * supported and the processing of the request will fail in Segment Config API omitted fields: - + * `attributes`, - `userAgent` + * + * @param sourceId (required) + * @param createCloudSourceRegulationV1Input (required) * @return CreateCloudSourceRegulation200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateCloudSourceRegulation200Response createCloudSourceRegulation(String sourceId, CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input) throws ApiException { - ApiResponse localVarResp = createCloudSourceRegulationWithHttpInfo(sourceId, createCloudSourceRegulationV1Input); + public CreateCloudSourceRegulation200Response createCloudSourceRegulation( + String sourceId, CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input) + throws ApiException { + ApiResponse localVarResp = + createCloudSourceRegulationWithHttpInfo( + sourceId, createCloudSourceRegulationV1Input); return localVarResp.getData(); } /** - * Create Cloud Source Regulation - * Creates a Source-scoped regulation. Config API omitted fields: - `attributes`, - `userAgent` - * @param sourceId (required) - * @param createCloudSourceRegulationV1Input (required) + * Create Cloud Source Regulation Creates a Source-scoped regulation. Please Note: Suppression + * rules at the Workspace level take precedence over those at the Source level. If a user has + * been suppressed at the Workspace level, any attempt to un-suppress at the Source level is not + * supported and the processing of the request will fail in Segment Config API omitted fields: - + * `attributes`, - `userAgent` + * + * @param sourceId (required) + * @param createCloudSourceRegulationV1Input (required) * @return ApiResponse<CreateCloudSourceRegulation200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createCloudSourceRegulationWithHttpInfo(String sourceId, CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input) throws ApiException { - okhttp3.Call localVarCall = createCloudSourceRegulationValidateBeforeCall(sourceId, createCloudSourceRegulationV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + createCloudSourceRegulationWithHttpInfo( + String sourceId, + CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input) + throws ApiException { + okhttp3.Call localVarCall = + createCloudSourceRegulationValidateBeforeCall( + sourceId, createCloudSourceRegulationV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Cloud Source Regulation (asynchronously) - * Creates a Source-scoped regulation. Config API omitted fields: - `attributes`, - `userAgent` - * @param sourceId (required) - * @param createCloudSourceRegulationV1Input (required) + * Create Cloud Source Regulation (asynchronously) Creates a Source-scoped regulation. Please + * Note: Suppression rules at the Workspace level take precedence over those at the Source + * level. If a user has been suppressed at the Workspace level, any attempt to un-suppress at + * the Source level is not supported and the processing of the request will fail in Segment + * Config API omitted fields: - `attributes`, - `userAgent` + * + * @param sourceId (required) + * @param createCloudSourceRegulationV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createCloudSourceRegulationAsync(String sourceId, CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createCloudSourceRegulationValidateBeforeCall(sourceId, createCloudSourceRegulationV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createCloudSourceRegulationAsync( + String sourceId, + CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createCloudSourceRegulationValidateBeforeCall( + sourceId, createCloudSourceRegulationV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for createSourceRegulation - * @param sourceId (required) - * @param createSourceRegulationV1Input (required) + * + * @param sourceId (required) + * @param createSourceRegulationV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createSourceRegulationCall(String sourceId, CreateSourceRegulationV1Input createSourceRegulationV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createSourceRegulationCall( + String sourceId, + CreateSourceRegulationV1Input createSourceRegulationV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -266,8 +324,11 @@ public okhttp3.Call createSourceRegulationCall(String sourceId, CreateSourceRegu Object localVarPostBody = createSourceRegulationV1Input; // create path and map variables - String localVarPath = "/regulations/sources/{sourceId}" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/regulations/sources/{sourceId}" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -276,7 +337,10 @@ public okhttp3.Call createSourceRegulationCall(String sourceId, CreateSourceRegu Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -284,127 +348,185 @@ public okhttp3.Call createSourceRegulationCall(String sourceId, CreateSourceRegu } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createSourceRegulationValidateBeforeCall(String sourceId, CreateSourceRegulationV1Input createSourceRegulationV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createSourceRegulationValidateBeforeCall( + String sourceId, + CreateSourceRegulationV1Input createSourceRegulationV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling createSourceRegulation(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " createSourceRegulation(Async)"); } - + // verify the required parameter 'createSourceRegulationV1Input' is set if (createSourceRegulationV1Input == null) { - throw new ApiException("Missing the required parameter 'createSourceRegulationV1Input' when calling createSourceRegulation(Async)"); + throw new ApiException( + "Missing the required parameter 'createSourceRegulationV1Input' when calling" + + " createSourceRegulation(Async)"); } - - - okhttp3.Call localVarCall = createSourceRegulationCall(sourceId, createSourceRegulationV1Input, _callback); - return localVarCall; + return createSourceRegulationCall(sourceId, createSourceRegulationV1Input, _callback); } /** - * Create Source Regulation - * Creates a Source-scoped regulation. When called, this endpoint may generate the `Source Regulation Created` [Audit Trail](/tag/Audit-Trail) event. Config API omitted fields: - `attributes`, - `userAgent` - * @param sourceId (required) - * @param createSourceRegulationV1Input (required) + * Create Source Regulation Creates a Source-scoped regulation. Please Note: Suppression rules + * at the Workspace level take precedence over those at the Source level. If a user has been + * suppressed at the Workspace level, any attempt to un-suppress at the Source level is not + * supported and the processing of the request will fail in Segment • When called, this endpoint + * may generate the `Source Regulation Created` event in the [audit + * trail](/tag/Audit-Trail). Config API omitted fields: - `attributes`, - + * `userAgent` + * + * @param sourceId (required) + * @param createSourceRegulationV1Input (required) * @return CreateSourceRegulation200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateSourceRegulation200Response createSourceRegulation(String sourceId, CreateSourceRegulationV1Input createSourceRegulationV1Input) throws ApiException { - ApiResponse localVarResp = createSourceRegulationWithHttpInfo(sourceId, createSourceRegulationV1Input); + public CreateSourceRegulation200Response createSourceRegulation( + String sourceId, CreateSourceRegulationV1Input createSourceRegulationV1Input) + throws ApiException { + ApiResponse localVarResp = + createSourceRegulationWithHttpInfo(sourceId, createSourceRegulationV1Input); return localVarResp.getData(); } /** - * Create Source Regulation - * Creates a Source-scoped regulation. When called, this endpoint may generate the `Source Regulation Created` [Audit Trail](/tag/Audit-Trail) event. Config API omitted fields: - `attributes`, - `userAgent` - * @param sourceId (required) - * @param createSourceRegulationV1Input (required) + * Create Source Regulation Creates a Source-scoped regulation. Please Note: Suppression rules + * at the Workspace level take precedence over those at the Source level. If a user has been + * suppressed at the Workspace level, any attempt to un-suppress at the Source level is not + * supported and the processing of the request will fail in Segment • When called, this endpoint + * may generate the `Source Regulation Created` event in the [audit + * trail](/tag/Audit-Trail). Config API omitted fields: - `attributes`, - + * `userAgent` + * + * @param sourceId (required) + * @param createSourceRegulationV1Input (required) * @return ApiResponse<CreateSourceRegulation200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createSourceRegulationWithHttpInfo(String sourceId, CreateSourceRegulationV1Input createSourceRegulationV1Input) throws ApiException { - okhttp3.Call localVarCall = createSourceRegulationValidateBeforeCall(sourceId, createSourceRegulationV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse createSourceRegulationWithHttpInfo( + String sourceId, CreateSourceRegulationV1Input createSourceRegulationV1Input) + throws ApiException { + okhttp3.Call localVarCall = + createSourceRegulationValidateBeforeCall( + sourceId, createSourceRegulationV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Source Regulation (asynchronously) - * Creates a Source-scoped regulation. When called, this endpoint may generate the `Source Regulation Created` [Audit Trail](/tag/Audit-Trail) event. Config API omitted fields: - `attributes`, - `userAgent` - * @param sourceId (required) - * @param createSourceRegulationV1Input (required) + * Create Source Regulation (asynchronously) Creates a Source-scoped regulation. Please Note: + * Suppression rules at the Workspace level take precedence over those at the Source level. If a + * user has been suppressed at the Workspace level, any attempt to un-suppress at the Source + * level is not supported and the processing of the request will fail in Segment • When called, + * this endpoint may generate the `Source Regulation Created` event in the [audit + * trail](/tag/Audit-Trail). Config API omitted fields: - `attributes`, - + * `userAgent` + * + * @param sourceId (required) + * @param createSourceRegulationV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createSourceRegulationAsync(String sourceId, CreateSourceRegulationV1Input createSourceRegulationV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createSourceRegulationValidateBeforeCall(sourceId, createSourceRegulationV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createSourceRegulationAsync( + String sourceId, + CreateSourceRegulationV1Input createSourceRegulationV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createSourceRegulationValidateBeforeCall( + sourceId, createSourceRegulationV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for createWorkspaceRegulation - * @param createWorkspaceRegulationV1Input (required) + * + * @param createWorkspaceRegulationV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createWorkspaceRegulationCall(CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createWorkspaceRegulationCall( + CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -422,7 +544,10 @@ public okhttp3.Call createWorkspaceRegulationCall(CreateWorkspaceRegulationV1Inp Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -430,119 +555,164 @@ public okhttp3.Call createWorkspaceRegulationCall(CreateWorkspaceRegulationV1Inp } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createWorkspaceRegulationValidateBeforeCall(CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createWorkspaceRegulationValidateBeforeCall( + CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'createWorkspaceRegulationV1Input' is set if (createWorkspaceRegulationV1Input == null) { - throw new ApiException("Missing the required parameter 'createWorkspaceRegulationV1Input' when calling createWorkspaceRegulation(Async)"); + throw new ApiException( + "Missing the required parameter 'createWorkspaceRegulationV1Input' when calling" + + " createWorkspaceRegulation(Async)"); } - - - okhttp3.Call localVarCall = createWorkspaceRegulationCall(createWorkspaceRegulationV1Input, _callback); - return localVarCall; + return createWorkspaceRegulationCall(createWorkspaceRegulationV1Input, _callback); } /** - * Create Workspace Regulation - * Creates a Workspace-scoped regulation. When called, this endpoint may generate the `Workspace Regulation Created` [Audit Trail](/tag/Audit-Trail) event. Config API omitted fields: - `attributes`, - `userAgent` - * @param createWorkspaceRegulationV1Input (required) + * Create Workspace Regulation Creates a Workspace-scoped regulation. • When called, this + * endpoint may generate the `Workspace Regulation Created` event in the [audit + * trail](/tag/Audit-Trail). Config API omitted fields: - `attributes`, - + * `userAgent` + * + * @param createWorkspaceRegulationV1Input (required) * @return CreateWorkspaceRegulation200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateWorkspaceRegulation200Response createWorkspaceRegulation(CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input) throws ApiException { - ApiResponse localVarResp = createWorkspaceRegulationWithHttpInfo(createWorkspaceRegulationV1Input); + public CreateWorkspaceRegulation200Response createWorkspaceRegulation( + CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input) throws ApiException { + ApiResponse localVarResp = + createWorkspaceRegulationWithHttpInfo(createWorkspaceRegulationV1Input); return localVarResp.getData(); } /** - * Create Workspace Regulation - * Creates a Workspace-scoped regulation. When called, this endpoint may generate the `Workspace Regulation Created` [Audit Trail](/tag/Audit-Trail) event. Config API omitted fields: - `attributes`, - `userAgent` - * @param createWorkspaceRegulationV1Input (required) + * Create Workspace Regulation Creates a Workspace-scoped regulation. • When called, this + * endpoint may generate the `Workspace Regulation Created` event in the [audit + * trail](/tag/Audit-Trail). Config API omitted fields: - `attributes`, - + * `userAgent` + * + * @param createWorkspaceRegulationV1Input (required) * @return ApiResponse<CreateWorkspaceRegulation200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createWorkspaceRegulationWithHttpInfo(CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input) throws ApiException { - okhttp3.Call localVarCall = createWorkspaceRegulationValidateBeforeCall(createWorkspaceRegulationV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse createWorkspaceRegulationWithHttpInfo( + CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input) throws ApiException { + okhttp3.Call localVarCall = + createWorkspaceRegulationValidateBeforeCall(createWorkspaceRegulationV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Workspace Regulation (asynchronously) - * Creates a Workspace-scoped regulation. When called, this endpoint may generate the `Workspace Regulation Created` [Audit Trail](/tag/Audit-Trail) event. Config API omitted fields: - `attributes`, - `userAgent` - * @param createWorkspaceRegulationV1Input (required) + * Create Workspace Regulation (asynchronously) Creates a Workspace-scoped regulation. • When + * called, this endpoint may generate the `Workspace Regulation Created` event in the + * [audit trail](/tag/Audit-Trail). Config API omitted fields: - `attributes`, - + * `userAgent` + * + * @param createWorkspaceRegulationV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createWorkspaceRegulationAsync(CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createWorkspaceRegulationValidateBeforeCall(createWorkspaceRegulationV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createWorkspaceRegulationAsync( + CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createWorkspaceRegulationValidateBeforeCall( + createWorkspaceRegulationV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for deleteRegulation - * @param regulateId (required) + * + * @param regulateId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * @deprecated */ - public okhttp3.Call deleteRegulationCall(String regulateId, final ApiCallback _callback) throws ApiException { + @Deprecated + public okhttp3.Call deleteRegulationCall(String regulateId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -551,8 +721,11 @@ public okhttp3.Call deleteRegulationCall(String regulateId, final ApiCallback _c Object localVarPostBody = null; // create path and map variables - String localVarPath = "/regulations/{regulateId}" - .replaceAll("\\{" + "regulateId" + "\\}", localVarApiClient.escapeString(regulateId.toString())); + String localVarPath = + "/regulations/{regulateId}" + .replace( + "{" + "regulateId" + "}", + localVarApiClient.escapeString(regulateId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -561,127 +734,171 @@ public okhttp3.Call deleteRegulationCall(String regulateId, final ApiCallback _c Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } + @Deprecated @SuppressWarnings("rawtypes") - private okhttp3.Call deleteRegulationValidateBeforeCall(String regulateId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call deleteRegulationValidateBeforeCall( + String regulateId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'regulateId' is set if (regulateId == null) { - throw new ApiException("Missing the required parameter 'regulateId' when calling deleteRegulation(Async)"); + throw new ApiException( + "Missing the required parameter 'regulateId' when calling" + + " deleteRegulation(Async)"); } - - - okhttp3.Call localVarCall = deleteRegulationCall(regulateId, _callback); - return localVarCall; + return deleteRegulationCall(regulateId, _callback); } /** - * Delete Regulation - * Deletes a regulation from the Workspace. The regulation must be in the initialized state to be deleted. When called, this endpoint may generate the `Regulation Deleted` [Audit Trail](/tag/Audit-Trail) event. - * @param regulateId (required) + * Delete Regulation Deletes a regulation from the Workspace. The regulation must be in the + * initialized state to be deleted. • When called, this endpoint may generate the + * `Regulation Deleted` event in the [audit trail](/tag/Audit-Trail). **DEPRECATED**: + * this endpoint has been deprecated according to the guidelines, and may experience reduced SLA + * guarantees. + * + * @param regulateId (required) * @return DeleteRegulation200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * @deprecated */ + @Deprecated public DeleteRegulation200Response deleteRegulation(String regulateId) throws ApiException { - ApiResponse localVarResp = deleteRegulationWithHttpInfo(regulateId); + ApiResponse localVarResp = + deleteRegulationWithHttpInfo(regulateId); return localVarResp.getData(); } /** - * Delete Regulation - * Deletes a regulation from the Workspace. The regulation must be in the initialized state to be deleted. When called, this endpoint may generate the `Regulation Deleted` [Audit Trail](/tag/Audit-Trail) event. - * @param regulateId (required) + * Delete Regulation Deletes a regulation from the Workspace. The regulation must be in the + * initialized state to be deleted. • When called, this endpoint may generate the + * `Regulation Deleted` event in the [audit trail](/tag/Audit-Trail). **DEPRECATED**: + * this endpoint has been deprecated according to the guidelines, and may experience reduced SLA + * guarantees. + * + * @param regulateId (required) * @return ApiResponse<DeleteRegulation200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * @deprecated */ - public ApiResponse deleteRegulationWithHttpInfo(String regulateId) throws ApiException { + @Deprecated + public ApiResponse deleteRegulationWithHttpInfo(String regulateId) + throws ApiException { okhttp3.Call localVarCall = deleteRegulationValidateBeforeCall(regulateId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Delete Regulation (asynchronously) - * Deletes a regulation from the Workspace. The regulation must be in the initialized state to be deleted. When called, this endpoint may generate the `Regulation Deleted` [Audit Trail](/tag/Audit-Trail) event. - * @param regulateId (required) + * Delete Regulation (asynchronously) Deletes a regulation from the Workspace. The regulation + * must be in the initialized state to be deleted. • When called, this endpoint may generate the + * `Regulation Deleted` event in the [audit trail](/tag/Audit-Trail). **DEPRECATED**: + * this endpoint has been deprecated according to the guidelines, and may experience reduced SLA + * guarantees. + * + * @param regulateId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * @deprecated */ - public okhttp3.Call deleteRegulationAsync(String regulateId, final ApiCallback _callback) throws ApiException { + @Deprecated + public okhttp3.Call deleteRegulationAsync( + String regulateId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = deleteRegulationValidateBeforeCall(regulateId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getRegulation - * @param regulateId (required) + * + * @param regulateId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getRegulationCall(String regulateId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getRegulationCall(String regulateId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -690,8 +907,11 @@ public okhttp3.Call getRegulationCall(String regulateId, final ApiCallback _call Object localVarPostBody = null; // create path and map variables - String localVarPath = "/regulations/{regulateId}" - .replaceAll("\\{" + "regulateId" + "\\}", localVarApiClient.escapeString(regulateId.toString())); + String localVarPath = + "/regulations/{regulateId}" + .replace( + "{" + "regulateId" + "}", + localVarApiClient.escapeString(regulateId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -700,53 +920,67 @@ public okhttp3.Call getRegulationCall(String regulateId, final ApiCallback _call Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getRegulationValidateBeforeCall(String regulateId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getRegulationValidateBeforeCall( + String regulateId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'regulateId' is set if (regulateId == null) { - throw new ApiException("Missing the required parameter 'regulateId' when calling getRegulation(Async)"); + throw new ApiException( + "Missing the required parameter 'regulateId' when calling" + + " getRegulation(Async)"); } - - - okhttp3.Call localVarCall = getRegulationCall(regulateId, _callback); - return localVarCall; + return getRegulationCall(regulateId, _callback); } /** - * Get Regulation - * Gets a regulation from the Workspace. Config API omitted fields: - `parent` - * @param regulateId (required) + * Get Regulation Gets a regulation from the Workspace. Config API omitted fields: - + * `parent` + * + * @param regulateId (required) * @return GetRegulation200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public GetRegulation200Response getRegulation(String regulateId) throws ApiException { ApiResponse localVarResp = getRegulationWithHttpInfo(regulateId); @@ -754,76 +988,93 @@ public GetRegulation200Response getRegulation(String regulateId) throws ApiExcep } /** - * Get Regulation - * Gets a regulation from the Workspace. Config API omitted fields: - `parent` - * @param regulateId (required) + * Get Regulation Gets a regulation from the Workspace. Config API omitted fields: - + * `parent` + * + * @param regulateId (required) * @return ApiResponse<GetRegulation200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getRegulationWithHttpInfo(String regulateId) throws ApiException { + public ApiResponse getRegulationWithHttpInfo(String regulateId) + throws ApiException { okhttp3.Call localVarCall = getRegulationValidateBeforeCall(regulateId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Regulation (asynchronously) - * Gets a regulation from the Workspace. Config API omitted fields: - `parent` - * @param regulateId (required) + * Get Regulation (asynchronously) Gets a regulation from the Workspace. Config API omitted + * fields: - `parent` + * + * @param regulateId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getRegulationAsync(String regulateId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getRegulationAsync( + String regulateId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = getRegulationValidateBeforeCall(regulateId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listRegulationsFromSource - * @param sourceId (required) - * @param pagination Pagination parameters. This parameter exists in alpha. (required) - * @param status The status on which to filter returned regulations. This parameter exists in alpha. (optional) - * @param regulationTypes The regulation types on which to filter returned regulations. This parameter exists in alpha. (optional) + * + * @param sourceId (required) + * @param status The status on which to filter returned regulations. This parameter exists in + * v1. (optional) + * @param regulationTypes The regulation types on which to filter returned regulations. This + * parameter exists in v1. (optional) + * @param pagination Pagination parameters. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listRegulationsFromSourceCall(String sourceId, PaginationInput pagination, String status, List regulationTypes, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listRegulationsFromSourceCall( + String sourceId, + String status, + List regulationTypes, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -832,8 +1083,11 @@ public okhttp3.Call listRegulationsFromSourceCall(String sourceId, PaginationInp Object localVarPostBody = null; // create path and map variables - String localVarPath = "/regulations/sources/{sourceId}" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/regulations/sources/{sourceId}" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -846,7 +1100,9 @@ public okhttp3.Call listRegulationsFromSourceCall(String sourceId, PaginationInp } if (regulationTypes != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "regulationTypes", regulationTypes)); + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs( + "multi", "regulationTypes", regulationTypes)); } if (pagination != null) { @@ -854,141 +1110,190 @@ public okhttp3.Call listRegulationsFromSourceCall(String sourceId, PaginationInp } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listRegulationsFromSourceValidateBeforeCall(String sourceId, PaginationInput pagination, String status, List regulationTypes, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listRegulationsFromSourceValidateBeforeCall( + String sourceId, + String status, + List regulationTypes, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling listRegulationsFromSource(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " listRegulationsFromSource(Async)"); } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listRegulationsFromSource(Async)"); - } - - - okhttp3.Call localVarCall = listRegulationsFromSourceCall(sourceId, pagination, status, regulationTypes, _callback); - return localVarCall; + return listRegulationsFromSourceCall( + sourceId, status, regulationTypes, pagination, _callback); } /** - * List Regulations from Source - * Lists all Source-scoped regulations. - * @param sourceId (required) - * @param pagination Pagination parameters. This parameter exists in alpha. (required) - * @param status The status on which to filter returned regulations. This parameter exists in alpha. (optional) - * @param regulationTypes The regulation types on which to filter returned regulations. This parameter exists in alpha. (optional) + * List Regulations from Source Lists all Source-scoped regulations. + * + * @param sourceId (required) + * @param status The status on which to filter returned regulations. This parameter exists in + * v1. (optional) + * @param regulationTypes The regulation types on which to filter returned regulations. This + * parameter exists in v1. (optional) + * @param pagination Pagination parameters. This parameter exists in v1. (optional) * @return ListRegulationsFromSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListRegulationsFromSource200Response listRegulationsFromSource(String sourceId, PaginationInput pagination, String status, List regulationTypes) throws ApiException { - ApiResponse localVarResp = listRegulationsFromSourceWithHttpInfo(sourceId, pagination, status, regulationTypes); + public ListRegulationsFromSource200Response listRegulationsFromSource( + String sourceId, + String status, + List regulationTypes, + PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listRegulationsFromSourceWithHttpInfo( + sourceId, status, regulationTypes, pagination); return localVarResp.getData(); } /** - * List Regulations from Source - * Lists all Source-scoped regulations. - * @param sourceId (required) - * @param pagination Pagination parameters. This parameter exists in alpha. (required) - * @param status The status on which to filter returned regulations. This parameter exists in alpha. (optional) - * @param regulationTypes The regulation types on which to filter returned regulations. This parameter exists in alpha. (optional) + * List Regulations from Source Lists all Source-scoped regulations. + * + * @param sourceId (required) + * @param status The status on which to filter returned regulations. This parameter exists in + * v1. (optional) + * @param regulationTypes The regulation types on which to filter returned regulations. This + * parameter exists in v1. (optional) + * @param pagination Pagination parameters. This parameter exists in v1. (optional) * @return ApiResponse<ListRegulationsFromSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listRegulationsFromSourceWithHttpInfo(String sourceId, PaginationInput pagination, String status, List regulationTypes) throws ApiException { - okhttp3.Call localVarCall = listRegulationsFromSourceValidateBeforeCall(sourceId, pagination, status, regulationTypes, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse listRegulationsFromSourceWithHttpInfo( + String sourceId, + String status, + List regulationTypes, + PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + listRegulationsFromSourceValidateBeforeCall( + sourceId, status, regulationTypes, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Regulations from Source (asynchronously) - * Lists all Source-scoped regulations. - * @param sourceId (required) - * @param pagination Pagination parameters. This parameter exists in alpha. (required) - * @param status The status on which to filter returned regulations. This parameter exists in alpha. (optional) - * @param regulationTypes The regulation types on which to filter returned regulations. This parameter exists in alpha. (optional) + * List Regulations from Source (asynchronously) Lists all Source-scoped regulations. + * + * @param sourceId (required) + * @param status The status on which to filter returned regulations. This parameter exists in + * v1. (optional) + * @param regulationTypes The regulation types on which to filter returned regulations. This + * parameter exists in v1. (optional) + * @param pagination Pagination parameters. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listRegulationsFromSourceAsync(String sourceId, PaginationInput pagination, String status, List regulationTypes, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listRegulationsFromSourceValidateBeforeCall(sourceId, pagination, status, regulationTypes, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listRegulationsFromSourceAsync( + String sourceId, + String status, + List regulationTypes, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listRegulationsFromSourceValidateBeforeCall( + sourceId, status, regulationTypes, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listSuppressions - * @param pagination Pagination parameters. This parameter exists in alpha. (required) + * + * @param pagination Pagination parameters. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSuppressionsCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listSuppressionsCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1010,129 +1315,151 @@ public okhttp3.Call listSuppressionsCall(PaginationInput pagination, final ApiCa } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listSuppressionsValidateBeforeCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listSuppressions(Async)"); - } - - - okhttp3.Call localVarCall = listSuppressionsCall(pagination, _callback); - return localVarCall; - + private okhttp3.Call listSuppressionsValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return listSuppressionsCall(pagination, _callback); } /** - * List Suppressions - * Lists all suppressions in a given Workspace. - * @param pagination Pagination parameters. This parameter exists in alpha. (required) + * List Suppressions Lists all suppressions in a given Workspace. + * + * @param pagination Pagination parameters. This parameter exists in v1. (optional) * @return ListSuppressions200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListSuppressions200Response listSuppressions(PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listSuppressionsWithHttpInfo(pagination); + public ListSuppressions200Response listSuppressions(PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listSuppressionsWithHttpInfo(pagination); return localVarResp.getData(); } /** - * List Suppressions - * Lists all suppressions in a given Workspace. - * @param pagination Pagination parameters. This parameter exists in alpha. (required) + * List Suppressions Lists all suppressions in a given Workspace. + * + * @param pagination Pagination parameters. This parameter exists in v1. (optional) * @return ApiResponse<ListSuppressions200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listSuppressionsWithHttpInfo(PaginationInput pagination) throws ApiException { + public ApiResponse listSuppressionsWithHttpInfo( + PaginationInput pagination) throws ApiException { okhttp3.Call localVarCall = listSuppressionsValidateBeforeCall(pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Suppressions (asynchronously) - * Lists all suppressions in a given Workspace. - * @param pagination Pagination parameters. This parameter exists in alpha. (required) + * List Suppressions (asynchronously) Lists all suppressions in a given Workspace. + * + * @param pagination Pagination parameters. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSuppressionsAsync(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listSuppressionsAsync( + PaginationInput pagination, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = listSuppressionsValidateBeforeCall(pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listWorkspaceRegulations - * @param pagination Pagination parameters. This parameter exists in alpha. (required) - * @param status The status on which to filter the returned regulations. This parameter exists in alpha. (optional) - * @param regulationTypes The regulation types on which to filter returned regulations. This parameter exists in alpha. (optional) + * + * @param status The status on which to filter the returned regulations. This parameter exists + * in v1. (optional) + * @param regulationTypes The regulation types on which to filter returned regulations. This + * parameter exists in v1. (optional) + * @param pagination Pagination parameters. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listWorkspaceRegulationsCall(PaginationInput pagination, String status, List regulationTypes, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listWorkspaceRegulationsCall( + String status, + List regulationTypes, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1154,7 +1481,9 @@ public okhttp3.Call listWorkspaceRegulationsCall(PaginationInput pagination, Str } if (regulationTypes != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "regulationTypes", regulationTypes)); + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs( + "multi", "regulationTypes", regulationTypes)); } if (pagination != null) { @@ -1162,106 +1491,138 @@ public okhttp3.Call listWorkspaceRegulationsCall(PaginationInput pagination, Str } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listWorkspaceRegulationsValidateBeforeCall(PaginationInput pagination, String status, List regulationTypes, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listWorkspaceRegulations(Async)"); - } - - - okhttp3.Call localVarCall = listWorkspaceRegulationsCall(pagination, status, regulationTypes, _callback); - return localVarCall; - + private okhttp3.Call listWorkspaceRegulationsValidateBeforeCall( + String status, + List regulationTypes, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + return listWorkspaceRegulationsCall(status, regulationTypes, pagination, _callback); } /** - * List Workspace Regulations - * Lists all Workspace-scoped regulations. - * @param pagination Pagination parameters. This parameter exists in alpha. (required) - * @param status The status on which to filter the returned regulations. This parameter exists in alpha. (optional) - * @param regulationTypes The regulation types on which to filter returned regulations. This parameter exists in alpha. (optional) + * List Workspace Regulations Lists all Workspace-scoped regulations. + * + * @param status The status on which to filter the returned regulations. This parameter exists + * in v1. (optional) + * @param regulationTypes The regulation types on which to filter returned regulations. This + * parameter exists in v1. (optional) + * @param pagination Pagination parameters. This parameter exists in v1. (optional) * @return ListWorkspaceRegulations200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListWorkspaceRegulations200Response listWorkspaceRegulations(PaginationInput pagination, String status, List regulationTypes) throws ApiException { - ApiResponse localVarResp = listWorkspaceRegulationsWithHttpInfo(pagination, status, regulationTypes); + public ListWorkspaceRegulations200Response listWorkspaceRegulations( + String status, List regulationTypes, PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listWorkspaceRegulationsWithHttpInfo(status, regulationTypes, pagination); return localVarResp.getData(); } /** - * List Workspace Regulations - * Lists all Workspace-scoped regulations. - * @param pagination Pagination parameters. This parameter exists in alpha. (required) - * @param status The status on which to filter the returned regulations. This parameter exists in alpha. (optional) - * @param regulationTypes The regulation types on which to filter returned regulations. This parameter exists in alpha. (optional) + * List Workspace Regulations Lists all Workspace-scoped regulations. + * + * @param status The status on which to filter the returned regulations. This parameter exists + * in v1. (optional) + * @param regulationTypes The regulation types on which to filter returned regulations. This + * parameter exists in v1. (optional) + * @param pagination Pagination parameters. This parameter exists in v1. (optional) * @return ApiResponse<ListWorkspaceRegulations200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listWorkspaceRegulationsWithHttpInfo(PaginationInput pagination, String status, List regulationTypes) throws ApiException { - okhttp3.Call localVarCall = listWorkspaceRegulationsValidateBeforeCall(pagination, status, regulationTypes, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse listWorkspaceRegulationsWithHttpInfo( + String status, List regulationTypes, PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + listWorkspaceRegulationsValidateBeforeCall( + status, regulationTypes, pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Workspace Regulations (asynchronously) - * Lists all Workspace-scoped regulations. - * @param pagination Pagination parameters. This parameter exists in alpha. (required) - * @param status The status on which to filter the returned regulations. This parameter exists in alpha. (optional) - * @param regulationTypes The regulation types on which to filter returned regulations. This parameter exists in alpha. (optional) + * List Workspace Regulations (asynchronously) Lists all Workspace-scoped regulations. + * + * @param status The status on which to filter the returned regulations. This parameter exists + * in v1. (optional) + * @param regulationTypes The regulation types on which to filter returned regulations. This + * parameter exists in v1. (optional) + * @param pagination Pagination parameters. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listWorkspaceRegulationsAsync(PaginationInput pagination, String status, List regulationTypes, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listWorkspaceRegulationsValidateBeforeCall(pagination, status, regulationTypes, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listWorkspaceRegulationsAsync( + String status, + List regulationTypes, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listWorkspaceRegulationsValidateBeforeCall( + status, regulationTypes, pagination, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/DeliveryOverviewApi.java b/src/main/java/com/segment/publicapi/api/DeliveryOverviewApi.java new file mode 100644 index 00000000..236e3df9 --- /dev/null +++ b/src/main/java/com/segment/publicapi/api/DeliveryOverviewApi.java @@ -0,0 +1,2318 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.api; + +import com.google.gson.reflect.TypeToken; +import com.segment.publicapi.ApiCallback; +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.ApiResponse; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.Pair; +import com.segment.publicapi.models.DeliveryOverviewDestinationFilterBy; +import com.segment.publicapi.models.DeliveryOverviewSourceFilterBy; +import com.segment.publicapi.models.DeliveryOverviewSuccessfullyReceivedFilterBy; +import com.segment.publicapi.models.GetEgressFailedMetricsFromDeliveryOverview200Response; +import com.segment.publicapi.models.PaginationInput; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DeliveryOverviewApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DeliveryOverviewApi() { + this(Configuration.getDefaultApiClient()); + } + + public DeliveryOverviewApi(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 getEgressFailedMetricsFromDeliveryOverview + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param destinationConfigId The id tied to a Workspace Destination. This parameter exists in + * beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and `spaceId`. This parameter + * exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and/or `spaceId` that can be + * applied in addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in beta. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getEgressFailedMetricsFromDeliveryOverviewCall( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination, + 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 = "/delivery-overview/failed-delivery"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (sourceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sourceId", sourceId)); + } + + if (destinationConfigId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("destinationConfigId", destinationConfigId)); + } + + if (startTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startTime", startTime)); + } + + if (endTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endTime", endTime)); + } + + if (groupBy != null) { + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "groupBy", groupBy)); + } + + if (granularity != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("granularity", granularity)); + } + + if (filter != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter", filter)); + } + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1beta+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getEgressFailedMetricsFromDeliveryOverviewValidateBeforeCall( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'sourceId' is set + if (sourceId == null) { + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " getEgressFailedMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'destinationConfigId' is set + if (destinationConfigId == null) { + throw new ApiException( + "Missing the required parameter 'destinationConfigId' when calling" + + " getEgressFailedMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'startTime' is set + if (startTime == null) { + throw new ApiException( + "Missing the required parameter 'startTime' when calling" + + " getEgressFailedMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'endTime' is set + if (endTime == null) { + throw new ApiException( + "Missing the required parameter 'endTime' when calling" + + " getEgressFailedMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'granularity' is set + if (granularity == null) { + throw new ApiException( + "Missing the required parameter 'granularity' when calling" + + " getEgressFailedMetricsFromDeliveryOverview(Async)"); + } + + return getEgressFailedMetricsFromDeliveryOverviewCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + _callback); + } + + /** + * Get Egress Failed Metrics from Delivery Overview Get events that failed to be delivered to + * Destination. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param destinationConfigId The id tied to a Workspace Destination. This parameter exists in + * beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and `spaceId`. This parameter + * exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and/or `spaceId` that can be + * applied in addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in beta. + * (optional) + * @return GetEgressFailedMetricsFromDeliveryOverview200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetEgressFailedMetricsFromDeliveryOverview200Response + getEgressFailedMetricsFromDeliveryOverview( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + getEgressFailedMetricsFromDeliveryOverviewWithHttpInfo( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination); + return localVarResp.getData(); + } + + /** + * Get Egress Failed Metrics from Delivery Overview Get events that failed to be delivered to + * Destination. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param destinationConfigId The id tied to a Workspace Destination. This parameter exists in + * beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and `spaceId`. This parameter + * exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and/or `spaceId` that can be + * applied in addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in beta. + * (optional) + * @return ApiResponse<GetEgressFailedMetricsFromDeliveryOverview200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getEgressFailedMetricsFromDeliveryOverviewWithHttpInfo( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + getEgressFailedMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Egress Failed Metrics from Delivery Overview (asynchronously) Get events that failed to + * be delivered to Destination. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param destinationConfigId The id tied to a Workspace Destination. This parameter exists in + * beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and `spaceId`. This parameter + * exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and/or `spaceId` that can be + * applied in addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in beta. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getEgressFailedMetricsFromDeliveryOverviewAsync( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getEgressFailedMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getEgressSuccessMetricsFromDeliveryOverview + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param destinationConfigId The id tied to a Workspace Destination. This parameter exists in + * beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and `spaceId`. This parameter + * exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, `appVersion`, `subscription Id`, + * `activationId`, `audienceId`, or `spaceId` that can be + * applied in addition to a `group By`. If you would like to view retry attempts + * for a successful delivery, you can filter `discard Reason` from + * `successes.attempt.1` through `successes.attempt.10`. This parameter + * exists in beta. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in beta. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getEgressSuccessMetricsFromDeliveryOverviewCall( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination, + 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 = "/delivery-overview/successful-delivery"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (sourceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sourceId", sourceId)); + } + + if (destinationConfigId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("destinationConfigId", destinationConfigId)); + } + + if (startTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startTime", startTime)); + } + + if (endTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endTime", endTime)); + } + + if (groupBy != null) { + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "groupBy", groupBy)); + } + + if (granularity != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("granularity", granularity)); + } + + if (filter != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter", filter)); + } + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1beta+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getEgressSuccessMetricsFromDeliveryOverviewValidateBeforeCall( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'sourceId' is set + if (sourceId == null) { + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " getEgressSuccessMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'destinationConfigId' is set + if (destinationConfigId == null) { + throw new ApiException( + "Missing the required parameter 'destinationConfigId' when calling" + + " getEgressSuccessMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'startTime' is set + if (startTime == null) { + throw new ApiException( + "Missing the required parameter 'startTime' when calling" + + " getEgressSuccessMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'endTime' is set + if (endTime == null) { + throw new ApiException( + "Missing the required parameter 'endTime' when calling" + + " getEgressSuccessMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'granularity' is set + if (granularity == null) { + throw new ApiException( + "Missing the required parameter 'granularity' when calling" + + " getEgressSuccessMetricsFromDeliveryOverview(Async)"); + } + + return getEgressSuccessMetricsFromDeliveryOverviewCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + _callback); + } + + /** + * Get Egress Success Metrics from Delivery Overview Get events successfully delivered to + * Destination. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param destinationConfigId The id tied to a Workspace Destination. This parameter exists in + * beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and `spaceId`. This parameter + * exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, `appVersion`, `subscription Id`, + * `activationId`, `audienceId`, or `spaceId` that can be + * applied in addition to a `group By`. If you would like to view retry attempts + * for a successful delivery, you can filter `discard Reason` from + * `successes.attempt.1` through `successes.attempt.10`. This parameter + * exists in beta. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in beta. + * (optional) + * @return GetEgressFailedMetricsFromDeliveryOverview200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetEgressFailedMetricsFromDeliveryOverview200Response + getEgressSuccessMetricsFromDeliveryOverview( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + getEgressSuccessMetricsFromDeliveryOverviewWithHttpInfo( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination); + return localVarResp.getData(); + } + + /** + * Get Egress Success Metrics from Delivery Overview Get events successfully delivered to + * Destination. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param destinationConfigId The id tied to a Workspace Destination. This parameter exists in + * beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and `spaceId`. This parameter + * exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, `appVersion`, `subscription Id`, + * `activationId`, `audienceId`, or `spaceId` that can be + * applied in addition to a `group By`. If you would like to view retry attempts + * for a successful delivery, you can filter `discard Reason` from + * `successes.attempt.1` through `successes.attempt.10`. This parameter + * exists in beta. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in beta. + * (optional) + * @return ApiResponse<GetEgressFailedMetricsFromDeliveryOverview200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getEgressSuccessMetricsFromDeliveryOverviewWithHttpInfo( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + getEgressSuccessMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Egress Success Metrics from Delivery Overview (asynchronously) Get events successfully + * delivered to Destination. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param destinationConfigId The id tied to a Workspace Destination. This parameter exists in + * beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and `spaceId`. This parameter + * exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, `appVersion`, `subscription Id`, + * `activationId`, `audienceId`, or `spaceId` that can be + * applied in addition to a `group By`. If you would like to view retry attempts + * for a successful delivery, you can filter `discard Reason` from + * `successes.attempt.1` through `successes.attempt.10`. This parameter + * exists in beta. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in beta. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getEgressSuccessMetricsFromDeliveryOverviewAsync( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getEgressSuccessMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getFilteredAtDestinationMetricsFromDeliveryOverview + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param destinationConfigId The id tied to a Workspace Destination. This parameter exists in + * beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and `spaceId`. This parameter + * exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and/or `spaceId` that can be + * applied in addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in beta. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getFilteredAtDestinationMetricsFromDeliveryOverviewCall( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination, + 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 = "/delivery-overview/filtered-at-destination"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (sourceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sourceId", sourceId)); + } + + if (destinationConfigId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("destinationConfigId", destinationConfigId)); + } + + if (startTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startTime", startTime)); + } + + if (endTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endTime", endTime)); + } + + if (groupBy != null) { + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "groupBy", groupBy)); + } + + if (granularity != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("granularity", granularity)); + } + + if (filter != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter", filter)); + } + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1beta+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFilteredAtDestinationMetricsFromDeliveryOverviewValidateBeforeCall( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'sourceId' is set + if (sourceId == null) { + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " getFilteredAtDestinationMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'destinationConfigId' is set + if (destinationConfigId == null) { + throw new ApiException( + "Missing the required parameter 'destinationConfigId' when calling" + + " getFilteredAtDestinationMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'startTime' is set + if (startTime == null) { + throw new ApiException( + "Missing the required parameter 'startTime' when calling" + + " getFilteredAtDestinationMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'endTime' is set + if (endTime == null) { + throw new ApiException( + "Missing the required parameter 'endTime' when calling" + + " getFilteredAtDestinationMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'granularity' is set + if (granularity == null) { + throw new ApiException( + "Missing the required parameter 'granularity' when calling" + + " getFilteredAtDestinationMetricsFromDeliveryOverview(Async)"); + } + + return getFilteredAtDestinationMetricsFromDeliveryOverviewCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + _callback); + } + + /** + * Get Filtered At Destination Metrics from Delivery Overview Get events that were filtered at + * Destination. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param destinationConfigId The id tied to a Workspace Destination. This parameter exists in + * beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and `spaceId`. This parameter + * exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and/or `spaceId` that can be + * applied in addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in beta. + * (optional) + * @return GetEgressFailedMetricsFromDeliveryOverview200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetEgressFailedMetricsFromDeliveryOverview200Response + getFilteredAtDestinationMetricsFromDeliveryOverview( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + getFilteredAtDestinationMetricsFromDeliveryOverviewWithHttpInfo( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination); + return localVarResp.getData(); + } + + /** + * Get Filtered At Destination Metrics from Delivery Overview Get events that were filtered at + * Destination. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param destinationConfigId The id tied to a Workspace Destination. This parameter exists in + * beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and `spaceId`. This parameter + * exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and/or `spaceId` that can be + * applied in addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in beta. + * (optional) + * @return ApiResponse<GetEgressFailedMetricsFromDeliveryOverview200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getFilteredAtDestinationMetricsFromDeliveryOverviewWithHttpInfo( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + getFilteredAtDestinationMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Filtered At Destination Metrics from Delivery Overview (asynchronously) Get events that + * were filtered at Destination. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param destinationConfigId The id tied to a Workspace Destination. This parameter exists in + * beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and `spaceId`. This parameter + * exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, `app Version`, `subscription Id`, + * `activationId`, `audienceId`, and/or `spaceId` that can be + * applied in addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Params to specify the page cursor and count. This parameter exists in beta. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getFilteredAtDestinationMetricsFromDeliveryOverviewAsync( + String sourceId, + String destinationConfigId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewDestinationFilterBy filter, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getFilteredAtDestinationMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + destinationConfigId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getFilteredAtSourceMetricsFromDeliveryOverview + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, and `app Version`. This parameter exists in beta. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, and/or `app Version` that can be applied in + * addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in beta. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getFilteredAtSourceMetricsFromDeliveryOverviewCall( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSourceFilterBy filter, + PaginationInput pagination, + 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 = "/delivery-overview/filtered-at-source"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (sourceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sourceId", sourceId)); + } + + if (startTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startTime", startTime)); + } + + if (endTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endTime", endTime)); + } + + if (groupBy != null) { + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "groupBy", groupBy)); + } + + if (granularity != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("granularity", granularity)); + } + + if (filter != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter", filter)); + } + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1beta+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFilteredAtSourceMetricsFromDeliveryOverviewValidateBeforeCall( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSourceFilterBy filter, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'sourceId' is set + if (sourceId == null) { + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " getFilteredAtSourceMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'startTime' is set + if (startTime == null) { + throw new ApiException( + "Missing the required parameter 'startTime' when calling" + + " getFilteredAtSourceMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'endTime' is set + if (endTime == null) { + throw new ApiException( + "Missing the required parameter 'endTime' when calling" + + " getFilteredAtSourceMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'granularity' is set + if (granularity == null) { + throw new ApiException( + "Missing the required parameter 'granularity' when calling" + + " getFilteredAtSourceMetricsFromDeliveryOverview(Async)"); + } + + return getFilteredAtSourceMetricsFromDeliveryOverviewCall( + sourceId, startTime, endTime, groupBy, granularity, filter, pagination, _callback); + } + + /** + * Get Filtered At Source Metrics from Delivery Overview Get events that were filtered at + * Source. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, and `app Version`. This parameter exists in beta. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, and/or `app Version` that can be applied in + * addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in beta. (optional) + * @return GetEgressFailedMetricsFromDeliveryOverview200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetEgressFailedMetricsFromDeliveryOverview200Response + getFilteredAtSourceMetricsFromDeliveryOverview( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSourceFilterBy filter, + PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + getFilteredAtSourceMetricsFromDeliveryOverviewWithHttpInfo( + sourceId, startTime, endTime, groupBy, granularity, filter, pagination); + return localVarResp.getData(); + } + + /** + * Get Filtered At Source Metrics from Delivery Overview Get events that were filtered at + * Source. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, and `app Version`. This parameter exists in beta. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, and/or `app Version` that can be applied in + * addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in beta. (optional) + * @return ApiResponse<GetEgressFailedMetricsFromDeliveryOverview200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getFilteredAtSourceMetricsFromDeliveryOverviewWithHttpInfo( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSourceFilterBy filter, + PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + getFilteredAtSourceMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Filtered At Source Metrics from Delivery Overview (asynchronously) Get events that were + * filtered at Source. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, and `app Version`. This parameter exists in beta. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, and/or `app Version` that can be applied in + * addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in beta. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getFilteredAtSourceMetricsFromDeliveryOverviewAsync( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSourceFilterBy filter, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getFilteredAtSourceMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getIngressFailedMetricsFromDeliveryOverview + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, and/or `appVersion`. This parameter exists in beta. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, and/or `app Version` that can be applied in + * addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in beta. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getIngressFailedMetricsFromDeliveryOverviewCall( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSourceFilterBy filter, + PaginationInput pagination, + 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 = "/delivery-overview/failed-on-ingest"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (sourceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sourceId", sourceId)); + } + + if (startTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startTime", startTime)); + } + + if (endTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endTime", endTime)); + } + + if (groupBy != null) { + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "groupBy", groupBy)); + } + + if (granularity != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("granularity", granularity)); + } + + if (filter != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter", filter)); + } + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1beta+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getIngressFailedMetricsFromDeliveryOverviewValidateBeforeCall( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSourceFilterBy filter, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'sourceId' is set + if (sourceId == null) { + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " getIngressFailedMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'startTime' is set + if (startTime == null) { + throw new ApiException( + "Missing the required parameter 'startTime' when calling" + + " getIngressFailedMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'endTime' is set + if (endTime == null) { + throw new ApiException( + "Missing the required parameter 'endTime' when calling" + + " getIngressFailedMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'granularity' is set + if (granularity == null) { + throw new ApiException( + "Missing the required parameter 'granularity' when calling" + + " getIngressFailedMetricsFromDeliveryOverview(Async)"); + } + + return getIngressFailedMetricsFromDeliveryOverviewCall( + sourceId, startTime, endTime, groupBy, granularity, filter, pagination, _callback); + } + + /** + * Get Ingress Failed Metrics from Delivery Overview Get events that failed on ingest. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, and/or `appVersion`. This parameter exists in beta. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, and/or `app Version` that can be applied in + * addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in beta. (optional) + * @return GetEgressFailedMetricsFromDeliveryOverview200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetEgressFailedMetricsFromDeliveryOverview200Response + getIngressFailedMetricsFromDeliveryOverview( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSourceFilterBy filter, + PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + getIngressFailedMetricsFromDeliveryOverviewWithHttpInfo( + sourceId, startTime, endTime, groupBy, granularity, filter, pagination); + return localVarResp.getData(); + } + + /** + * Get Ingress Failed Metrics from Delivery Overview Get events that failed on ingest. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, and/or `appVersion`. This parameter exists in beta. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, and/or `app Version` that can be applied in + * addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in beta. (optional) + * @return ApiResponse<GetEgressFailedMetricsFromDeliveryOverview200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getIngressFailedMetricsFromDeliveryOverviewWithHttpInfo( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSourceFilterBy filter, + PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + getIngressFailedMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Ingress Failed Metrics from Delivery Overview (asynchronously) Get events that failed on + * ingest. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, + * `discard Reason`, and/or `appVersion`. This parameter exists in beta. + * (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, + * `discard Reason`, and/or `app Version` that can be applied in + * addition to a `group By`. This parameter exists in beta. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in beta. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getIngressFailedMetricsFromDeliveryOverviewAsync( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSourceFilterBy filter, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getIngressFailedMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getIngressSuccessMetricsFromDeliveryOverview + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, and/or + * `app Version`. This parameter exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, and/or + * `app Version` that can be applied in addition to a `group By`. This + * parameter exists in beta. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in beta. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getIngressSuccessMetricsFromDeliveryOverviewCall( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSuccessfullyReceivedFilterBy filter, + PaginationInput pagination, + 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 = "/delivery-overview/successfully-received"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (sourceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sourceId", sourceId)); + } + + if (startTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startTime", startTime)); + } + + if (endTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endTime", endTime)); + } + + if (groupBy != null) { + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "groupBy", groupBy)); + } + + if (granularity != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("granularity", granularity)); + } + + if (filter != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter", filter)); + } + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1beta+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getIngressSuccessMetricsFromDeliveryOverviewValidateBeforeCall( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSuccessfullyReceivedFilterBy filter, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'sourceId' is set + if (sourceId == null) { + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " getIngressSuccessMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'startTime' is set + if (startTime == null) { + throw new ApiException( + "Missing the required parameter 'startTime' when calling" + + " getIngressSuccessMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'endTime' is set + if (endTime == null) { + throw new ApiException( + "Missing the required parameter 'endTime' when calling" + + " getIngressSuccessMetricsFromDeliveryOverview(Async)"); + } + + // verify the required parameter 'granularity' is set + if (granularity == null) { + throw new ApiException( + "Missing the required parameter 'granularity' when calling" + + " getIngressSuccessMetricsFromDeliveryOverview(Async)"); + } + + return getIngressSuccessMetricsFromDeliveryOverviewCall( + sourceId, startTime, endTime, groupBy, granularity, filter, pagination, _callback); + } + + /** + * Get Ingress Success Metrics from Delivery Overview Get events that were successfully received + * by Segment. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, and/or + * `app Version`. This parameter exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, and/or + * `app Version` that can be applied in addition to a `group By`. This + * parameter exists in beta. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in beta. (optional) + * @return GetEgressFailedMetricsFromDeliveryOverview200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetEgressFailedMetricsFromDeliveryOverview200Response + getIngressSuccessMetricsFromDeliveryOverview( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSuccessfullyReceivedFilterBy filter, + PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + getIngressSuccessMetricsFromDeliveryOverviewWithHttpInfo( + sourceId, startTime, endTime, groupBy, granularity, filter, pagination); + return localVarResp.getData(); + } + + /** + * Get Ingress Success Metrics from Delivery Overview Get events that were successfully received + * by Segment. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, and/or + * `app Version`. This parameter exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, and/or + * `app Version` that can be applied in addition to a `group By`. This + * parameter exists in beta. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in beta. (optional) + * @return ApiResponse<GetEgressFailedMetricsFromDeliveryOverview200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + getIngressSuccessMetricsFromDeliveryOverviewWithHttpInfo( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSuccessfullyReceivedFilterBy filter, + PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + getIngressSuccessMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Ingress Success Metrics from Delivery Overview (asynchronously) Get events that were + * successfully received by Segment. + * + * @param sourceId The sourceId for the Workspace. This parameter exists in beta. (required) + * @param startTime The ISO8601 formatted timestamp corresponding to the beginning of the + * requested time frame, inclusive. This parameter exists in beta. (required) + * @param endTime The ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. This parameter exists in beta. (required) + * @param groupBy A comma-delimited list of strings representing one or more dimensions to group + * the result by. Valid options are: `event Name`, `event Type`, and/or + * `app Version`. This parameter exists in beta. (optional) + * @param granularity The size of each bucket in the requested window. Based on the granularity + * chosen, there are restrictions on the time range you can query: **Minute**: - Max time + * range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time + * range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time + * range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in + * beta. (required) + * @param filter An optional filter for `event Name`, `event Type`, and/or + * `app Version` that can be applied in addition to a `group By`. This + * parameter exists in beta. (optional) + * @param pagination Optional params to specify the page cursor and count. This parameter exists + * in beta. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getIngressSuccessMetricsFromDeliveryOverviewAsync( + String sourceId, + String startTime, + String endTime, + List groupBy, + String granularity, + DeliveryOverviewSuccessfullyReceivedFilterBy filter, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getIngressSuccessMetricsFromDeliveryOverviewValidateBeforeCall( + sourceId, + startTime, + endTime, + groupBy, + granularity, + filter, + pagination, + _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/segment/publicapi/api/DestinationFiltersApi.java b/src/main/java/com/segment/publicapi/api/DestinationFiltersApi.java index 9155d760..d7de763c 100644 --- a/src/main/java/com/segment/publicapi/api/DestinationFiltersApi.java +++ b/src/main/java/com/segment/publicapi/api/DestinationFiltersApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,23 +9,15 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.CreateFilterForDestination200Response; import com.segment.publicapi.models.CreateFilterForDestinationV1Input; import com.segment.publicapi.models.GetFilterInDestination200Response; @@ -35,16 +26,13 @@ import com.segment.publicapi.models.PreviewDestinationFilter200Response; import com.segment.publicapi.models.PreviewDestinationFilterV1Input; import com.segment.publicapi.models.RemoveFilterFromDestination200Response; -import com.segment.publicapi.models.RequestErrorEnvelope; import com.segment.publicapi.models.UpdateFilterForDestination200Response; import com.segment.publicapi.models.UpdateFilterForDestinationV1Input; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class DestinationFiltersApi { private ApiClient localVarApiClient; @@ -85,29 +73,34 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createFilterForDestination - * @param destinationId (required) - * @param createFilterForDestinationV1Input (required) + * + * @param destinationId (required) + * @param createFilterForDestinationV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createFilterForDestinationCall(String destinationId, CreateFilterForDestinationV1Input createFilterForDestinationV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createFilterForDestinationCall( + String destinationId, + CreateFilterForDestinationV1Input createFilterForDestinationV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -116,8 +109,11 @@ public okhttp3.Call createFilterForDestinationCall(String destinationId, CreateF Object localVarPostBody = createFilterForDestinationV1Input; // create path and map variables - String localVarPath = "/destination/{destinationId}/filters" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())); + String localVarPath = + "/destination/{destinationId}/filters" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -126,7 +122,10 @@ public okhttp3.Call createFilterForDestinationCall(String destinationId, CreateF Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -134,128 +133,180 @@ public okhttp3.Call createFilterForDestinationCall(String destinationId, CreateF } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createFilterForDestinationValidateBeforeCall(String destinationId, CreateFilterForDestinationV1Input createFilterForDestinationV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createFilterForDestinationValidateBeforeCall( + String destinationId, + CreateFilterForDestinationV1Input createFilterForDestinationV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling createFilterForDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " createFilterForDestination(Async)"); } - + // verify the required parameter 'createFilterForDestinationV1Input' is set if (createFilterForDestinationV1Input == null) { - throw new ApiException("Missing the required parameter 'createFilterForDestinationV1Input' when calling createFilterForDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'createFilterForDestinationV1Input' when" + + " calling createFilterForDestination(Async)"); } - - - okhttp3.Call localVarCall = createFilterForDestinationCall(destinationId, createFilterForDestinationV1Input, _callback); - return localVarCall; + return createFilterForDestinationCall( + destinationId, createFilterForDestinationV1Input, _callback); } /** - * Create Filter for Destination - * Creates a filter in a Destination. When called, this endpoint may generate the `Destination Filter Created` [Audit Trail](/tag/Audit-Trail) event. - * @param destinationId (required) - * @param createFilterForDestinationV1Input (required) + * Create Filter for Destination Creates a filter in a Destination. • When called, this endpoint + * may generate the `Destination Filter Created` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param destinationId (required) + * @param createFilterForDestinationV1Input (required) * @return CreateFilterForDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateFilterForDestination200Response createFilterForDestination(String destinationId, CreateFilterForDestinationV1Input createFilterForDestinationV1Input) throws ApiException { - ApiResponse localVarResp = createFilterForDestinationWithHttpInfo(destinationId, createFilterForDestinationV1Input); + public CreateFilterForDestination200Response createFilterForDestination( + String destinationId, + CreateFilterForDestinationV1Input createFilterForDestinationV1Input) + throws ApiException { + ApiResponse localVarResp = + createFilterForDestinationWithHttpInfo( + destinationId, createFilterForDestinationV1Input); return localVarResp.getData(); } /** - * Create Filter for Destination - * Creates a filter in a Destination. When called, this endpoint may generate the `Destination Filter Created` [Audit Trail](/tag/Audit-Trail) event. - * @param destinationId (required) - * @param createFilterForDestinationV1Input (required) + * Create Filter for Destination Creates a filter in a Destination. • When called, this endpoint + * may generate the `Destination Filter Created` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param destinationId (required) + * @param createFilterForDestinationV1Input (required) * @return ApiResponse<CreateFilterForDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createFilterForDestinationWithHttpInfo(String destinationId, CreateFilterForDestinationV1Input createFilterForDestinationV1Input) throws ApiException { - okhttp3.Call localVarCall = createFilterForDestinationValidateBeforeCall(destinationId, createFilterForDestinationV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + createFilterForDestinationWithHttpInfo( + String destinationId, + CreateFilterForDestinationV1Input createFilterForDestinationV1Input) + throws ApiException { + okhttp3.Call localVarCall = + createFilterForDestinationValidateBeforeCall( + destinationId, createFilterForDestinationV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Filter for Destination (asynchronously) - * Creates a filter in a Destination. When called, this endpoint may generate the `Destination Filter Created` [Audit Trail](/tag/Audit-Trail) event. - * @param destinationId (required) - * @param createFilterForDestinationV1Input (required) + * Create Filter for Destination (asynchronously) Creates a filter in a Destination. • When + * called, this endpoint may generate the `Destination Filter Created` event in the + * [audit trail](/tag/Audit-Trail). + * + * @param destinationId (required) + * @param createFilterForDestinationV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createFilterForDestinationAsync(String destinationId, CreateFilterForDestinationV1Input createFilterForDestinationV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createFilterForDestinationValidateBeforeCall(destinationId, createFilterForDestinationV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createFilterForDestinationAsync( + String destinationId, + CreateFilterForDestinationV1Input createFilterForDestinationV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createFilterForDestinationValidateBeforeCall( + destinationId, createFilterForDestinationV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getFilterInDestination - * @param destinationId (required) - * @param filterId (required) + * + * @param destinationId (required) + * @param filterId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getFilterInDestinationCall(String destinationId, String filterId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getFilterInDestinationCall( + String destinationId, String filterId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -264,9 +315,14 @@ public okhttp3.Call getFilterInDestinationCall(String destinationId, String filt Object localVarPostBody = null; // create path and map variables - String localVarPath = "/destination/{destinationId}/filters/{filterId}" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())) - .replaceAll("\\{" + "filterId" + "\\}", localVarApiClient.escapeString(filterId.toString())); + String localVarPath = + "/destination/{destinationId}/filters/{filterId}" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())) + .replace( + "{" + "filterId" + "}", + localVarApiClient.escapeString(filterId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -275,136 +331,167 @@ public okhttp3.Call getFilterInDestinationCall(String destinationId, String filt Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getFilterInDestinationValidateBeforeCall(String destinationId, String filterId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getFilterInDestinationValidateBeforeCall( + String destinationId, String filterId, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling getFilterInDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " getFilterInDestination(Async)"); } - + // verify the required parameter 'filterId' is set if (filterId == null) { - throw new ApiException("Missing the required parameter 'filterId' when calling getFilterInDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'filterId' when calling" + + " getFilterInDestination(Async)"); } - - - okhttp3.Call localVarCall = getFilterInDestinationCall(destinationId, filterId, _callback); - return localVarCall; + return getFilterInDestinationCall(destinationId, filterId, _callback); } /** - * Get Filter in Destination - * Gets a Destination filter by id. - * @param destinationId (required) - * @param filterId (required) + * Get Filter in Destination Gets a Destination filter by id. + * + * @param destinationId (required) + * @param filterId (required) * @return GetFilterInDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetFilterInDestination200Response getFilterInDestination(String destinationId, String filterId) throws ApiException { - ApiResponse localVarResp = getFilterInDestinationWithHttpInfo(destinationId, filterId); + public GetFilterInDestination200Response getFilterInDestination( + String destinationId, String filterId) throws ApiException { + ApiResponse localVarResp = + getFilterInDestinationWithHttpInfo(destinationId, filterId); return localVarResp.getData(); } /** - * Get Filter in Destination - * Gets a Destination filter by id. - * @param destinationId (required) - * @param filterId (required) + * Get Filter in Destination Gets a Destination filter by id. + * + * @param destinationId (required) + * @param filterId (required) * @return ApiResponse<GetFilterInDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getFilterInDestinationWithHttpInfo(String destinationId, String filterId) throws ApiException { - okhttp3.Call localVarCall = getFilterInDestinationValidateBeforeCall(destinationId, filterId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse getFilterInDestinationWithHttpInfo( + String destinationId, String filterId) throws ApiException { + okhttp3.Call localVarCall = + getFilterInDestinationValidateBeforeCall(destinationId, filterId, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Filter in Destination (asynchronously) - * Gets a Destination filter by id. - * @param destinationId (required) - * @param filterId (required) + * Get Filter in Destination (asynchronously) Gets a Destination filter by id. + * + * @param destinationId (required) + * @param filterId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getFilterInDestinationAsync(String destinationId, String filterId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getFilterInDestinationValidateBeforeCall(destinationId, filterId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getFilterInDestinationAsync( + String destinationId, + String filterId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getFilterInDestinationValidateBeforeCall(destinationId, filterId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listFiltersFromDestination - * @param destinationId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * + * @param destinationId (required) + * @param pagination Pagination options. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listFiltersFromDestinationCall(String destinationId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listFiltersFromDestinationCall( + String destinationId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -413,8 +500,11 @@ public okhttp3.Call listFiltersFromDestinationCall(String destinationId, Paginat Object localVarPostBody = null; // create path and map variables - String localVarPath = "/destination/{destinationId}/filters" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())); + String localVarPath = + "/destination/{destinationId}/filters" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -427,135 +517,163 @@ public okhttp3.Call listFiltersFromDestinationCall(String destinationId, Paginat } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listFiltersFromDestinationValidateBeforeCall(String destinationId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listFiltersFromDestinationValidateBeforeCall( + String destinationId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling listFiltersFromDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " listFiltersFromDestination(Async)"); } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listFiltersFromDestination(Async)"); - } - - - okhttp3.Call localVarCall = listFiltersFromDestinationCall(destinationId, pagination, _callback); - return localVarCall; + return listFiltersFromDestinationCall(destinationId, pagination, _callback); } /** - * List Filters from Destination - * Lists filters for a Destination. - * @param destinationId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Filters from Destination Lists filters for a Destination. + * + * @param destinationId (required) + * @param pagination Pagination options. This parameter exists in v1. (optional) * @return ListFiltersFromDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListFiltersFromDestination200Response listFiltersFromDestination(String destinationId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listFiltersFromDestinationWithHttpInfo(destinationId, pagination); + public ListFiltersFromDestination200Response listFiltersFromDestination( + String destinationId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listFiltersFromDestinationWithHttpInfo(destinationId, pagination); return localVarResp.getData(); } /** - * List Filters from Destination - * Lists filters for a Destination. - * @param destinationId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Filters from Destination Lists filters for a Destination. + * + * @param destinationId (required) + * @param pagination Pagination options. This parameter exists in v1. (optional) * @return ApiResponse<ListFiltersFromDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listFiltersFromDestinationWithHttpInfo(String destinationId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listFiltersFromDestinationValidateBeforeCall(destinationId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + listFiltersFromDestinationWithHttpInfo(String destinationId, PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + listFiltersFromDestinationValidateBeforeCall(destinationId, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Filters from Destination (asynchronously) - * Lists filters for a Destination. - * @param destinationId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Filters from Destination (asynchronously) Lists filters for a Destination. + * + * @param destinationId (required) + * @param pagination Pagination options. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listFiltersFromDestinationAsync(String destinationId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listFiltersFromDestinationValidateBeforeCall(destinationId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listFiltersFromDestinationAsync( + String destinationId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listFiltersFromDestinationValidateBeforeCall(destinationId, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for previewDestinationFilter - * @param previewDestinationFilterV1Input (required) + * + * @param previewDestinationFilterV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call previewDestinationFilterCall(PreviewDestinationFilterV1Input previewDestinationFilterV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call previewDestinationFilterCall( + PreviewDestinationFilterV1Input previewDestinationFilterV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -573,7 +691,10 @@ public okhttp3.Call previewDestinationFilterCall(PreviewDestinationFilterV1Input Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -581,120 +702,155 @@ public okhttp3.Call previewDestinationFilterCall(PreviewDestinationFilterV1Input } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call previewDestinationFilterValidateBeforeCall(PreviewDestinationFilterV1Input previewDestinationFilterV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call previewDestinationFilterValidateBeforeCall( + PreviewDestinationFilterV1Input previewDestinationFilterV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'previewDestinationFilterV1Input' is set if (previewDestinationFilterV1Input == null) { - throw new ApiException("Missing the required parameter 'previewDestinationFilterV1Input' when calling previewDestinationFilter(Async)"); + throw new ApiException( + "Missing the required parameter 'previewDestinationFilterV1Input' when calling" + + " previewDestinationFilter(Async)"); } - - - okhttp3.Call localVarCall = previewDestinationFilterCall(previewDestinationFilterV1Input, _callback); - return localVarCall; + return previewDestinationFilterCall(previewDestinationFilterV1Input, _callback); } /** - * Preview Destination Filter - * Simulates the application of a Destination filter to a provided JSON payload. - * @param previewDestinationFilterV1Input (required) + * Preview Destination Filter Simulates the application of a Destination filter to a provided + * JSON payload. + * + * @param previewDestinationFilterV1Input (required) * @return PreviewDestinationFilter200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public PreviewDestinationFilter200Response previewDestinationFilter(PreviewDestinationFilterV1Input previewDestinationFilterV1Input) throws ApiException { - ApiResponse localVarResp = previewDestinationFilterWithHttpInfo(previewDestinationFilterV1Input); + public PreviewDestinationFilter200Response previewDestinationFilter( + PreviewDestinationFilterV1Input previewDestinationFilterV1Input) throws ApiException { + ApiResponse localVarResp = + previewDestinationFilterWithHttpInfo(previewDestinationFilterV1Input); return localVarResp.getData(); } /** - * Preview Destination Filter - * Simulates the application of a Destination filter to a provided JSON payload. - * @param previewDestinationFilterV1Input (required) + * Preview Destination Filter Simulates the application of a Destination filter to a provided + * JSON payload. + * + * @param previewDestinationFilterV1Input (required) * @return ApiResponse<PreviewDestinationFilter200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse previewDestinationFilterWithHttpInfo(PreviewDestinationFilterV1Input previewDestinationFilterV1Input) throws ApiException { - okhttp3.Call localVarCall = previewDestinationFilterValidateBeforeCall(previewDestinationFilterV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse previewDestinationFilterWithHttpInfo( + PreviewDestinationFilterV1Input previewDestinationFilterV1Input) throws ApiException { + okhttp3.Call localVarCall = + previewDestinationFilterValidateBeforeCall(previewDestinationFilterV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Preview Destination Filter (asynchronously) - * Simulates the application of a Destination filter to a provided JSON payload. - * @param previewDestinationFilterV1Input (required) + * Preview Destination Filter (asynchronously) Simulates the application of a Destination filter + * to a provided JSON payload. + * + * @param previewDestinationFilterV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call previewDestinationFilterAsync(PreviewDestinationFilterV1Input previewDestinationFilterV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = previewDestinationFilterValidateBeforeCall(previewDestinationFilterV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call previewDestinationFilterAsync( + PreviewDestinationFilterV1Input previewDestinationFilterV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + previewDestinationFilterValidateBeforeCall( + previewDestinationFilterV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for removeFilterFromDestination - * @param destinationId (required) - * @param filterId (required) + * + * @param destinationId (required) + * @param filterId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call removeFilterFromDestinationCall(String destinationId, String filterId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call removeFilterFromDestinationCall( + String destinationId, String filterId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -703,9 +859,14 @@ public okhttp3.Call removeFilterFromDestinationCall(String destinationId, String Object localVarPostBody = null; // create path and map variables - String localVarPath = "/destination/{destinationId}/filters/{filterId}" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())) - .replaceAll("\\{" + "filterId" + "\\}", localVarApiClient.escapeString(filterId.toString())); + String localVarPath = + "/destination/{destinationId}/filters/{filterId}" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())) + .replace( + "{" + "filterId" + "}", + localVarApiClient.escapeString(filterId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -714,137 +875,180 @@ public okhttp3.Call removeFilterFromDestinationCall(String destinationId, String Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call removeFilterFromDestinationValidateBeforeCall(String destinationId, String filterId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call removeFilterFromDestinationValidateBeforeCall( + String destinationId, String filterId, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling removeFilterFromDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " removeFilterFromDestination(Async)"); } - + // verify the required parameter 'filterId' is set if (filterId == null) { - throw new ApiException("Missing the required parameter 'filterId' when calling removeFilterFromDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'filterId' when calling" + + " removeFilterFromDestination(Async)"); } - - - okhttp3.Call localVarCall = removeFilterFromDestinationCall(destinationId, filterId, _callback); - return localVarCall; + return removeFilterFromDestinationCall(destinationId, filterId, _callback); } /** - * Remove Filter from Destination - * Deletes a Destination filter. When called, this endpoint may generate the `Destination Filter Deleted` [Audit Trail](/tag/Audit-Trail) event. - * @param destinationId (required) - * @param filterId (required) + * Remove Filter from Destination Deletes a Destination filter. • When called, this endpoint may + * generate the `Destination Filter Deleted` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param destinationId (required) + * @param filterId (required) * @return RemoveFilterFromDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public RemoveFilterFromDestination200Response removeFilterFromDestination(String destinationId, String filterId) throws ApiException { - ApiResponse localVarResp = removeFilterFromDestinationWithHttpInfo(destinationId, filterId); + public RemoveFilterFromDestination200Response removeFilterFromDestination( + String destinationId, String filterId) throws ApiException { + ApiResponse localVarResp = + removeFilterFromDestinationWithHttpInfo(destinationId, filterId); return localVarResp.getData(); } /** - * Remove Filter from Destination - * Deletes a Destination filter. When called, this endpoint may generate the `Destination Filter Deleted` [Audit Trail](/tag/Audit-Trail) event. - * @param destinationId (required) - * @param filterId (required) + * Remove Filter from Destination Deletes a Destination filter. • When called, this endpoint may + * generate the `Destination Filter Deleted` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param destinationId (required) + * @param filterId (required) * @return ApiResponse<RemoveFilterFromDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse removeFilterFromDestinationWithHttpInfo(String destinationId, String filterId) throws ApiException { - okhttp3.Call localVarCall = removeFilterFromDestinationValidateBeforeCall(destinationId, filterId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + removeFilterFromDestinationWithHttpInfo(String destinationId, String filterId) + throws ApiException { + okhttp3.Call localVarCall = + removeFilterFromDestinationValidateBeforeCall(destinationId, filterId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Remove Filter from Destination (asynchronously) - * Deletes a Destination filter. When called, this endpoint may generate the `Destination Filter Deleted` [Audit Trail](/tag/Audit-Trail) event. - * @param destinationId (required) - * @param filterId (required) + * Remove Filter from Destination (asynchronously) Deletes a Destination filter. • When called, + * this endpoint may generate the `Destination Filter Deleted` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param destinationId (required) + * @param filterId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call removeFilterFromDestinationAsync(String destinationId, String filterId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = removeFilterFromDestinationValidateBeforeCall(destinationId, filterId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call removeFilterFromDestinationAsync( + String destinationId, + String filterId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeFilterFromDestinationValidateBeforeCall(destinationId, filterId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for updateFilterForDestination - * @param destinationId (required) - * @param filterId (required) - * @param updateFilterForDestinationV1Input (required) + * + * @param destinationId (required) + * @param filterId (required) + * @param updateFilterForDestinationV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateFilterForDestinationCall(String destinationId, String filterId, UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call updateFilterForDestinationCall( + String destinationId, + String filterId, + UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -853,9 +1057,14 @@ public okhttp3.Call updateFilterForDestinationCall(String destinationId, String Object localVarPostBody = updateFilterForDestinationV1Input; // create path and map variables - String localVarPath = "/destination/{destinationId}/filters/{filterId}" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())) - .replaceAll("\\{" + "filterId" + "\\}", localVarApiClient.escapeString(filterId.toString())); + String localVarPath = + "/destination/{destinationId}/filters/{filterId}" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())) + .replace( + "{" + "filterId" + "}", + localVarApiClient.escapeString(filterId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -864,7 +1073,10 @@ public okhttp3.Call updateFilterForDestinationCall(String destinationId, String Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -872,108 +1084,162 @@ public okhttp3.Call updateFilterForDestinationCall(String destinationId, String } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateFilterForDestinationValidateBeforeCall(String destinationId, String filterId, UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call updateFilterForDestinationValidateBeforeCall( + String destinationId, + String filterId, + UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling updateFilterForDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " updateFilterForDestination(Async)"); } - + // verify the required parameter 'filterId' is set if (filterId == null) { - throw new ApiException("Missing the required parameter 'filterId' when calling updateFilterForDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'filterId' when calling" + + " updateFilterForDestination(Async)"); } - + // verify the required parameter 'updateFilterForDestinationV1Input' is set if (updateFilterForDestinationV1Input == null) { - throw new ApiException("Missing the required parameter 'updateFilterForDestinationV1Input' when calling updateFilterForDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'updateFilterForDestinationV1Input' when" + + " calling updateFilterForDestination(Async)"); } - - - okhttp3.Call localVarCall = updateFilterForDestinationCall(destinationId, filterId, updateFilterForDestinationV1Input, _callback); - return localVarCall; + return updateFilterForDestinationCall( + destinationId, filterId, updateFilterForDestinationV1Input, _callback); } /** - * Update Filter for Destination - * Updates a filter in a Destination. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Destination Filter Enabled * Destination Filter Disabled - * @param destinationId (required) - * @param filterId (required) - * @param updateFilterForDestinationV1Input (required) + * Update Filter for Destination Updates a filter in a Destination. • When called, this endpoint + * may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* + * Destination Filter Enabled * Destination Filter Disabled + * + * @param destinationId (required) + * @param filterId (required) + * @param updateFilterForDestinationV1Input (required) * @return UpdateFilterForDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public UpdateFilterForDestination200Response updateFilterForDestination(String destinationId, String filterId, UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input) throws ApiException { - ApiResponse localVarResp = updateFilterForDestinationWithHttpInfo(destinationId, filterId, updateFilterForDestinationV1Input); + public UpdateFilterForDestination200Response updateFilterForDestination( + String destinationId, + String filterId, + UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input) + throws ApiException { + ApiResponse localVarResp = + updateFilterForDestinationWithHttpInfo( + destinationId, filterId, updateFilterForDestinationV1Input); return localVarResp.getData(); } /** - * Update Filter for Destination - * Updates a filter in a Destination. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Destination Filter Enabled * Destination Filter Disabled - * @param destinationId (required) - * @param filterId (required) - * @param updateFilterForDestinationV1Input (required) + * Update Filter for Destination Updates a filter in a Destination. • When called, this endpoint + * may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* + * Destination Filter Enabled * Destination Filter Disabled + * + * @param destinationId (required) + * @param filterId (required) + * @param updateFilterForDestinationV1Input (required) * @return ApiResponse<UpdateFilterForDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse updateFilterForDestinationWithHttpInfo(String destinationId, String filterId, UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input) throws ApiException { - okhttp3.Call localVarCall = updateFilterForDestinationValidateBeforeCall(destinationId, filterId, updateFilterForDestinationV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + updateFilterForDestinationWithHttpInfo( + String destinationId, + String filterId, + UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input) + throws ApiException { + okhttp3.Call localVarCall = + updateFilterForDestinationValidateBeforeCall( + destinationId, filterId, updateFilterForDestinationV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Filter for Destination (asynchronously) - * Updates a filter in a Destination. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Destination Filter Enabled * Destination Filter Disabled - * @param destinationId (required) - * @param filterId (required) - * @param updateFilterForDestinationV1Input (required) + * Update Filter for Destination (asynchronously) Updates a filter in a Destination. • When + * called, this endpoint may generate one or more of the following [audit + * trail](/tag/Audit-Trail) events:* Destination Filter Enabled * Destination Filter Disabled + * + * @param destinationId (required) + * @param filterId (required) + * @param updateFilterForDestinationV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateFilterForDestinationAsync(String destinationId, String filterId, UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateFilterForDestinationValidateBeforeCall(destinationId, filterId, updateFilterForDestinationV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call updateFilterForDestinationAsync( + String destinationId, + String filterId, + UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateFilterForDestinationValidateBeforeCall( + destinationId, filterId, updateFilterForDestinationV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/DestinationsApi.java b/src/main/java/com/segment/publicapi/api/DestinationsApi.java index 4f5e6abe..4709a0f8 100644 --- a/src/main/java/com/segment/publicapi/api/DestinationsApi.java +++ b/src/main/java/com/segment/publicapi/api/DestinationsApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,23 +9,15 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.CreateDestination200Response; import com.segment.publicapi.models.CreateDestinationSubscription200Response; import com.segment.publicapi.models.CreateDestinationSubscriptionAlphaInput; @@ -39,18 +30,15 @@ import com.segment.publicapi.models.ListSubscriptionsFromDestination200Response; import com.segment.publicapi.models.PaginationInput; import com.segment.publicapi.models.RemoveSubscriptionFromDestination200Response; -import com.segment.publicapi.models.RequestErrorEnvelope; import com.segment.publicapi.models.UpdateDestination200Response; import com.segment.publicapi.models.UpdateDestinationV1Input; import com.segment.publicapi.models.UpdateSubscriptionForDestination200Response; import com.segment.publicapi.models.UpdateSubscriptionForDestinationAlphaInput; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class DestinationsApi { private ApiClient localVarApiClient; @@ -91,28 +79,31 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createDestination - * @param createDestinationV1Input (required) + * + * @param createDestinationV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createDestinationCall(CreateDestinationV1Input createDestinationV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createDestinationCall( + CreateDestinationV1Input createDestinationV1Input, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -130,7 +121,10 @@ public okhttp3.Call createDestinationCall(CreateDestinationV1Input createDestina Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -138,120 +132,156 @@ public okhttp3.Call createDestinationCall(CreateDestinationV1Input createDestina } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createDestinationValidateBeforeCall(CreateDestinationV1Input createDestinationV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createDestinationValidateBeforeCall( + CreateDestinationV1Input createDestinationV1Input, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'createDestinationV1Input' is set if (createDestinationV1Input == null) { - throw new ApiException("Missing the required parameter 'createDestinationV1Input' when calling createDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'createDestinationV1Input' when calling" + + " createDestination(Async)"); } - - - okhttp3.Call localVarCall = createDestinationCall(createDestinationV1Input, _callback); - return localVarCall; + return createDestinationCall(createDestinationV1Input, _callback); } /** - * Create Destination - * Creates a new Destination. When called, this endpoint may generate the `Integration Created` [Audit Trail](/tag/Audit-Trail) event. - * @param createDestinationV1Input (required) + * Create Destination Creates a new Destination. • When called, this endpoint may generate the + * `Integration Created` event in the [audit trail](/tag/Audit-Trail). + * + * @param createDestinationV1Input (required) * @return CreateDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateDestination200Response createDestination(CreateDestinationV1Input createDestinationV1Input) throws ApiException { - ApiResponse localVarResp = createDestinationWithHttpInfo(createDestinationV1Input); + public CreateDestination200Response createDestination( + CreateDestinationV1Input createDestinationV1Input) throws ApiException { + ApiResponse localVarResp = + createDestinationWithHttpInfo(createDestinationV1Input); return localVarResp.getData(); } /** - * Create Destination - * Creates a new Destination. When called, this endpoint may generate the `Integration Created` [Audit Trail](/tag/Audit-Trail) event. - * @param createDestinationV1Input (required) + * Create Destination Creates a new Destination. • When called, this endpoint may generate the + * `Integration Created` event in the [audit trail](/tag/Audit-Trail). + * + * @param createDestinationV1Input (required) * @return ApiResponse<CreateDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createDestinationWithHttpInfo(CreateDestinationV1Input createDestinationV1Input) throws ApiException { - okhttp3.Call localVarCall = createDestinationValidateBeforeCall(createDestinationV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse createDestinationWithHttpInfo( + CreateDestinationV1Input createDestinationV1Input) throws ApiException { + okhttp3.Call localVarCall = + createDestinationValidateBeforeCall(createDestinationV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Destination (asynchronously) - * Creates a new Destination. When called, this endpoint may generate the `Integration Created` [Audit Trail](/tag/Audit-Trail) event. - * @param createDestinationV1Input (required) + * Create Destination (asynchronously) Creates a new Destination. • When called, this endpoint + * may generate the `Integration Created` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param createDestinationV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createDestinationAsync(CreateDestinationV1Input createDestinationV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createDestinationValidateBeforeCall(createDestinationV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createDestinationAsync( + CreateDestinationV1Input createDestinationV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createDestinationValidateBeforeCall(createDestinationV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for createDestinationSubscription - * @param destinationId (required) - * @param createDestinationSubscriptionAlphaInput (required) + * + * @param destinationId (required) + * @param createDestinationSubscriptionAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createDestinationSubscriptionCall(String destinationId, CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createDestinationSubscriptionCall( + String destinationId, + CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -260,8 +290,11 @@ public okhttp3.Call createDestinationSubscriptionCall(String destinationId, Crea Object localVarPostBody = createDestinationSubscriptionAlphaInput; // create path and map variables - String localVarPath = "/destinations/{destinationId}/subscriptions" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())); + String localVarPath = + "/destinations/{destinationId}/subscriptions" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -277,128 +310,189 @@ public okhttp3.Call createDestinationSubscriptionCall(String destinationId, Crea localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createDestinationSubscriptionValidateBeforeCall(String destinationId, CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createDestinationSubscriptionValidateBeforeCall( + String destinationId, + CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling createDestinationSubscription(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " createDestinationSubscription(Async)"); } - + // verify the required parameter 'createDestinationSubscriptionAlphaInput' is set if (createDestinationSubscriptionAlphaInput == null) { - throw new ApiException("Missing the required parameter 'createDestinationSubscriptionAlphaInput' when calling createDestinationSubscription(Async)"); + throw new ApiException( + "Missing the required parameter 'createDestinationSubscriptionAlphaInput' when" + + " calling createDestinationSubscription(Async)"); } - - - okhttp3.Call localVarCall = createDestinationSubscriptionCall(destinationId, createDestinationSubscriptionAlphaInput, _callback); - return localVarCall; + return createDestinationSubscriptionCall( + destinationId, createDestinationSubscriptionAlphaInput, _callback); } /** - * Create Destination Subscription - * Creates a new Destination subscription. - * @param destinationId (required) - * @param createDestinationSubscriptionAlphaInput (required) + * Create Destination Subscription Creates a new Destination subscription. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Destination Subscriptions feature enabled. Please reach out to your customer success manager + * for more information. The rate limit for this endpoint is 5 requests per minute, which is + * lower than the default due to access pattern restrictions. Once reached, this endpoint will + * respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param destinationId (required) + * @param createDestinationSubscriptionAlphaInput (required) * @return CreateDestinationSubscription200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateDestinationSubscription200Response createDestinationSubscription(String destinationId, CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput) throws ApiException { - ApiResponse localVarResp = createDestinationSubscriptionWithHttpInfo(destinationId, createDestinationSubscriptionAlphaInput); + public CreateDestinationSubscription200Response createDestinationSubscription( + String destinationId, + CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput) + throws ApiException { + ApiResponse localVarResp = + createDestinationSubscriptionWithHttpInfo( + destinationId, createDestinationSubscriptionAlphaInput); return localVarResp.getData(); } /** - * Create Destination Subscription - * Creates a new Destination subscription. - * @param destinationId (required) - * @param createDestinationSubscriptionAlphaInput (required) + * Create Destination Subscription Creates a new Destination subscription. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the + * Destination Subscriptions feature enabled. Please reach out to your customer success manager + * for more information. The rate limit for this endpoint is 5 requests per minute, which is + * lower than the default due to access pattern restrictions. Once reached, this endpoint will + * respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param destinationId (required) + * @param createDestinationSubscriptionAlphaInput (required) * @return ApiResponse<CreateDestinationSubscription200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createDestinationSubscriptionWithHttpInfo(String destinationId, CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput) throws ApiException { - okhttp3.Call localVarCall = createDestinationSubscriptionValidateBeforeCall(destinationId, createDestinationSubscriptionAlphaInput, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + createDestinationSubscriptionWithHttpInfo( + String destinationId, + CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + createDestinationSubscriptionValidateBeforeCall( + destinationId, createDestinationSubscriptionAlphaInput, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Destination Subscription (asynchronously) - * Creates a new Destination subscription. - * @param destinationId (required) - * @param createDestinationSubscriptionAlphaInput (required) + * Create Destination Subscription (asynchronously) Creates a new Destination subscription. • + * This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Destination Subscriptions feature enabled. Please reach out to your + * customer success manager for more information. The rate limit for this endpoint is 5 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param destinationId (required) + * @param createDestinationSubscriptionAlphaInput (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createDestinationSubscriptionAsync(String destinationId, CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createDestinationSubscriptionValidateBeforeCall(destinationId, createDestinationSubscriptionAlphaInput, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createDestinationSubscriptionAsync( + String destinationId, + CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createDestinationSubscriptionValidateBeforeCall( + destinationId, createDestinationSubscriptionAlphaInput, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for deleteDestination - * @param destinationId (required) + * + * @param destinationId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteDestinationCall(String destinationId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteDestinationCall(String destinationId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -407,8 +501,11 @@ public okhttp3.Call deleteDestinationCall(String destinationId, final ApiCallbac Object localVarPostBody = null; // create path and map variables - String localVarPath = "/destinations/{destinationId}" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())); + String localVarPath = + "/destinations/{destinationId}" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -417,127 +514,156 @@ public okhttp3.Call deleteDestinationCall(String destinationId, final ApiCallbac Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteDestinationValidateBeforeCall(String destinationId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call deleteDestinationValidateBeforeCall( + String destinationId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling deleteDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " deleteDestination(Async)"); } - - - okhttp3.Call localVarCall = deleteDestinationCall(destinationId, _callback); - return localVarCall; + return deleteDestinationCall(destinationId, _callback); } /** - * Delete Destination - * Deletes an existing Destination. When called, this endpoint may generate the `Integration Deleted` [Audit Trail](/tag/Audit-Trail) event. Config API omitted fields: - `catalogId` - * @param destinationId (required) + * Delete Destination Deletes an existing Destination. • When called, this endpoint may generate + * the `Integration Deleted` event in the [audit trail](/tag/Audit-Trail). Config API + * omitted fields: - `catalogId` + * + * @param destinationId (required) * @return DeleteDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public DeleteDestination200Response deleteDestination(String destinationId) throws ApiException { - ApiResponse localVarResp = deleteDestinationWithHttpInfo(destinationId); + public DeleteDestination200Response deleteDestination(String destinationId) + throws ApiException { + ApiResponse localVarResp = + deleteDestinationWithHttpInfo(destinationId); return localVarResp.getData(); } /** - * Delete Destination - * Deletes an existing Destination. When called, this endpoint may generate the `Integration Deleted` [Audit Trail](/tag/Audit-Trail) event. Config API omitted fields: - `catalogId` - * @param destinationId (required) + * Delete Destination Deletes an existing Destination. • When called, this endpoint may generate + * the `Integration Deleted` event in the [audit trail](/tag/Audit-Trail). Config API + * omitted fields: - `catalogId` + * + * @param destinationId (required) * @return ApiResponse<DeleteDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse deleteDestinationWithHttpInfo(String destinationId) throws ApiException { + public ApiResponse deleteDestinationWithHttpInfo( + String destinationId) throws ApiException { okhttp3.Call localVarCall = deleteDestinationValidateBeforeCall(destinationId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Delete Destination (asynchronously) - * Deletes an existing Destination. When called, this endpoint may generate the `Integration Deleted` [Audit Trail](/tag/Audit-Trail) event. Config API omitted fields: - `catalogId` - * @param destinationId (required) + * Delete Destination (asynchronously) Deletes an existing Destination. • When called, this + * endpoint may generate the `Integration Deleted` event in the [audit + * trail](/tag/Audit-Trail). Config API omitted fields: - `catalogId` + * + * @param destinationId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteDestinationAsync(String destinationId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteDestinationAsync( + String destinationId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = deleteDestinationValidateBeforeCall(destinationId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getDestination - * @param destinationId (required) + * + * @param destinationId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDestinationCall(String destinationId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getDestinationCall(String destinationId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -546,8 +672,11 @@ public okhttp3.Call getDestinationCall(String destinationId, final ApiCallback _ Object localVarPostBody = null; // create path and map variables - String localVarPath = "/destinations/{destinationId}" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())); + String localVarPath = + "/destinations/{destinationId}" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -556,128 +685,153 @@ public okhttp3.Call getDestinationCall(String destinationId, final ApiCallback _ Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getDestinationValidateBeforeCall(String destinationId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getDestinationValidateBeforeCall( + String destinationId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling getDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " getDestination(Async)"); } - - - okhttp3.Call localVarCall = getDestinationCall(destinationId, _callback); - return localVarCall; + return getDestinationCall(destinationId, _callback); } /** - * Get Destination - * Returns a Destination by its id. Config API omitted fields: - `catalogId` - * @param destinationId (required) + * Get Destination Returns a Destination by its id. Config API omitted fields: - + * `catalogId` + * + * @param destinationId (required) * @return GetDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public GetDestination200Response getDestination(String destinationId) throws ApiException { - ApiResponse localVarResp = getDestinationWithHttpInfo(destinationId); + ApiResponse localVarResp = + getDestinationWithHttpInfo(destinationId); return localVarResp.getData(); } /** - * Get Destination - * Returns a Destination by its id. Config API omitted fields: - `catalogId` - * @param destinationId (required) + * Get Destination Returns a Destination by its id. Config API omitted fields: - + * `catalogId` + * + * @param destinationId (required) * @return ApiResponse<GetDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getDestinationWithHttpInfo(String destinationId) throws ApiException { + public ApiResponse getDestinationWithHttpInfo(String destinationId) + throws ApiException { okhttp3.Call localVarCall = getDestinationValidateBeforeCall(destinationId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Destination (asynchronously) - * Returns a Destination by its id. Config API omitted fields: - `catalogId` - * @param destinationId (required) + * Get Destination (asynchronously) Returns a Destination by its id. Config API omitted fields: + * - `catalogId` + * + * @param destinationId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDestinationAsync(String destinationId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getDestinationAsync( + String destinationId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = getDestinationValidateBeforeCall(destinationId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getSubscriptionFromDestination - * @param destinationId (required) - * @param id (required) + * + * @param destinationId (required) + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getSubscriptionFromDestinationCall(String destinationId, String id, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSubscriptionFromDestinationCall( + String destinationId, String id, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -686,9 +840,12 @@ public okhttp3.Call getSubscriptionFromDestinationCall(String destinationId, Str Object localVarPostBody = null; // create path and map variables - String localVarPath = "/destinations/{destinationId}/subscriptions/{id}" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())) - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + String localVarPath = + "/destinations/{destinationId}/subscriptions/{id}" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -704,132 +861,185 @@ public okhttp3.Call getSubscriptionFromDestinationCall(String destinationId, Str localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSubscriptionFromDestinationValidateBeforeCall(String destinationId, String id, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getSubscriptionFromDestinationValidateBeforeCall( + String destinationId, String id, final ApiCallback _callback) throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling getSubscriptionFromDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " getSubscriptionFromDestination(Async)"); } - + // verify the required parameter 'id' is set if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling getSubscriptionFromDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " getSubscriptionFromDestination(Async)"); } - - - okhttp3.Call localVarCall = getSubscriptionFromDestinationCall(destinationId, id, _callback); - return localVarCall; + return getSubscriptionFromDestinationCall(destinationId, id, _callback); } /** - * Get Subscription from Destination - * Gets a Destination subscription by id. - * @param destinationId (required) - * @param id (required) + * Get Subscription from Destination Gets a Destination subscription by id. • This endpoint is + * in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. + * • In order to successfully call this endpoint, the specified Workspace needs to have the + * Destination Subscriptions feature enabled. Please reach out to your customer success manager + * for more information. + * + * @param destinationId (required) + * @param id (required) * @return GetSubscriptionFromDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetSubscriptionFromDestination200Response getSubscriptionFromDestination(String destinationId, String id) throws ApiException { - ApiResponse localVarResp = getSubscriptionFromDestinationWithHttpInfo(destinationId, id); + public GetSubscriptionFromDestination200Response getSubscriptionFromDestination( + String destinationId, String id) throws ApiException { + ApiResponse localVarResp = + getSubscriptionFromDestinationWithHttpInfo(destinationId, id); return localVarResp.getData(); } /** - * Get Subscription from Destination - * Gets a Destination subscription by id. - * @param destinationId (required) - * @param id (required) + * Get Subscription from Destination Gets a Destination subscription by id. • This endpoint is + * in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. + * • In order to successfully call this endpoint, the specified Workspace needs to have the + * Destination Subscriptions feature enabled. Please reach out to your customer success manager + * for more information. + * + * @param destinationId (required) + * @param id (required) * @return ApiResponse<GetSubscriptionFromDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getSubscriptionFromDestinationWithHttpInfo(String destinationId, String id) throws ApiException { - okhttp3.Call localVarCall = getSubscriptionFromDestinationValidateBeforeCall(destinationId, id, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + getSubscriptionFromDestinationWithHttpInfo(String destinationId, String id) + throws ApiException { + okhttp3.Call localVarCall = + getSubscriptionFromDestinationValidateBeforeCall(destinationId, id, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Subscription from Destination (asynchronously) - * Gets a Destination subscription by id. - * @param destinationId (required) - * @param id (required) + * Get Subscription from Destination (asynchronously) Gets a Destination subscription by id. • + * This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Destination Subscriptions feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param destinationId (required) + * @param id (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getSubscriptionFromDestinationAsync(String destinationId, String id, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getSubscriptionFromDestinationValidateBeforeCall(destinationId, id, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getSubscriptionFromDestinationAsync( + String destinationId, + String id, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getSubscriptionFromDestinationValidateBeforeCall(destinationId, id, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listDeliveryMetricsSummaryFromDestination - * @param destinationId (required) - * @param sourceId The id of the Source linked to the Destination. Config API note: analogous to `parent`. This parameter exists in alpha. (required) - * @param startTime Filter events that happened after this time. Defaults to: - 1 hour ago if granularity is `MINUTE`. - 7 days ago if granularity is `HOUR`. - 30 days ago if granularity is `DAY`. This parameter exists in alpha. (optional) - * @param endTime Filter events that happened before this time. Defaults to now if not set. This parameter exists in alpha. (optional) - * @param granularity The granularity to filter metrics to. Either `MINUTE`, `HOUR` or `DAY`. Defaults to `MINUTE` if not set. This parameter exists in alpha. (optional) + * + * @param destinationId (required) + * @param sourceId The id of the Source linked to the Destination. Config API note: analogous to + * `parent`. This parameter exists in beta. (required) + * @param startTime Filter events that happened after this time. Defaults to: - 1 hour ago if + * granularity is `MINUTE`. - 7 days ago if granularity is `HOUR`. - 30 + * days ago if granularity is `DAY`. This parameter exists in beta. (optional) + * @param endTime Filter events that happened before this time. Defaults to now if not set. This + * parameter exists in beta. (optional) + * @param granularity The granularity to filter metrics to. Either `MINUTE`, + * `HOUR` or `DAY`. Defaults to `MINUTE` if not set. This + * parameter exists in beta. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listDeliveryMetricsSummaryFromDestinationCall(String destinationId, String sourceId, String startTime, String endTime, String granularity, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listDeliveryMetricsSummaryFromDestinationCall( + String destinationId, + String sourceId, + String startTime, + String endTime, + String granularity, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -838,8 +1048,11 @@ public okhttp3.Call listDeliveryMetricsSummaryFromDestinationCall(String destina Object localVarPostBody = null; // create path and map variables - String localVarPath = "/destinations/{destinationId}/delivery-metrics" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())); + String localVarPath = + "/destinations/{destinationId}/delivery-metrics" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -860,148 +1073,236 @@ public okhttp3.Call listDeliveryMetricsSummaryFromDestinationCall(String destina } if (granularity != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("granularity", granularity)); + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("granularity", granularity)); } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/json" + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+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); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listDeliveryMetricsSummaryFromDestinationValidateBeforeCall(String destinationId, String sourceId, String startTime, String endTime, String granularity, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listDeliveryMetricsSummaryFromDestinationValidateBeforeCall( + String destinationId, + String sourceId, + String startTime, + String endTime, + String granularity, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling listDeliveryMetricsSummaryFromDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " listDeliveryMetricsSummaryFromDestination(Async)"); } - + // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling listDeliveryMetricsSummaryFromDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " listDeliveryMetricsSummaryFromDestination(Async)"); } - - - okhttp3.Call localVarCall = listDeliveryMetricsSummaryFromDestinationCall(destinationId, sourceId, startTime, endTime, granularity, _callback); - return localVarCall; + return listDeliveryMetricsSummaryFromDestinationCall( + destinationId, sourceId, startTime, endTime, granularity, _callback); } /** - * List Delivery Metrics Summary from Destination - * Get event delivery metrics summary from a Destination. Based on the granularity, there are restrictions on the time range you can query: **Minute Granularity**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour Granularity**: - Max Time range: 1 week - Oldest possible start time: 10 days in the past **Day Granularity**: - Max time range: 60 days - Oldest possible start time: 60 days in the past - * @param destinationId (required) - * @param sourceId The id of the Source linked to the Destination. Config API note: analogous to `parent`. This parameter exists in alpha. (required) - * @param startTime Filter events that happened after this time. Defaults to: - 1 hour ago if granularity is `MINUTE`. - 7 days ago if granularity is `HOUR`. - 30 days ago if granularity is `DAY`. This parameter exists in alpha. (optional) - * @param endTime Filter events that happened before this time. Defaults to now if not set. This parameter exists in alpha. (optional) - * @param granularity The granularity to filter metrics to. Either `MINUTE`, `HOUR` or `DAY`. Defaults to `MINUTE` if not set. This parameter exists in alpha. (optional) + * List Delivery Metrics Summary from Destination Get an event delivery metrics summary from a + * Destination. Based on the granularity chosen, there are restrictions on the time range you + * can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in + * the past **Hour**: - Max Time range: 7 days - Oldest possible start time: 7 days in the past + * **Day**: - Max time range: 14 days - Oldest possible start time: 14 days in the past + * + * @param destinationId (required) + * @param sourceId The id of the Source linked to the Destination. Config API note: analogous to + * `parent`. This parameter exists in beta. (required) + * @param startTime Filter events that happened after this time. Defaults to: - 1 hour ago if + * granularity is `MINUTE`. - 7 days ago if granularity is `HOUR`. - 30 + * days ago if granularity is `DAY`. This parameter exists in beta. (optional) + * @param endTime Filter events that happened before this time. Defaults to now if not set. This + * parameter exists in beta. (optional) + * @param granularity The granularity to filter metrics to. Either `MINUTE`, + * `HOUR` or `DAY`. Defaults to `MINUTE` if not set. This + * parameter exists in beta. (optional) * @return ListDeliveryMetricsSummaryFromDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListDeliveryMetricsSummaryFromDestination200Response listDeliveryMetricsSummaryFromDestination(String destinationId, String sourceId, String startTime, String endTime, String granularity) throws ApiException { - ApiResponse localVarResp = listDeliveryMetricsSummaryFromDestinationWithHttpInfo(destinationId, sourceId, startTime, endTime, granularity); + public ListDeliveryMetricsSummaryFromDestination200Response + listDeliveryMetricsSummaryFromDestination( + String destinationId, + String sourceId, + String startTime, + String endTime, + String granularity) + throws ApiException { + ApiResponse localVarResp = + listDeliveryMetricsSummaryFromDestinationWithHttpInfo( + destinationId, sourceId, startTime, endTime, granularity); return localVarResp.getData(); } /** - * List Delivery Metrics Summary from Destination - * Get event delivery metrics summary from a Destination. Based on the granularity, there are restrictions on the time range you can query: **Minute Granularity**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour Granularity**: - Max Time range: 1 week - Oldest possible start time: 10 days in the past **Day Granularity**: - Max time range: 60 days - Oldest possible start time: 60 days in the past - * @param destinationId (required) - * @param sourceId The id of the Source linked to the Destination. Config API note: analogous to `parent`. This parameter exists in alpha. (required) - * @param startTime Filter events that happened after this time. Defaults to: - 1 hour ago if granularity is `MINUTE`. - 7 days ago if granularity is `HOUR`. - 30 days ago if granularity is `DAY`. This parameter exists in alpha. (optional) - * @param endTime Filter events that happened before this time. Defaults to now if not set. This parameter exists in alpha. (optional) - * @param granularity The granularity to filter metrics to. Either `MINUTE`, `HOUR` or `DAY`. Defaults to `MINUTE` if not set. This parameter exists in alpha. (optional) + * List Delivery Metrics Summary from Destination Get an event delivery metrics summary from a + * Destination. Based on the granularity chosen, there are restrictions on the time range you + * can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in + * the past **Hour**: - Max Time range: 7 days - Oldest possible start time: 7 days in the past + * **Day**: - Max time range: 14 days - Oldest possible start time: 14 days in the past + * + * @param destinationId (required) + * @param sourceId The id of the Source linked to the Destination. Config API note: analogous to + * `parent`. This parameter exists in beta. (required) + * @param startTime Filter events that happened after this time. Defaults to: - 1 hour ago if + * granularity is `MINUTE`. - 7 days ago if granularity is `HOUR`. - 30 + * days ago if granularity is `DAY`. This parameter exists in beta. (optional) + * @param endTime Filter events that happened before this time. Defaults to now if not set. This + * parameter exists in beta. (optional) + * @param granularity The granularity to filter metrics to. Either `MINUTE`, + * `HOUR` or `DAY`. Defaults to `MINUTE` if not set. This + * parameter exists in beta. (optional) * @return ApiResponse<ListDeliveryMetricsSummaryFromDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listDeliveryMetricsSummaryFromDestinationWithHttpInfo(String destinationId, String sourceId, String startTime, String endTime, String granularity) throws ApiException { - okhttp3.Call localVarCall = listDeliveryMetricsSummaryFromDestinationValidateBeforeCall(destinationId, sourceId, startTime, endTime, granularity, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + listDeliveryMetricsSummaryFromDestinationWithHttpInfo( + String destinationId, + String sourceId, + String startTime, + String endTime, + String granularity) + throws ApiException { + okhttp3.Call localVarCall = + listDeliveryMetricsSummaryFromDestinationValidateBeforeCall( + destinationId, sourceId, startTime, endTime, granularity, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Delivery Metrics Summary from Destination (asynchronously) - * Get event delivery metrics summary from a Destination. Based on the granularity, there are restrictions on the time range you can query: **Minute Granularity**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour Granularity**: - Max Time range: 1 week - Oldest possible start time: 10 days in the past **Day Granularity**: - Max time range: 60 days - Oldest possible start time: 60 days in the past - * @param destinationId (required) - * @param sourceId The id of the Source linked to the Destination. Config API note: analogous to `parent`. This parameter exists in alpha. (required) - * @param startTime Filter events that happened after this time. Defaults to: - 1 hour ago if granularity is `MINUTE`. - 7 days ago if granularity is `HOUR`. - 30 days ago if granularity is `DAY`. This parameter exists in alpha. (optional) - * @param endTime Filter events that happened before this time. Defaults to now if not set. This parameter exists in alpha. (optional) - * @param granularity The granularity to filter metrics to. Either `MINUTE`, `HOUR` or `DAY`. Defaults to `MINUTE` if not set. This parameter exists in alpha. (optional) + * List Delivery Metrics Summary from Destination (asynchronously) Get an event delivery metrics + * summary from a Destination. Based on the granularity chosen, there are restrictions on the + * time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: + * 48 hours in the past **Hour**: - Max Time range: 7 days - Oldest possible start time: 7 days + * in the past **Day**: - Max time range: 14 days - Oldest possible start time: 14 days in the + * past + * + * @param destinationId (required) + * @param sourceId The id of the Source linked to the Destination. Config API note: analogous to + * `parent`. This parameter exists in beta. (required) + * @param startTime Filter events that happened after this time. Defaults to: - 1 hour ago if + * granularity is `MINUTE`. - 7 days ago if granularity is `HOUR`. - 30 + * days ago if granularity is `DAY`. This parameter exists in beta. (optional) + * @param endTime Filter events that happened before this time. Defaults to now if not set. This + * parameter exists in beta. (optional) + * @param granularity The granularity to filter metrics to. Either `MINUTE`, + * `HOUR` or `DAY`. Defaults to `MINUTE` if not set. This + * parameter exists in beta. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listDeliveryMetricsSummaryFromDestinationAsync(String destinationId, String sourceId, String startTime, String endTime, String granularity, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listDeliveryMetricsSummaryFromDestinationValidateBeforeCall(destinationId, sourceId, startTime, endTime, granularity, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listDeliveryMetricsSummaryFromDestinationAsync( + String destinationId, + String sourceId, + String startTime, + String endTime, + String granularity, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listDeliveryMetricsSummaryFromDestinationValidateBeforeCall( + destinationId, sourceId, startTime, endTime, granularity, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listDestinations - * @param pagination Required pagination params for the request. This parameter exists in alpha. (required) + * + * @param pagination Required pagination params for the request. This parameter exists in v1. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listDestinationsCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listDestinationsCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1023,128 +1324,148 @@ public okhttp3.Call listDestinationsCall(PaginationInput pagination, final ApiCa } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listDestinationsValidateBeforeCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listDestinations(Async)"); - } - - - okhttp3.Call localVarCall = listDestinationsCall(pagination, _callback); - return localVarCall; - + private okhttp3.Call listDestinationsValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return listDestinationsCall(pagination, _callback); } /** - * List Destinations - * Returns a list of Destinations. - * @param pagination Required pagination params for the request. This parameter exists in alpha. (required) + * List Destinations Returns a list of Destinations. + * + * @param pagination Required pagination params for the request. This parameter exists in v1. + * (optional) * @return ListDestinations200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListDestinations200Response listDestinations(PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listDestinationsWithHttpInfo(pagination); + public ListDestinations200Response listDestinations(PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listDestinationsWithHttpInfo(pagination); return localVarResp.getData(); } /** - * List Destinations - * Returns a list of Destinations. - * @param pagination Required pagination params for the request. This parameter exists in alpha. (required) + * List Destinations Returns a list of Destinations. + * + * @param pagination Required pagination params for the request. This parameter exists in v1. + * (optional) * @return ApiResponse<ListDestinations200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listDestinationsWithHttpInfo(PaginationInput pagination) throws ApiException { + public ApiResponse listDestinationsWithHttpInfo( + PaginationInput pagination) throws ApiException { okhttp3.Call localVarCall = listDestinationsValidateBeforeCall(pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Destinations (asynchronously) - * Returns a list of Destinations. - * @param pagination Required pagination params for the request. This parameter exists in alpha. (required) + * List Destinations (asynchronously) Returns a list of Destinations. + * + * @param pagination Required pagination params for the request. This parameter exists in v1. + * (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listDestinationsAsync(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listDestinationsAsync( + PaginationInput pagination, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = listDestinationsValidateBeforeCall(pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listSubscriptionsFromDestination - * @param destinationId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * + * @param destinationId (required) + * @param pagination Pagination options. This parameter exists in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSubscriptionsFromDestinationCall(String destinationId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listSubscriptionsFromDestinationCall( + String destinationId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1153,8 +1474,11 @@ public okhttp3.Call listSubscriptionsFromDestinationCall(String destinationId, P Object localVarPostBody = null; // create path and map variables - String localVarPath = "/destinations/{destinationId}/subscriptions" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())); + String localVarPath = + "/destinations/{destinationId}/subscriptions" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1174,129 +1498,165 @@ public okhttp3.Call listSubscriptionsFromDestinationCall(String destinationId, P localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listSubscriptionsFromDestinationValidateBeforeCall(String destinationId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listSubscriptionsFromDestinationValidateBeforeCall( + String destinationId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling listSubscriptionsFromDestination(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listSubscriptionsFromDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " listSubscriptionsFromDestination(Async)"); } - - - okhttp3.Call localVarCall = listSubscriptionsFromDestinationCall(destinationId, pagination, _callback); - return localVarCall; + return listSubscriptionsFromDestinationCall(destinationId, pagination, _callback); } /** - * List Subscriptions from Destination - * Lists subscriptions for a Destination. - * @param destinationId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Subscriptions from Destination Lists subscriptions for a Destination. • This endpoint is + * in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. + * • In order to successfully call this endpoint, the specified Workspace needs to have the + * Destination Subscriptions feature enabled. Please reach out to your customer success manager + * for more information. + * + * @param destinationId (required) + * @param pagination Pagination options. This parameter exists in alpha. (optional) * @return ListSubscriptionsFromDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListSubscriptionsFromDestination200Response listSubscriptionsFromDestination(String destinationId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listSubscriptionsFromDestinationWithHttpInfo(destinationId, pagination); + public ListSubscriptionsFromDestination200Response listSubscriptionsFromDestination( + String destinationId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listSubscriptionsFromDestinationWithHttpInfo(destinationId, pagination); return localVarResp.getData(); } /** - * List Subscriptions from Destination - * Lists subscriptions for a Destination. - * @param destinationId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Subscriptions from Destination Lists subscriptions for a Destination. • This endpoint is + * in **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. + * • In order to successfully call this endpoint, the specified Workspace needs to have the + * Destination Subscriptions feature enabled. Please reach out to your customer success manager + * for more information. + * + * @param destinationId (required) + * @param pagination Pagination options. This parameter exists in alpha. (optional) * @return ApiResponse<ListSubscriptionsFromDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listSubscriptionsFromDestinationWithHttpInfo(String destinationId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listSubscriptionsFromDestinationValidateBeforeCall(destinationId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + listSubscriptionsFromDestinationWithHttpInfo( + String destinationId, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + listSubscriptionsFromDestinationValidateBeforeCall(destinationId, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Subscriptions from Destination (asynchronously) - * Lists subscriptions for a Destination. - * @param destinationId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Subscriptions from Destination (asynchronously) Lists subscriptions for a Destination. • + * This endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Destination Subscriptions feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param destinationId (required) + * @param pagination Pagination options. This parameter exists in alpha. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSubscriptionsFromDestinationAsync(String destinationId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listSubscriptionsFromDestinationValidateBeforeCall(destinationId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listSubscriptionsFromDestinationAsync( + String destinationId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSubscriptionsFromDestinationValidateBeforeCall( + destinationId, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for removeSubscriptionFromDestination - * @param destinationId (required) - * @param id (required) + * + * @param destinationId (required) + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call removeSubscriptionFromDestinationCall(String destinationId, String id, final ApiCallback _callback) throws ApiException { + public okhttp3.Call removeSubscriptionFromDestinationCall( + String destinationId, String id, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1305,9 +1665,12 @@ public okhttp3.Call removeSubscriptionFromDestinationCall(String destinationId, Object localVarPostBody = null; // create path and map variables - String localVarPath = "/destinations/{destinationId}/subscriptions/{id}" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())) - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + String localVarPath = + "/destinations/{destinationId}/subscriptions/{id}" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1323,129 +1686,182 @@ public okhttp3.Call removeSubscriptionFromDestinationCall(String destinationId, localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call removeSubscriptionFromDestinationValidateBeforeCall(String destinationId, String id, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call removeSubscriptionFromDestinationValidateBeforeCall( + String destinationId, String id, final ApiCallback _callback) throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling removeSubscriptionFromDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " removeSubscriptionFromDestination(Async)"); } - + // verify the required parameter 'id' is set if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling removeSubscriptionFromDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " removeSubscriptionFromDestination(Async)"); } - - - okhttp3.Call localVarCall = removeSubscriptionFromDestinationCall(destinationId, id, _callback); - return localVarCall; + return removeSubscriptionFromDestinationCall(destinationId, id, _callback); } /** - * Remove Subscription from Destination - * Deletes an existing Destination subscription. - * @param destinationId (required) - * @param id (required) + * Remove Subscription from Destination Deletes an existing Destination subscription. • This + * endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Destination Subscriptions feature enabled. Please reach out to your + * customer success manager for more information. The rate limit for this endpoint is 5 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param destinationId (required) + * @param id (required) * @return RemoveSubscriptionFromDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public RemoveSubscriptionFromDestination200Response removeSubscriptionFromDestination(String destinationId, String id) throws ApiException { - ApiResponse localVarResp = removeSubscriptionFromDestinationWithHttpInfo(destinationId, id); + public RemoveSubscriptionFromDestination200Response removeSubscriptionFromDestination( + String destinationId, String id) throws ApiException { + ApiResponse localVarResp = + removeSubscriptionFromDestinationWithHttpInfo(destinationId, id); return localVarResp.getData(); } /** - * Remove Subscription from Destination - * Deletes an existing Destination subscription. - * @param destinationId (required) - * @param id (required) + * Remove Subscription from Destination Deletes an existing Destination subscription. • This + * endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Destination Subscriptions feature enabled. Please reach out to your + * customer success manager for more information. The rate limit for this endpoint is 5 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param destinationId (required) + * @param id (required) * @return ApiResponse<RemoveSubscriptionFromDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse removeSubscriptionFromDestinationWithHttpInfo(String destinationId, String id) throws ApiException { - okhttp3.Call localVarCall = removeSubscriptionFromDestinationValidateBeforeCall(destinationId, id, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + removeSubscriptionFromDestinationWithHttpInfo(String destinationId, String id) + throws ApiException { + okhttp3.Call localVarCall = + removeSubscriptionFromDestinationValidateBeforeCall(destinationId, id, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Remove Subscription from Destination (asynchronously) - * Deletes an existing Destination subscription. - * @param destinationId (required) - * @param id (required) + * Remove Subscription from Destination (asynchronously) Deletes an existing Destination + * subscription. • This endpoint is in **Alpha** testing. Please submit any feedback by sending + * an email to friends@segment.com. • In order to successfully call this endpoint, the specified + * Workspace needs to have the Destination Subscriptions feature enabled. Please reach out to + * your customer success manager for more information. The rate limit for this endpoint is 5 + * requests per minute, which is lower than the default due to access pattern restrictions. Once + * reached, this endpoint will respond with the 429 HTTP status code with headers indicating the + * limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param destinationId (required) + * @param id (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call removeSubscriptionFromDestinationAsync(String destinationId, String id, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = removeSubscriptionFromDestinationValidateBeforeCall(destinationId, id, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call removeSubscriptionFromDestinationAsync( + String destinationId, + String id, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeSubscriptionFromDestinationValidateBeforeCall(destinationId, id, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for updateDestination - * @param destinationId (required) - * @param updateDestinationV1Input (required) + * + * @param destinationId (required) + * @param updateDestinationV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateDestinationCall(String destinationId, UpdateDestinationV1Input updateDestinationV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call updateDestinationCall( + String destinationId, + UpdateDestinationV1Input updateDestinationV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1454,8 +1870,11 @@ public okhttp3.Call updateDestinationCall(String destinationId, UpdateDestinatio Object localVarPostBody = updateDestinationV1Input; // create path and map variables - String localVarPath = "/destinations/{destinationId}" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())); + String localVarPath = + "/destinations/{destinationId}" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1464,7 +1883,10 @@ public okhttp3.Call updateDestinationCall(String destinationId, UpdateDestinatio Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -1472,129 +1894,189 @@ public okhttp3.Call updateDestinationCall(String destinationId, UpdateDestinatio } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateDestinationValidateBeforeCall(String destinationId, UpdateDestinationV1Input updateDestinationV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call updateDestinationValidateBeforeCall( + String destinationId, + UpdateDestinationV1Input updateDestinationV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling updateDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " updateDestination(Async)"); } - + // verify the required parameter 'updateDestinationV1Input' is set if (updateDestinationV1Input == null) { - throw new ApiException("Missing the required parameter 'updateDestinationV1Input' when calling updateDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'updateDestinationV1Input' when calling" + + " updateDestination(Async)"); } - - - okhttp3.Call localVarCall = updateDestinationCall(destinationId, updateDestinationV1Input, _callback); - return localVarCall; + return updateDestinationCall(destinationId, updateDestinationV1Input, _callback); } /** - * Update Destination - * Updates an existing Destination. **Note**: if you attempt to update read-only settings for your destination you'll encounter the following behavior: * If only read-only properties are being updated, the endpoint will return an HTTP 400 error. * If there's a mix of writable and read-only properties in the payload, the request will be accepted, the writable properties will be updated and the read-only properties ignored. When called, this endpoint may generate the `Integration Disabled` [Audit Trail](/tag/Audit-Trail) event. Config API omitted fields: - `updateMask` - * @param destinationId (required) - * @param updateDestinationV1Input (required) + * Update Destination Updates an existing Destination. **Note**: if you attempt to update + * read-only settings for your destination you'll encounter the following behavior: * If + * only read-only properties are being updated, the endpoint will return an HTTP 400 error. * If + * there's a mix of writable and read-only properties in the payload, the request will be + * accepted, the writable properties will be updated and the read-only properties ignored. • + * When called, this endpoint may generate the `Integration Disabled` event in the + * [audit trail](/tag/Audit-Trail). Config API omitted fields: - `updateMask` + * + * @param destinationId (required) + * @param updateDestinationV1Input (required) * @return UpdateDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public UpdateDestination200Response updateDestination(String destinationId, UpdateDestinationV1Input updateDestinationV1Input) throws ApiException { - ApiResponse localVarResp = updateDestinationWithHttpInfo(destinationId, updateDestinationV1Input); + public UpdateDestination200Response updateDestination( + String destinationId, UpdateDestinationV1Input updateDestinationV1Input) + throws ApiException { + ApiResponse localVarResp = + updateDestinationWithHttpInfo(destinationId, updateDestinationV1Input); return localVarResp.getData(); } /** - * Update Destination - * Updates an existing Destination. **Note**: if you attempt to update read-only settings for your destination you'll encounter the following behavior: * If only read-only properties are being updated, the endpoint will return an HTTP 400 error. * If there's a mix of writable and read-only properties in the payload, the request will be accepted, the writable properties will be updated and the read-only properties ignored. When called, this endpoint may generate the `Integration Disabled` [Audit Trail](/tag/Audit-Trail) event. Config API omitted fields: - `updateMask` - * @param destinationId (required) - * @param updateDestinationV1Input (required) + * Update Destination Updates an existing Destination. **Note**: if you attempt to update + * read-only settings for your destination you'll encounter the following behavior: * If + * only read-only properties are being updated, the endpoint will return an HTTP 400 error. * If + * there's a mix of writable and read-only properties in the payload, the request will be + * accepted, the writable properties will be updated and the read-only properties ignored. • + * When called, this endpoint may generate the `Integration Disabled` event in the + * [audit trail](/tag/Audit-Trail). Config API omitted fields: - `updateMask` + * + * @param destinationId (required) + * @param updateDestinationV1Input (required) * @return ApiResponse<UpdateDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse updateDestinationWithHttpInfo(String destinationId, UpdateDestinationV1Input updateDestinationV1Input) throws ApiException { - okhttp3.Call localVarCall = updateDestinationValidateBeforeCall(destinationId, updateDestinationV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse updateDestinationWithHttpInfo( + String destinationId, UpdateDestinationV1Input updateDestinationV1Input) + throws ApiException { + okhttp3.Call localVarCall = + updateDestinationValidateBeforeCall(destinationId, updateDestinationV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Destination (asynchronously) - * Updates an existing Destination. **Note**: if you attempt to update read-only settings for your destination you'll encounter the following behavior: * If only read-only properties are being updated, the endpoint will return an HTTP 400 error. * If there's a mix of writable and read-only properties in the payload, the request will be accepted, the writable properties will be updated and the read-only properties ignored. When called, this endpoint may generate the `Integration Disabled` [Audit Trail](/tag/Audit-Trail) event. Config API omitted fields: - `updateMask` - * @param destinationId (required) - * @param updateDestinationV1Input (required) + * Update Destination (asynchronously) Updates an existing Destination. **Note**: if you attempt + * to update read-only settings for your destination you'll encounter the following + * behavior: * If only read-only properties are being updated, the endpoint will return an HTTP + * 400 error. * If there's a mix of writable and read-only properties in the payload, the + * request will be accepted, the writable properties will be updated and the read-only + * properties ignored. • When called, this endpoint may generate the `Integration + * Disabled` event in the [audit trail](/tag/Audit-Trail). Config API omitted fields: - + * `updateMask` + * + * @param destinationId (required) + * @param updateDestinationV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateDestinationAsync(String destinationId, UpdateDestinationV1Input updateDestinationV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateDestinationValidateBeforeCall(destinationId, updateDestinationV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call updateDestinationAsync( + String destinationId, + UpdateDestinationV1Input updateDestinationV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateDestinationValidateBeforeCall( + destinationId, updateDestinationV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for updateSubscriptionForDestination - * @param destinationId (required) - * @param id (required) - * @param updateSubscriptionForDestinationAlphaInput (required) + * + * @param destinationId (required) + * @param id (required) + * @param updateSubscriptionForDestinationAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateSubscriptionForDestinationCall(String destinationId, String id, UpdateSubscriptionForDestinationAlphaInput updateSubscriptionForDestinationAlphaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call updateSubscriptionForDestinationCall( + String destinationId, + String id, + UpdateSubscriptionForDestinationAlphaInput updateSubscriptionForDestinationAlphaInput, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1603,9 +2085,12 @@ public okhttp3.Call updateSubscriptionForDestinationCall(String destinationId, S Object localVarPostBody = updateSubscriptionForDestinationAlphaInput; // create path and map variables - String localVarPath = "/destinations/{destinationId}/subscriptions/{id}" - .replaceAll("\\{" + "destinationId" + "\\}", localVarApiClient.escapeString(destinationId.toString())) - .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); + String localVarPath = + "/destinations/{destinationId}/subscriptions/{id}" + .replace( + "{" + "destinationId" + "}", + localVarApiClient.escapeString(destinationId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1621,109 +2106,174 @@ public okhttp3.Call updateSubscriptionForDestinationCall(String destinationId, S localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateSubscriptionForDestinationValidateBeforeCall(String destinationId, String id, UpdateSubscriptionForDestinationAlphaInput updateSubscriptionForDestinationAlphaInput, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call updateSubscriptionForDestinationValidateBeforeCall( + String destinationId, + String id, + UpdateSubscriptionForDestinationAlphaInput updateSubscriptionForDestinationAlphaInput, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'destinationId' is set if (destinationId == null) { - throw new ApiException("Missing the required parameter 'destinationId' when calling updateSubscriptionForDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'destinationId' when calling" + + " updateSubscriptionForDestination(Async)"); } - + // verify the required parameter 'id' is set if (id == null) { - throw new ApiException("Missing the required parameter 'id' when calling updateSubscriptionForDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'id' when calling" + + " updateSubscriptionForDestination(Async)"); } - + // verify the required parameter 'updateSubscriptionForDestinationAlphaInput' is set if (updateSubscriptionForDestinationAlphaInput == null) { - throw new ApiException("Missing the required parameter 'updateSubscriptionForDestinationAlphaInput' when calling updateSubscriptionForDestination(Async)"); + throw new ApiException( + "Missing the required parameter 'updateSubscriptionForDestinationAlphaInput'" + + " when calling updateSubscriptionForDestination(Async)"); } - - - okhttp3.Call localVarCall = updateSubscriptionForDestinationCall(destinationId, id, updateSubscriptionForDestinationAlphaInput, _callback); - return localVarCall; + return updateSubscriptionForDestinationCall( + destinationId, id, updateSubscriptionForDestinationAlphaInput, _callback); } /** - * Update Subscription for Destination - * Updates an existing Destination subscription. - * @param destinationId (required) - * @param id (required) - * @param updateSubscriptionForDestinationAlphaInput (required) + * Update Subscription for Destination Updates an existing Destination subscription. • This + * endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Destination Subscriptions feature enabled. Please reach out to your + * customer success manager for more information. The rate limit for this endpoint is 5 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param destinationId (required) + * @param id (required) + * @param updateSubscriptionForDestinationAlphaInput (required) * @return UpdateSubscriptionForDestination200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public UpdateSubscriptionForDestination200Response updateSubscriptionForDestination(String destinationId, String id, UpdateSubscriptionForDestinationAlphaInput updateSubscriptionForDestinationAlphaInput) throws ApiException { - ApiResponse localVarResp = updateSubscriptionForDestinationWithHttpInfo(destinationId, id, updateSubscriptionForDestinationAlphaInput); + public UpdateSubscriptionForDestination200Response updateSubscriptionForDestination( + String destinationId, + String id, + UpdateSubscriptionForDestinationAlphaInput updateSubscriptionForDestinationAlphaInput) + throws ApiException { + ApiResponse localVarResp = + updateSubscriptionForDestinationWithHttpInfo( + destinationId, id, updateSubscriptionForDestinationAlphaInput); return localVarResp.getData(); } /** - * Update Subscription for Destination - * Updates an existing Destination subscription. - * @param destinationId (required) - * @param id (required) - * @param updateSubscriptionForDestinationAlphaInput (required) + * Update Subscription for Destination Updates an existing Destination subscription. • This + * endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Destination Subscriptions feature enabled. Please reach out to your + * customer success manager for more information. The rate limit for this endpoint is 5 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param destinationId (required) + * @param id (required) + * @param updateSubscriptionForDestinationAlphaInput (required) * @return ApiResponse<UpdateSubscriptionForDestination200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse updateSubscriptionForDestinationWithHttpInfo(String destinationId, String id, UpdateSubscriptionForDestinationAlphaInput updateSubscriptionForDestinationAlphaInput) throws ApiException { - okhttp3.Call localVarCall = updateSubscriptionForDestinationValidateBeforeCall(destinationId, id, updateSubscriptionForDestinationAlphaInput, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + updateSubscriptionForDestinationWithHttpInfo( + String destinationId, + String id, + UpdateSubscriptionForDestinationAlphaInput + updateSubscriptionForDestinationAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + updateSubscriptionForDestinationValidateBeforeCall( + destinationId, id, updateSubscriptionForDestinationAlphaInput, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Subscription for Destination (asynchronously) - * Updates an existing Destination subscription. - * @param destinationId (required) - * @param id (required) - * @param updateSubscriptionForDestinationAlphaInput (required) + * Update Subscription for Destination (asynchronously) Updates an existing Destination + * subscription. • This endpoint is in **Alpha** testing. Please submit any feedback by sending + * an email to friends@segment.com. • In order to successfully call this endpoint, the specified + * Workspace needs to have the Destination Subscriptions feature enabled. Please reach out to + * your customer success manager for more information. The rate limit for this endpoint is 5 + * requests per minute, which is lower than the default due to access pattern restrictions. Once + * reached, this endpoint will respond with the 429 HTTP status code with headers indicating the + * limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param destinationId (required) + * @param id (required) + * @param updateSubscriptionForDestinationAlphaInput (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateSubscriptionForDestinationAsync(String destinationId, String id, UpdateSubscriptionForDestinationAlphaInput updateSubscriptionForDestinationAlphaInput, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateSubscriptionForDestinationValidateBeforeCall(destinationId, id, updateSubscriptionForDestinationAlphaInput, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call updateSubscriptionForDestinationAsync( + String destinationId, + String id, + UpdateSubscriptionForDestinationAlphaInput updateSubscriptionForDestinationAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateSubscriptionForDestinationValidateBeforeCall( + destinationId, id, updateSubscriptionForDestinationAlphaInput, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/EdgeFunctionsApi.java b/src/main/java/com/segment/publicapi/api/EdgeFunctionsApi.java index d3eaf43c..92acc428 100644 --- a/src/main/java/com/segment/publicapi/api/EdgeFunctionsApi.java +++ b/src/main/java/com/segment/publicapi/api/EdgeFunctionsApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,36 +9,25 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.CreateEdgeFunctions200Response; import com.segment.publicapi.models.CreateEdgeFunctionsAlphaInput; import com.segment.publicapi.models.DisableEdgeFunctions200Response; import com.segment.publicapi.models.GenerateUploadURLForEdgeFunctions200Response; import com.segment.publicapi.models.GetLatestFromEdgeFunctions200Response; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class EdgeFunctionsApi { private ApiClient localVarApiClient; @@ -80,29 +68,34 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createEdgeFunctions - * @param sourceId (required) - * @param createEdgeFunctionsAlphaInput (required) + * + * @param sourceId (required) + * @param createEdgeFunctionsAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createEdgeFunctionsCall(String sourceId, CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createEdgeFunctionsCall( + String sourceId, + CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -111,8 +104,11 @@ public okhttp3.Call createEdgeFunctionsCall(String sourceId, CreateEdgeFunctions Object localVarPostBody = createEdgeFunctionsAlphaInput; // create path and map variables - String localVarPath = "/sources/{sourceId}/edge-functions" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}/edge-functions" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -128,128 +124,173 @@ public okhttp3.Call createEdgeFunctionsCall(String sourceId, CreateEdgeFunctions localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createEdgeFunctionsValidateBeforeCall(String sourceId, CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createEdgeFunctionsValidateBeforeCall( + String sourceId, + CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling createEdgeFunctions(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " createEdgeFunctions(Async)"); } - + // verify the required parameter 'createEdgeFunctionsAlphaInput' is set if (createEdgeFunctionsAlphaInput == null) { - throw new ApiException("Missing the required parameter 'createEdgeFunctionsAlphaInput' when calling createEdgeFunctions(Async)"); + throw new ApiException( + "Missing the required parameter 'createEdgeFunctionsAlphaInput' when calling" + + " createEdgeFunctions(Async)"); } - - - okhttp3.Call localVarCall = createEdgeFunctionsCall(sourceId, createEdgeFunctionsAlphaInput, _callback); - return localVarCall; + return createEdgeFunctionsCall(sourceId, createEdgeFunctionsAlphaInput, _callback); } /** - * Create Edge Functions - * Create EdgeFunctions for your Source, given a valid upload URL for an Edge Functions bundle. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. - * @param sourceId (required) - * @param createEdgeFunctionsAlphaInput (required) + * Create Edge Functions Create EdgeFunctions for your Source given a valid upload URL for an + * Edge Functions bundle. • This endpoint is in **Alpha** testing. Please submit any feedback by + * sending an email to friends@segment.com. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Edge Functions feature enabled. Please reach out to + * your customer success manager for more information. + * + * @param sourceId (required) + * @param createEdgeFunctionsAlphaInput (required) * @return CreateEdgeFunctions200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateEdgeFunctions200Response createEdgeFunctions(String sourceId, CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput) throws ApiException { - ApiResponse localVarResp = createEdgeFunctionsWithHttpInfo(sourceId, createEdgeFunctionsAlphaInput); + public CreateEdgeFunctions200Response createEdgeFunctions( + String sourceId, CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput) + throws ApiException { + ApiResponse localVarResp = + createEdgeFunctionsWithHttpInfo(sourceId, createEdgeFunctionsAlphaInput); return localVarResp.getData(); } /** - * Create Edge Functions - * Create EdgeFunctions for your Source, given a valid upload URL for an Edge Functions bundle. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. - * @param sourceId (required) - * @param createEdgeFunctionsAlphaInput (required) + * Create Edge Functions Create EdgeFunctions for your Source given a valid upload URL for an + * Edge Functions bundle. • This endpoint is in **Alpha** testing. Please submit any feedback by + * sending an email to friends@segment.com. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Edge Functions feature enabled. Please reach out to + * your customer success manager for more information. + * + * @param sourceId (required) + * @param createEdgeFunctionsAlphaInput (required) * @return ApiResponse<CreateEdgeFunctions200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createEdgeFunctionsWithHttpInfo(String sourceId, CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput) throws ApiException { - okhttp3.Call localVarCall = createEdgeFunctionsValidateBeforeCall(sourceId, createEdgeFunctionsAlphaInput, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse createEdgeFunctionsWithHttpInfo( + String sourceId, CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + createEdgeFunctionsValidateBeforeCall( + sourceId, createEdgeFunctionsAlphaInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Edge Functions (asynchronously) - * Create EdgeFunctions for your Source, given a valid upload URL for an Edge Functions bundle. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. - * @param sourceId (required) - * @param createEdgeFunctionsAlphaInput (required) + * Create Edge Functions (asynchronously) Create EdgeFunctions for your Source given a valid + * upload URL for an Edge Functions bundle. • This endpoint is in **Alpha** testing. Please + * submit any feedback by sending an email to friends@segment.com. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. + * Please reach out to your customer success manager for more information. + * + * @param sourceId (required) + * @param createEdgeFunctionsAlphaInput (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createEdgeFunctionsAsync(String sourceId, CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createEdgeFunctionsValidateBeforeCall(sourceId, createEdgeFunctionsAlphaInput, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createEdgeFunctionsAsync( + String sourceId, + CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createEdgeFunctionsValidateBeforeCall( + sourceId, createEdgeFunctionsAlphaInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for disableEdgeFunctions - * @param sourceId (required) + * + * @param sourceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call disableEdgeFunctionsCall(String sourceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call disableEdgeFunctionsCall(String sourceId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -258,8 +299,11 @@ public okhttp3.Call disableEdgeFunctionsCall(String sourceId, final ApiCallback Object localVarPostBody = null; // create path and map variables - String localVarPath = "/sources/{sourceId}/edge-functions/disable" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}/edge-functions/disable" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -275,120 +319,152 @@ public okhttp3.Call disableEdgeFunctionsCall(String sourceId, final ApiCallback localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call disableEdgeFunctionsValidateBeforeCall(String sourceId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call disableEdgeFunctionsValidateBeforeCall( + String sourceId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling disableEdgeFunctions(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " disableEdgeFunctions(Async)"); } - - - okhttp3.Call localVarCall = disableEdgeFunctionsCall(sourceId, _callback); - return localVarCall; + return disableEdgeFunctionsCall(sourceId, _callback); } /** - * Disable Edge Functions - * Disable Edge Functions for your Source. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. - * @param sourceId (required) + * Disable Edge Functions Disable Edge Functions for your Source. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the Edge + * Functions feature enabled. Please reach out to your customer success manager for more + * information. + * + * @param sourceId (required) * @return DisableEdgeFunctions200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public DisableEdgeFunctions200Response disableEdgeFunctions(String sourceId) throws ApiException { - ApiResponse localVarResp = disableEdgeFunctionsWithHttpInfo(sourceId); + public DisableEdgeFunctions200Response disableEdgeFunctions(String sourceId) + throws ApiException { + ApiResponse localVarResp = + disableEdgeFunctionsWithHttpInfo(sourceId); return localVarResp.getData(); } /** - * Disable Edge Functions - * Disable Edge Functions for your Source. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. - * @param sourceId (required) + * Disable Edge Functions Disable Edge Functions for your Source. • This endpoint is in + * **Alpha** testing. Please submit any feedback by sending an email to friends@segment.com. • + * In order to successfully call this endpoint, the specified Workspace needs to have the Edge + * Functions feature enabled. Please reach out to your customer success manager for more + * information. + * + * @param sourceId (required) * @return ApiResponse<DisableEdgeFunctions200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse disableEdgeFunctionsWithHttpInfo(String sourceId) throws ApiException { + public ApiResponse disableEdgeFunctionsWithHttpInfo( + String sourceId) throws ApiException { okhttp3.Call localVarCall = disableEdgeFunctionsValidateBeforeCall(sourceId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Disable Edge Functions (asynchronously) - * Disable Edge Functions for your Source. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. - * @param sourceId (required) + * Disable Edge Functions (asynchronously) Disable Edge Functions for your Source. • This + * endpoint is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Edge Functions feature enabled. Please reach out to your customer success + * manager for more information. + * + * @param sourceId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call disableEdgeFunctionsAsync(String sourceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call disableEdgeFunctionsAsync( + String sourceId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = disableEdgeFunctionsValidateBeforeCall(sourceId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for generateUploadURLForEdgeFunctions - * @param sourceId (required) + * + * @param sourceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call generateUploadURLForEdgeFunctionsCall(String sourceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call generateUploadURLForEdgeFunctionsCall( + String sourceId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -397,8 +473,11 @@ public okhttp3.Call generateUploadURLForEdgeFunctionsCall(String sourceId, final Object localVarPostBody = null; // create path and map variables - String localVarPath = "/sources/{sourceId}/edge-functions/upload-url" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}/edge-functions/upload-url" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -414,120 +493,157 @@ public okhttp3.Call generateUploadURLForEdgeFunctionsCall(String sourceId, final localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call generateUploadURLForEdgeFunctionsValidateBeforeCall(String sourceId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call generateUploadURLForEdgeFunctionsValidateBeforeCall( + String sourceId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling generateUploadURLForEdgeFunctions(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " generateUploadURLForEdgeFunctions(Async)"); } - - - okhttp3.Call localVarCall = generateUploadURLForEdgeFunctionsCall(sourceId, _callback); - return localVarCall; + return generateUploadURLForEdgeFunctionsCall(sourceId, _callback); } /** - * Generate Upload URL for Edge Functions - * Generate a temporary upload URL, that can be used to upload an Edge Functions bundle. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. - * @param sourceId (required) + * Generate Upload URL for Edge Functions Generate a temporary upload URL that can be used to + * upload an Edge Functions bundle. • This endpoint is in **Alpha** testing. Please submit any + * feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param sourceId (required) * @return GenerateUploadURLForEdgeFunctions200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GenerateUploadURLForEdgeFunctions200Response generateUploadURLForEdgeFunctions(String sourceId) throws ApiException { - ApiResponse localVarResp = generateUploadURLForEdgeFunctionsWithHttpInfo(sourceId); + public GenerateUploadURLForEdgeFunctions200Response generateUploadURLForEdgeFunctions( + String sourceId) throws ApiException { + ApiResponse localVarResp = + generateUploadURLForEdgeFunctionsWithHttpInfo(sourceId); return localVarResp.getData(); } /** - * Generate Upload URL for Edge Functions - * Generate a temporary upload URL, that can be used to upload an Edge Functions bundle. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. - * @param sourceId (required) + * Generate Upload URL for Edge Functions Generate a temporary upload URL that can be used to + * upload an Edge Functions bundle. • This endpoint is in **Alpha** testing. Please submit any + * feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param sourceId (required) * @return ApiResponse<GenerateUploadURLForEdgeFunctions200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse generateUploadURLForEdgeFunctionsWithHttpInfo(String sourceId) throws ApiException { - okhttp3.Call localVarCall = generateUploadURLForEdgeFunctionsValidateBeforeCall(sourceId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + generateUploadURLForEdgeFunctionsWithHttpInfo(String sourceId) throws ApiException { + okhttp3.Call localVarCall = + generateUploadURLForEdgeFunctionsValidateBeforeCall(sourceId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Generate Upload URL for Edge Functions (asynchronously) - * Generate a temporary upload URL, that can be used to upload an Edge Functions bundle. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. - * @param sourceId (required) + * Generate Upload URL for Edge Functions (asynchronously) Generate a temporary upload URL that + * can be used to upload an Edge Functions bundle. • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Edge Functions + * feature enabled. Please reach out to your customer success manager for more information. + * + * @param sourceId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call generateUploadURLForEdgeFunctionsAsync(String sourceId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = generateUploadURLForEdgeFunctionsValidateBeforeCall(sourceId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call generateUploadURLForEdgeFunctionsAsync( + String sourceId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + generateUploadURLForEdgeFunctionsValidateBeforeCall(sourceId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getLatestFromEdgeFunctions - * @param sourceId (required) + * + * @param sourceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getLatestFromEdgeFunctionsCall(String sourceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getLatestFromEdgeFunctionsCall(String sourceId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -536,8 +652,11 @@ public okhttp3.Call getLatestFromEdgeFunctionsCall(String sourceId, final ApiCal Object localVarPostBody = null; // create path and map variables - String localVarPath = "/sources/{sourceId}/edge-functions/latest" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}/edge-functions/latest" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -553,93 +672,125 @@ public okhttp3.Call getLatestFromEdgeFunctionsCall(String sourceId, final ApiCal localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getLatestFromEdgeFunctionsValidateBeforeCall(String sourceId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getLatestFromEdgeFunctionsValidateBeforeCall( + String sourceId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling getLatestFromEdgeFunctions(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " getLatestFromEdgeFunctions(Async)"); } - - - okhttp3.Call localVarCall = getLatestFromEdgeFunctionsCall(sourceId, _callback); - return localVarCall; + return getLatestFromEdgeFunctionsCall(sourceId, _callback); } /** - * Get Latest from Edge Functions - * Get the latest Edge Functions for your Source. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. - * @param sourceId (required) + * Get Latest from Edge Functions Get the latest Edge Functions for your Source. • This endpoint + * is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Edge Functions feature enabled. Please reach out to your customer success + * manager for more information. + * + * @param sourceId (required) * @return GetLatestFromEdgeFunctions200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetLatestFromEdgeFunctions200Response getLatestFromEdgeFunctions(String sourceId) throws ApiException { - ApiResponse localVarResp = getLatestFromEdgeFunctionsWithHttpInfo(sourceId); + public GetLatestFromEdgeFunctions200Response getLatestFromEdgeFunctions(String sourceId) + throws ApiException { + ApiResponse localVarResp = + getLatestFromEdgeFunctionsWithHttpInfo(sourceId); return localVarResp.getData(); } /** - * Get Latest from Edge Functions - * Get the latest Edge Functions for your Source. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. - * @param sourceId (required) + * Get Latest from Edge Functions Get the latest Edge Functions for your Source. • This endpoint + * is in **Alpha** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Edge Functions feature enabled. Please reach out to your customer success + * manager for more information. + * + * @param sourceId (required) * @return ApiResponse<GetLatestFromEdgeFunctions200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getLatestFromEdgeFunctionsWithHttpInfo(String sourceId) throws ApiException { + public ApiResponse + getLatestFromEdgeFunctionsWithHttpInfo(String sourceId) throws ApiException { okhttp3.Call localVarCall = getLatestFromEdgeFunctionsValidateBeforeCall(sourceId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Latest from Edge Functions (asynchronously) - * Get the latest Edge Functions for your Source. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer success manager for more information. - * @param sourceId (required) + * Get Latest from Edge Functions (asynchronously) Get the latest Edge Functions for your + * Source. • This endpoint is in **Alpha** testing. Please submit any feedback by sending an + * email to friends@segment.com. • In order to successfully call this endpoint, the specified + * Workspace needs to have the Edge Functions feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param sourceId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getLatestFromEdgeFunctionsAsync(String sourceId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getLatestFromEdgeFunctionsValidateBeforeCall(sourceId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getLatestFromEdgeFunctionsAsync( + String sourceId, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getLatestFromEdgeFunctionsValidateBeforeCall(sourceId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/EventsApi.java b/src/main/java/com/segment/publicapi/api/EventsApi.java index d19b9542..30b6ae86 100644 --- a/src/main/java/com/segment/publicapi/api/EventsApi.java +++ b/src/main/java/com/segment/publicapi/api/EventsApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,33 +9,22 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.GetEventsVolumeFromWorkspace200Response; import com.segment.publicapi.models.PaginationInput; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class EventsApi { private ApiClient localVarApiClient; @@ -77,36 +65,60 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getEventsVolumeFromWorkspace - * @param granularity The size of each bucket in the requested window. This parameter exists in alpha. (required) - * @param startTime The ISO8601 formatted timestamp that corresponds to the beginning of the requested time frame, inclusive. This parameter exists in alpha. (required) - * @param endTime The ISO8601 formatted timestamp that corresponds to the end of the requested time frame, noninclusive. Segment recommends that you lag queries 1 minute behind clock time to reduce the risk for latency to impact the counts. This parameter exists in alpha. (required) - * @param groupBy A comma-delimited list of strings that represents the dimensions to group the result by. The options are: `eventName`, `eventType` and `source`. This parameter exists in alpha. (optional) - * @param sourceId A list of strings which filters the results to the given SourceIds. This parameter exists in alpha. (optional) - * @param eventName A list of strings which filters the results to the given EventNames. This parameter exists in alpha. (optional) - * @param eventType A list of strings which filters the results to the given EventTypes. This parameter exists in alpha. (optional) - * @param appVersion A list of strings which filters the results to the given AppVersions. This parameter exists in alpha. (optional) - * @param pagination Pagination input for event volume by Workspace. This parameter exists in alpha. (optional) + * + * @param granularity The size of each bucket in the requested window. This parameter exists in + * v1. (required) + * @param startTime The ISO8601 formatted timestamp that corresponds to the beginning of the + * requested time frame, inclusive. This parameter exists in v1. (required) + * @param endTime The ISO8601 formatted timestamp that corresponds to the end of the requested + * time frame, noninclusive. Segment recommends that you lag queries 1 minute behind clock + * time to reduce the risk for latency to impact the counts. This parameter exists in v1. + * (required) + * @param groupBy A comma-delimited list of strings that represents the dimensions to group the + * result by. The options are: `eventName`, `eventType` and + * `source`. This parameter exists in v1. (optional) + * @param sourceId A list of strings which filters the results to the given SourceIds. This + * parameter exists in v1. (optional) + * @param eventName A list of strings which filters the results to the given EventNames. This + * parameter exists in v1. (optional) + * @param eventType A list of strings which filters the results to the given EventTypes. This + * parameter exists in v1. (optional) + * @param appVersion A list of strings which filters the results to the given AppVersions. This + * parameter exists in v1. (optional) + * @param pagination Pagination input for event volume by Workspace. This parameter exists in + * v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getEventsVolumeFromWorkspaceCall(String granularity, String startTime, String endTime, List groupBy, List sourceId, List eventName, List eventType, List appVersion, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getEventsVolumeFromWorkspaceCall( + String granularity, + String startTime, + String endTime, + List groupBy, + List sourceId, + List eventName, + List eventType, + List appVersion, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -124,7 +136,8 @@ public okhttp3.Call getEventsVolumeFromWorkspaceCall(String granularity, String Map localVarFormParams = new HashMap(); if (granularity != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("granularity", granularity)); + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("granularity", granularity)); } if (startTime != null) { @@ -136,23 +149,28 @@ public okhttp3.Call getEventsVolumeFromWorkspaceCall(String granularity, String } if (groupBy != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "groupBy", groupBy)); + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "groupBy", groupBy)); } if (sourceId != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "sourceId", sourceId)); + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "sourceId", sourceId)); } if (eventName != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "eventName", eventName)); + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "eventName", eventName)); } if (eventType != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "eventType", eventType)); + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "eventType", eventType)); } if (appVersion != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "appVersion", appVersion)); + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "appVersion", appVersion)); } if (pagination != null) { @@ -160,134 +178,287 @@ public okhttp3.Call getEventsVolumeFromWorkspaceCall(String granularity, String } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getEventsVolumeFromWorkspaceValidateBeforeCall(String granularity, String startTime, String endTime, List groupBy, List sourceId, List eventName, List eventType, List appVersion, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getEventsVolumeFromWorkspaceValidateBeforeCall( + String granularity, + String startTime, + String endTime, + List groupBy, + List sourceId, + List eventName, + List eventType, + List appVersion, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'granularity' is set if (granularity == null) { - throw new ApiException("Missing the required parameter 'granularity' when calling getEventsVolumeFromWorkspace(Async)"); + throw new ApiException( + "Missing the required parameter 'granularity' when calling" + + " getEventsVolumeFromWorkspace(Async)"); } - + // verify the required parameter 'startTime' is set if (startTime == null) { - throw new ApiException("Missing the required parameter 'startTime' when calling getEventsVolumeFromWorkspace(Async)"); + throw new ApiException( + "Missing the required parameter 'startTime' when calling" + + " getEventsVolumeFromWorkspace(Async)"); } - + // verify the required parameter 'endTime' is set if (endTime == null) { - throw new ApiException("Missing the required parameter 'endTime' when calling getEventsVolumeFromWorkspace(Async)"); + throw new ApiException( + "Missing the required parameter 'endTime' when calling" + + " getEventsVolumeFromWorkspace(Async)"); } - - - okhttp3.Call localVarCall = getEventsVolumeFromWorkspaceCall(granularity, startTime, endTime, groupBy, sourceId, eventName, eventType, appVersion, pagination, _callback); - return localVarCall; + return getEventsVolumeFromWorkspaceCall( + granularity, + startTime, + endTime, + groupBy, + sourceId, + eventName, + eventType, + appVersion, + pagination, + _callback); } /** - * Get Events Volume from Workspace - * Enumerates the Workspace event volumes over time in minute increments. The rate limit for this endpoint is 20 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param granularity The size of each bucket in the requested window. This parameter exists in alpha. (required) - * @param startTime The ISO8601 formatted timestamp that corresponds to the beginning of the requested time frame, inclusive. This parameter exists in alpha. (required) - * @param endTime The ISO8601 formatted timestamp that corresponds to the end of the requested time frame, noninclusive. Segment recommends that you lag queries 1 minute behind clock time to reduce the risk for latency to impact the counts. This parameter exists in alpha. (required) - * @param groupBy A comma-delimited list of strings that represents the dimensions to group the result by. The options are: `eventName`, `eventType` and `source`. This parameter exists in alpha. (optional) - * @param sourceId A list of strings which filters the results to the given SourceIds. This parameter exists in alpha. (optional) - * @param eventName A list of strings which filters the results to the given EventNames. This parameter exists in alpha. (optional) - * @param eventType A list of strings which filters the results to the given EventTypes. This parameter exists in alpha. (optional) - * @param appVersion A list of strings which filters the results to the given AppVersions. This parameter exists in alpha. (optional) - * @param pagination Pagination input for event volume by Workspace. This parameter exists in alpha. (optional) + * Get Events Volume from Workspace Enumerates the Workspace event volumes over time in minute + * increments. The rate limit for this endpoint is 60 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param granularity The size of each bucket in the requested window. This parameter exists in + * v1. (required) + * @param startTime The ISO8601 formatted timestamp that corresponds to the beginning of the + * requested time frame, inclusive. This parameter exists in v1. (required) + * @param endTime The ISO8601 formatted timestamp that corresponds to the end of the requested + * time frame, noninclusive. Segment recommends that you lag queries 1 minute behind clock + * time to reduce the risk for latency to impact the counts. This parameter exists in v1. + * (required) + * @param groupBy A comma-delimited list of strings that represents the dimensions to group the + * result by. The options are: `eventName`, `eventType` and + * `source`. This parameter exists in v1. (optional) + * @param sourceId A list of strings which filters the results to the given SourceIds. This + * parameter exists in v1. (optional) + * @param eventName A list of strings which filters the results to the given EventNames. This + * parameter exists in v1. (optional) + * @param eventType A list of strings which filters the results to the given EventTypes. This + * parameter exists in v1. (optional) + * @param appVersion A list of strings which filters the results to the given AppVersions. This + * parameter exists in v1. (optional) + * @param pagination Pagination input for event volume by Workspace. This parameter exists in + * v1. (optional) * @return GetEventsVolumeFromWorkspace200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetEventsVolumeFromWorkspace200Response getEventsVolumeFromWorkspace(String granularity, String startTime, String endTime, List groupBy, List sourceId, List eventName, List eventType, List appVersion, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = getEventsVolumeFromWorkspaceWithHttpInfo(granularity, startTime, endTime, groupBy, sourceId, eventName, eventType, appVersion, pagination); + public GetEventsVolumeFromWorkspace200Response getEventsVolumeFromWorkspace( + String granularity, + String startTime, + String endTime, + List groupBy, + List sourceId, + List eventName, + List eventType, + List appVersion, + PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + getEventsVolumeFromWorkspaceWithHttpInfo( + granularity, + startTime, + endTime, + groupBy, + sourceId, + eventName, + eventType, + appVersion, + pagination); return localVarResp.getData(); } /** - * Get Events Volume from Workspace - * Enumerates the Workspace event volumes over time in minute increments. The rate limit for this endpoint is 20 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param granularity The size of each bucket in the requested window. This parameter exists in alpha. (required) - * @param startTime The ISO8601 formatted timestamp that corresponds to the beginning of the requested time frame, inclusive. This parameter exists in alpha. (required) - * @param endTime The ISO8601 formatted timestamp that corresponds to the end of the requested time frame, noninclusive. Segment recommends that you lag queries 1 minute behind clock time to reduce the risk for latency to impact the counts. This parameter exists in alpha. (required) - * @param groupBy A comma-delimited list of strings that represents the dimensions to group the result by. The options are: `eventName`, `eventType` and `source`. This parameter exists in alpha. (optional) - * @param sourceId A list of strings which filters the results to the given SourceIds. This parameter exists in alpha. (optional) - * @param eventName A list of strings which filters the results to the given EventNames. This parameter exists in alpha. (optional) - * @param eventType A list of strings which filters the results to the given EventTypes. This parameter exists in alpha. (optional) - * @param appVersion A list of strings which filters the results to the given AppVersions. This parameter exists in alpha. (optional) - * @param pagination Pagination input for event volume by Workspace. This parameter exists in alpha. (optional) + * Get Events Volume from Workspace Enumerates the Workspace event volumes over time in minute + * increments. The rate limit for this endpoint is 60 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param granularity The size of each bucket in the requested window. This parameter exists in + * v1. (required) + * @param startTime The ISO8601 formatted timestamp that corresponds to the beginning of the + * requested time frame, inclusive. This parameter exists in v1. (required) + * @param endTime The ISO8601 formatted timestamp that corresponds to the end of the requested + * time frame, noninclusive. Segment recommends that you lag queries 1 minute behind clock + * time to reduce the risk for latency to impact the counts. This parameter exists in v1. + * (required) + * @param groupBy A comma-delimited list of strings that represents the dimensions to group the + * result by. The options are: `eventName`, `eventType` and + * `source`. This parameter exists in v1. (optional) + * @param sourceId A list of strings which filters the results to the given SourceIds. This + * parameter exists in v1. (optional) + * @param eventName A list of strings which filters the results to the given EventNames. This + * parameter exists in v1. (optional) + * @param eventType A list of strings which filters the results to the given EventTypes. This + * parameter exists in v1. (optional) + * @param appVersion A list of strings which filters the results to the given AppVersions. This + * parameter exists in v1. (optional) + * @param pagination Pagination input for event volume by Workspace. This parameter exists in + * v1. (optional) * @return ApiResponse<GetEventsVolumeFromWorkspace200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getEventsVolumeFromWorkspaceWithHttpInfo(String granularity, String startTime, String endTime, List groupBy, List sourceId, List eventName, List eventType, List appVersion, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = getEventsVolumeFromWorkspaceValidateBeforeCall(granularity, startTime, endTime, groupBy, sourceId, eventName, eventType, appVersion, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + getEventsVolumeFromWorkspaceWithHttpInfo( + String granularity, + String startTime, + String endTime, + List groupBy, + List sourceId, + List eventName, + List eventType, + List appVersion, + PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + getEventsVolumeFromWorkspaceValidateBeforeCall( + granularity, + startTime, + endTime, + groupBy, + sourceId, + eventName, + eventType, + appVersion, + pagination, + null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Events Volume from Workspace (asynchronously) - * Enumerates the Workspace event volumes over time in minute increments. The rate limit for this endpoint is 20 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param granularity The size of each bucket in the requested window. This parameter exists in alpha. (required) - * @param startTime The ISO8601 formatted timestamp that corresponds to the beginning of the requested time frame, inclusive. This parameter exists in alpha. (required) - * @param endTime The ISO8601 formatted timestamp that corresponds to the end of the requested time frame, noninclusive. Segment recommends that you lag queries 1 minute behind clock time to reduce the risk for latency to impact the counts. This parameter exists in alpha. (required) - * @param groupBy A comma-delimited list of strings that represents the dimensions to group the result by. The options are: `eventName`, `eventType` and `source`. This parameter exists in alpha. (optional) - * @param sourceId A list of strings which filters the results to the given SourceIds. This parameter exists in alpha. (optional) - * @param eventName A list of strings which filters the results to the given EventNames. This parameter exists in alpha. (optional) - * @param eventType A list of strings which filters the results to the given EventTypes. This parameter exists in alpha. (optional) - * @param appVersion A list of strings which filters the results to the given AppVersions. This parameter exists in alpha. (optional) - * @param pagination Pagination input for event volume by Workspace. This parameter exists in alpha. (optional) + * Get Events Volume from Workspace (asynchronously) Enumerates the Workspace event volumes over + * time in minute increments. The rate limit for this endpoint is 60 requests per minute, which + * is lower than the default due to access pattern restrictions. Once reached, this endpoint + * will respond with the 429 HTTP status code with headers indicating the limit parameters. See + * [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param granularity The size of each bucket in the requested window. This parameter exists in + * v1. (required) + * @param startTime The ISO8601 formatted timestamp that corresponds to the beginning of the + * requested time frame, inclusive. This parameter exists in v1. (required) + * @param endTime The ISO8601 formatted timestamp that corresponds to the end of the requested + * time frame, noninclusive. Segment recommends that you lag queries 1 minute behind clock + * time to reduce the risk for latency to impact the counts. This parameter exists in v1. + * (required) + * @param groupBy A comma-delimited list of strings that represents the dimensions to group the + * result by. The options are: `eventName`, `eventType` and + * `source`. This parameter exists in v1. (optional) + * @param sourceId A list of strings which filters the results to the given SourceIds. This + * parameter exists in v1. (optional) + * @param eventName A list of strings which filters the results to the given EventNames. This + * parameter exists in v1. (optional) + * @param eventType A list of strings which filters the results to the given EventTypes. This + * parameter exists in v1. (optional) + * @param appVersion A list of strings which filters the results to the given AppVersions. This + * parameter exists in v1. (optional) + * @param pagination Pagination input for event volume by Workspace. This parameter exists in + * v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getEventsVolumeFromWorkspaceAsync(String granularity, String startTime, String endTime, List groupBy, List sourceId, List eventName, List eventType, List appVersion, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getEventsVolumeFromWorkspaceValidateBeforeCall(granularity, startTime, endTime, groupBy, sourceId, eventName, eventType, appVersion, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getEventsVolumeFromWorkspaceAsync( + String granularity, + String startTime, + String endTime, + List groupBy, + List sourceId, + List eventName, + List eventType, + List appVersion, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getEventsVolumeFromWorkspaceValidateBeforeCall( + granularity, + startTime, + endTime, + groupBy, + sourceId, + eventName, + eventType, + appVersion, + pagination, + _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/FunctionsApi.java b/src/main/java/com/segment/publicapi/api/FunctionsApi.java index 0323f5b9..9d95867e 100644 --- a/src/main/java/com/segment/publicapi/api/FunctionsApi.java +++ b/src/main/java/com/segment/publicapi/api/FunctionsApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,40 +9,40 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.CreateFunction200Response; import com.segment.publicapi.models.CreateFunctionDeployment200Response; import com.segment.publicapi.models.CreateFunctionV1Input; +import com.segment.publicapi.models.CreateInsertFunctionInstance200Response; +import com.segment.publicapi.models.CreateInsertFunctionInstanceAlphaInput; import com.segment.publicapi.models.DeleteFunction200Response; +import com.segment.publicapi.models.DeleteInsertFunctionInstance200Response; import com.segment.publicapi.models.GetFunction200Response; +import com.segment.publicapi.models.GetFunctionVersion200Response; +import com.segment.publicapi.models.GetInsertFunctionInstance200Response; +import com.segment.publicapi.models.ListFunctionVersions200Response; import com.segment.publicapi.models.ListFunctions200Response; +import com.segment.publicapi.models.ListInsertFunctionInstances200Response; import com.segment.publicapi.models.PaginationInput; -import com.segment.publicapi.models.RequestErrorEnvelope; +import com.segment.publicapi.models.RestoreFunctionVersion200Response; +import com.segment.publicapi.models.RestoreFunctionVersionAlphaInput; import com.segment.publicapi.models.UpdateFunction200Response; import com.segment.publicapi.models.UpdateFunctionV1Input; - +import com.segment.publicapi.models.UpdateInsertFunctionInstance200Response; +import com.segment.publicapi.models.UpdateInsertFunctionInstanceAlphaInput; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class FunctionsApi { private ApiClient localVarApiClient; @@ -84,28 +83,31 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createFunction - * @param createFunctionV1Input (required) + * + * @param createFunctionV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createFunctionCall(CreateFunctionV1Input createFunctionV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createFunctionCall( + CreateFunctionV1Input createFunctionV1Input, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -123,7 +125,10 @@ public okhttp3.Call createFunctionCall(CreateFunctionV1Input createFunctionV1Inp Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -131,119 +136,153 @@ public okhttp3.Call createFunctionCall(CreateFunctionV1Input createFunctionV1Inp } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createFunctionValidateBeforeCall(CreateFunctionV1Input createFunctionV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createFunctionValidateBeforeCall( + CreateFunctionV1Input createFunctionV1Input, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'createFunctionV1Input' is set if (createFunctionV1Input == null) { - throw new ApiException("Missing the required parameter 'createFunctionV1Input' when calling createFunction(Async)"); + throw new ApiException( + "Missing the required parameter 'createFunctionV1Input' when calling" + + " createFunction(Async)"); } - - - okhttp3.Call localVarCall = createFunctionCall(createFunctionV1Input, _callback); - return localVarCall; + return createFunctionCall(createFunctionV1Input, _callback); } /** - * Create Function - * Creates a Function. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param createFunctionV1Input (required) + * Create Function Creates a Function. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Functions feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param createFunctionV1Input (required) * @return CreateFunction200Response - * @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 Resource not found -
422 Validation failure -
429 Too many requests -
- */ - public CreateFunction200Response createFunction(CreateFunctionV1Input createFunctionV1Input) throws ApiException { - ApiResponse localVarResp = createFunctionWithHttpInfo(createFunctionV1Input); + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateFunction200Response createFunction(CreateFunctionV1Input createFunctionV1Input) + throws ApiException { + ApiResponse localVarResp = + createFunctionWithHttpInfo(createFunctionV1Input); return localVarResp.getData(); } /** - * Create Function - * Creates a Function. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param createFunctionV1Input (required) + * Create Function Creates a Function. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Functions feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param createFunctionV1Input (required) * @return ApiResponse<CreateFunction200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createFunctionWithHttpInfo(CreateFunctionV1Input createFunctionV1Input) throws ApiException { + public ApiResponse createFunctionWithHttpInfo( + CreateFunctionV1Input createFunctionV1Input) throws ApiException { okhttp3.Call localVarCall = createFunctionValidateBeforeCall(createFunctionV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Function (asynchronously) - * Creates a Function. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param createFunctionV1Input (required) + * Create Function (asynchronously) Creates a Function. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach + * out to your customer success manager for more information. + * + * @param createFunctionV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createFunctionAsync(CreateFunctionV1Input createFunctionV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createFunctionValidateBeforeCall(createFunctionV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createFunctionAsync( + CreateFunctionV1Input createFunctionV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createFunctionValidateBeforeCall(createFunctionV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for createFunctionDeployment - * @param functionId (required) + * + * @param functionId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createFunctionDeploymentCall(String functionId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createFunctionDeploymentCall(String functionId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -252,8 +291,11 @@ public okhttp3.Call createFunctionDeploymentCall(String functionId, final ApiCal Object localVarPostBody = null; // create path and map variables - String localVarPath = "/functions/{functionId}/deploy" - .replaceAll("\\{" + "functionId" + "\\}", localVarApiClient.escapeString(functionId.toString())); + String localVarPath = + "/functions/{functionId}/deploy" + .replace( + "{" + "functionId" + "}", + localVarApiClient.escapeString(functionId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -262,127 +304,341 @@ public okhttp3.Call createFunctionDeploymentCall(String functionId, final ApiCal Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createFunctionDeploymentValidateBeforeCall(String functionId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createFunctionDeploymentValidateBeforeCall( + String functionId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'functionId' is set if (functionId == null) { - throw new ApiException("Missing the required parameter 'functionId' when calling createFunctionDeployment(Async)"); + throw new ApiException( + "Missing the required parameter 'functionId' when calling" + + " createFunctionDeployment(Async)"); } - - - okhttp3.Call localVarCall = createFunctionDeploymentCall(functionId, _callback); - return localVarCall; + return createFunctionDeploymentCall(functionId, _callback); } /** - * Create Function Deployment - * Deploys a Function. Only applicable to Source Function instances. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param functionId (required) + * Create Function Deployment Deploys a Function. Only applicable to Source Function instances. + * • In order to successfully call this endpoint, the specified Workspace needs to have the + * Functions feature enabled. Please reach out to your customer success manager for more + * information. + * + * @param functionId (required) * @return CreateFunctionDeployment200Response - * @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 Resource not found -
422 Validation failure -
429 Too many requests -
- */ - public CreateFunctionDeployment200Response createFunctionDeployment(String functionId) throws ApiException { - ApiResponse localVarResp = createFunctionDeploymentWithHttpInfo(functionId); + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateFunctionDeployment200Response createFunctionDeployment(String functionId) + throws ApiException { + ApiResponse localVarResp = + createFunctionDeploymentWithHttpInfo(functionId); return localVarResp.getData(); } /** - * Create Function Deployment - * Deploys a Function. Only applicable to Source Function instances. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param functionId (required) + * Create Function Deployment Deploys a Function. Only applicable to Source Function instances. + * • In order to successfully call this endpoint, the specified Workspace needs to have the + * Functions feature enabled. Please reach out to your customer success manager for more + * information. + * + * @param functionId (required) * @return ApiResponse<CreateFunctionDeployment200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createFunctionDeploymentWithHttpInfo(String functionId) throws ApiException { + public ApiResponse createFunctionDeploymentWithHttpInfo( + String functionId) throws ApiException { okhttp3.Call localVarCall = createFunctionDeploymentValidateBeforeCall(functionId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Function Deployment (asynchronously) - * Deploys a Function. Only applicable to Source Function instances. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param functionId (required) + * Create Function Deployment (asynchronously) Deploys a Function. Only applicable to Source + * Function instances. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Functions feature enabled. Please reach out to your customer success + * manager for more information. + * + * @param functionId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createFunctionDeploymentAsync( + String functionId, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createFunctionDeploymentValidateBeforeCall(functionId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createInsertFunctionInstance + * + * @param createInsertFunctionInstanceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createInsertFunctionInstanceCall( + CreateInsertFunctionInstanceAlphaInput createInsertFunctionInstanceAlphaInput, + 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 = createInsertFunctionInstanceAlphaInput; + + // create path and map variables + String localVarPath = "/insert-function-instances"; + + 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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createInsertFunctionInstanceValidateBeforeCall( + CreateInsertFunctionInstanceAlphaInput createInsertFunctionInstanceAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'createInsertFunctionInstanceAlphaInput' is set + if (createInsertFunctionInstanceAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'createInsertFunctionInstanceAlphaInput' when" + + " calling createInsertFunctionInstance(Async)"); + } + + return createInsertFunctionInstanceCall(createInsertFunctionInstanceAlphaInput, _callback); + } + + /** + * Create Insert Function Instance Creates an insert Function instance connected to the given + * Destination. • In order to successfully call this endpoint, the specified Workspace needs to + * have the Functions feature enabled. Please reach out to your customer success manager for + * more information. + * + * @param createInsertFunctionInstanceAlphaInput (required) + * @return CreateInsertFunctionInstance200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateInsertFunctionInstance200Response createInsertFunctionInstance( + CreateInsertFunctionInstanceAlphaInput createInsertFunctionInstanceAlphaInput) + throws ApiException { + ApiResponse localVarResp = + createInsertFunctionInstanceWithHttpInfo(createInsertFunctionInstanceAlphaInput); + return localVarResp.getData(); + } + + /** + * Create Insert Function Instance Creates an insert Function instance connected to the given + * Destination. • In order to successfully call this endpoint, the specified Workspace needs to + * have the Functions feature enabled. Please reach out to your customer success manager for + * more information. + * + * @param createInsertFunctionInstanceAlphaInput (required) + * @return ApiResponse<CreateInsertFunctionInstance200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createFunctionDeploymentAsync(String functionId, final ApiCallback _callback) throws ApiException { + public ApiResponse + createInsertFunctionInstanceWithHttpInfo( + CreateInsertFunctionInstanceAlphaInput createInsertFunctionInstanceAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + createInsertFunctionInstanceValidateBeforeCall( + createInsertFunctionInstanceAlphaInput, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } - okhttp3.Call localVarCall = createFunctionDeploymentValidateBeforeCall(functionId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + /** + * Create Insert Function Instance (asynchronously) Creates an insert Function instance + * connected to the given Destination. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Functions feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param createInsertFunctionInstanceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createInsertFunctionInstanceAsync( + CreateInsertFunctionInstanceAlphaInput createInsertFunctionInstanceAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createInsertFunctionInstanceValidateBeforeCall( + createInsertFunctionInstanceAlphaInput, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for deleteFunction - * @param functionId (required) + * + * @param functionId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteFunctionCall(String functionId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteFunctionCall(String functionId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -391,8 +647,11 @@ public okhttp3.Call deleteFunctionCall(String functionId, final ApiCallback _cal Object localVarPostBody = null; // create path and map variables - String localVarPath = "/functions/{functionId}" - .replaceAll("\\{" + "functionId" + "\\}", localVarApiClient.escapeString(functionId.toString())); + String localVarPath = + "/functions/{functionId}" + .replace( + "{" + "functionId" + "}", + localVarApiClient.escapeString(functionId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -401,127 +660,155 @@ public okhttp3.Call deleteFunctionCall(String functionId, final ApiCallback _cal Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteFunctionValidateBeforeCall(String functionId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call deleteFunctionValidateBeforeCall( + String functionId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'functionId' is set if (functionId == null) { - throw new ApiException("Missing the required parameter 'functionId' when calling deleteFunction(Async)"); + throw new ApiException( + "Missing the required parameter 'functionId' when calling" + + " deleteFunction(Async)"); } - - - okhttp3.Call localVarCall = deleteFunctionCall(functionId, _callback); - return localVarCall; + return deleteFunctionCall(functionId, _callback); } /** - * Delete Function - * Deletes a Function. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param functionId (required) + * Delete Function Deletes a Function. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Functions feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param functionId (required) * @return DeleteFunction200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public DeleteFunction200Response deleteFunction(String functionId) throws ApiException { - ApiResponse localVarResp = deleteFunctionWithHttpInfo(functionId); + ApiResponse localVarResp = + deleteFunctionWithHttpInfo(functionId); return localVarResp.getData(); } /** - * Delete Function - * Deletes a Function. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param functionId (required) + * Delete Function Deletes a Function. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Functions feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param functionId (required) * @return ApiResponse<DeleteFunction200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse deleteFunctionWithHttpInfo(String functionId) throws ApiException { + public ApiResponse deleteFunctionWithHttpInfo(String functionId) + throws ApiException { okhttp3.Call localVarCall = deleteFunctionValidateBeforeCall(functionId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Delete Function (asynchronously) - * Deletes a Function. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param functionId (required) + * Delete Function (asynchronously) Deletes a Function. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach + * out to your customer success manager for more information. + * + * @param functionId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteFunctionAsync(String functionId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteFunctionAsync( + String functionId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = deleteFunctionValidateBeforeCall(functionId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** - * Build call for getFunction - * @param functionId (required) + * Build call for deleteInsertFunctionInstance + * + * @param instanceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getFunctionCall(String functionId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteInsertFunctionInstanceCall( + String instanceId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -530,8 +817,11 @@ public okhttp3.Call getFunctionCall(String functionId, final ApiCallback _callba Object localVarPostBody = null; // create path and map variables - String localVarPath = "/functions/{functionId}" - .replaceAll("\\{" + "functionId" + "\\}", localVarApiClient.escapeString(functionId.toString())); + String localVarPath = + "/insert-function-instances/{instanceId}" + .replace( + "{" + "instanceId" + "}", + localVarApiClient.escapeString(instanceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -540,53 +830,239 @@ public okhttp3.Call getFunctionCall(String functionId, final ApiCallback _callba Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1alpha+json", "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteInsertFunctionInstanceValidateBeforeCall( + String instanceId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'instanceId' is set + if (instanceId == null) { + throw new ApiException( + "Missing the required parameter 'instanceId' when calling" + + " deleteInsertFunctionInstance(Async)"); + } + + return deleteInsertFunctionInstanceCall(instanceId, _callback); + } + + /** + * Delete Insert Function Instance Deletes an insert Function instance. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Functions feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param instanceId (required) + * @return DeleteInsertFunctionInstance200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public DeleteInsertFunctionInstance200Response deleteInsertFunctionInstance(String instanceId) + throws ApiException { + ApiResponse localVarResp = + deleteInsertFunctionInstanceWithHttpInfo(instanceId); + return localVarResp.getData(); + } + + /** + * Delete Insert Function Instance Deletes an insert Function instance. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Functions feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param instanceId (required) + * @return ApiResponse<DeleteInsertFunctionInstance200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + deleteInsertFunctionInstanceWithHttpInfo(String instanceId) throws ApiException { + okhttp3.Call localVarCall = + deleteInsertFunctionInstanceValidateBeforeCall(instanceId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete Insert Function Instance (asynchronously) Deletes an insert Function instance. • In + * order to successfully call this endpoint, the specified Workspace needs to have the Functions + * feature enabled. Please reach out to your customer success manager for more information. + * + * @param instanceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call deleteInsertFunctionInstanceAsync( + String instanceId, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteInsertFunctionInstanceValidateBeforeCall(instanceId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getFunction + * + * @param functionId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getFunctionCall(String functionId, 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 = + "/functions/{functionId}" + .replace( + "{" + "functionId" + "}", + localVarApiClient.escapeString(functionId.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.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + 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[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getFunctionValidateBeforeCall(String functionId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getFunctionValidateBeforeCall( + String functionId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'functionId' is set if (functionId == null) { - throw new ApiException("Missing the required parameter 'functionId' when calling getFunction(Async)"); + throw new ApiException( + "Missing the required parameter 'functionId' when calling getFunction(Async)"); } - - - okhttp3.Call localVarCall = getFunctionCall(functionId, _callback); - return localVarCall; + return getFunctionCall(functionId, _callback); } /** - * Get Function - * Gets a Function. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param functionId (required) + * Get Function Gets a Function. • In order to successfully call this endpoint, the specified + * Workspace needs to have the Functions feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param functionId (required) * @return GetFunction200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public GetFunction200Response getFunction(String functionId) throws ApiException { ApiResponse localVarResp = getFunctionWithHttpInfo(functionId); @@ -594,74 +1070,86 @@ public GetFunction200Response getFunction(String functionId) throws ApiException } /** - * Get Function - * Gets a Function. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param functionId (required) + * Get Function Gets a Function. • In order to successfully call this endpoint, the specified + * Workspace needs to have the Functions feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param functionId (required) * @return ApiResponse<GetFunction200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getFunctionWithHttpInfo(String functionId) throws ApiException { + public ApiResponse getFunctionWithHttpInfo(String functionId) + throws ApiException { okhttp3.Call localVarCall = getFunctionValidateBeforeCall(functionId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Function (asynchronously) - * Gets a Function. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param functionId (required) + * Get Function (asynchronously) Gets a Function. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Functions feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param functionId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getFunctionAsync(String functionId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getFunctionAsync( + String functionId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = getFunctionValidateBeforeCall(functionId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** - * Build call for listFunctions - * @param pagination Pagination parameters. This parameter exists in alpha. (required) - * @param resourceType The Function type. Config API note: equal to `type`. This parameter exists in alpha. (required) + * Build call for getFunctionVersion + * + * @param functionId (required) + * @param versionId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listFunctionsCall(PaginationInput pagination, String resourceType, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getFunctionVersionCall( + String functionId, String versionId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -670,7 +1158,14 @@ public okhttp3.Call listFunctionsCall(PaginationInput pagination, String resourc Object localVarPostBody = null; // create path and map variables - String localVarPath = "/functions"; + String localVarPath = + "/functions/{functionId}/versions/{versionId}" + .replace( + "{" + "functionId" + "}", + localVarApiClient.escapeString(functionId.toString())) + .replace( + "{" + "versionId" + "}", + localVarApiClient.escapeString(versionId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -678,155 +1173,181 @@ public okhttp3.Call listFunctionsCall(PaginationInput pagination, String resourc Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (pagination != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); - } - - if (resourceType != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("resourceType", resourceType)); - } - final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1alpha+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); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listFunctionsValidateBeforeCall(PaginationInput pagination, String resourceType, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listFunctions(Async)"); - } - - // verify the required parameter 'resourceType' is set - if (resourceType == null) { - throw new ApiException("Missing the required parameter 'resourceType' when calling listFunctions(Async)"); + private okhttp3.Call getFunctionVersionValidateBeforeCall( + String functionId, String versionId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'functionId' is set + if (functionId == null) { + throw new ApiException( + "Missing the required parameter 'functionId' when calling" + + " getFunctionVersion(Async)"); } - - okhttp3.Call localVarCall = listFunctionsCall(pagination, resourceType, _callback); - return localVarCall; + // verify the required parameter 'versionId' is set + if (versionId == null) { + throw new ApiException( + "Missing the required parameter 'versionId' when calling" + + " getFunctionVersion(Async)"); + } + return getFunctionVersionCall(functionId, versionId, _callback); } /** - * List Functions - * Lists all Functions in a Workspace. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param pagination Pagination parameters. This parameter exists in alpha. (required) - * @param resourceType The Function type. Config API note: equal to `type`. This parameter exists in alpha. (required) - * @return ListFunctions200Response - * @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 Resource not found -
422 Validation failure -
429 Too many requests -
- */ - public ListFunctions200Response listFunctions(PaginationInput pagination, String resourceType) throws ApiException { - ApiResponse localVarResp = listFunctionsWithHttpInfo(pagination, resourceType); + * Get Function Version Gets a Function version. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Functions feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param functionId (required) + * @param versionId (required) + * @return GetFunctionVersion200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetFunctionVersion200Response getFunctionVersion(String functionId, String versionId) + throws ApiException { + ApiResponse localVarResp = + getFunctionVersionWithHttpInfo(functionId, versionId); return localVarResp.getData(); } /** - * List Functions - * Lists all Functions in a Workspace. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param pagination Pagination parameters. This parameter exists in alpha. (required) - * @param resourceType The Function type. Config API note: equal to `type`. This parameter exists in alpha. (required) - * @return ApiResponse<ListFunctions200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * Get Function Version Gets a Function version. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Functions feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param functionId (required) + * @param versionId (required) + * @return ApiResponse<GetFunctionVersion200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listFunctionsWithHttpInfo(PaginationInput pagination, String resourceType) throws ApiException { - okhttp3.Call localVarCall = listFunctionsValidateBeforeCall(pagination, resourceType, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse getFunctionVersionWithHttpInfo( + String functionId, String versionId) throws ApiException { + okhttp3.Call localVarCall = + getFunctionVersionValidateBeforeCall(functionId, versionId, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Functions (asynchronously) - * Lists all Functions in a Workspace. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. - * @param pagination Pagination parameters. This parameter exists in alpha. (required) - * @param resourceType The Function type. Config API note: equal to `type`. This parameter exists in alpha. (required) + * Get Function Version (asynchronously) Gets a Function version. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Functions feature enabled. + * Please reach out to your customer success manager for more information. + * + * @param functionId (required) + * @param versionId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listFunctionsAsync(PaginationInput pagination, String resourceType, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listFunctionsValidateBeforeCall(pagination, resourceType, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getFunctionVersionAsync( + String functionId, + String versionId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getFunctionVersionValidateBeforeCall(functionId, versionId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** - * Build call for updateFunction - * @param functionId (required) - * @param updateFunctionV1Input (required) + * Build call for getInsertFunctionInstance + * + * @param instanceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateFunctionCall(String functionId, UpdateFunctionV1Input updateFunctionV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getInsertFunctionInstanceCall( + String instanceId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } - Object localVarPostBody = updateFunctionV1Input; + Object localVarPostBody = null; // create path and map variables - String localVarPath = "/functions/{functionId}" - .replaceAll("\\{" + "functionId" + "\\}", localVarApiClient.escapeString(functionId.toString())); + String localVarPath = + "/insert-function-instances/{instanceId}" + .replace( + "{" + "instanceId" + "}", + localVarApiClient.escapeString(instanceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -835,108 +1356,1286 @@ public okhttp3.Call updateFunctionCall(String functionId, UpdateFunctionV1Input Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1alpha+json", "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateFunctionValidateBeforeCall(String functionId, UpdateFunctionV1Input updateFunctionV1Input, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'functionId' is set - if (functionId == null) { - throw new ApiException("Missing the required parameter 'functionId' when calling updateFunction(Async)"); + private okhttp3.Call getInsertFunctionInstanceValidateBeforeCall( + String instanceId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'instanceId' is set + if (instanceId == null) { + throw new ApiException( + "Missing the required parameter 'instanceId' when calling" + + " getInsertFunctionInstance(Async)"); } - - // verify the required parameter 'updateFunctionV1Input' is set - if (updateFunctionV1Input == null) { - throw new ApiException("Missing the required parameter 'updateFunctionV1Input' when calling updateFunction(Async)"); - } - - - okhttp3.Call localVarCall = updateFunctionCall(functionId, updateFunctionV1Input, _callback); - return localVarCall; + return getInsertFunctionInstanceCall(instanceId, _callback); } /** - * Update Function - * Updates a Function. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. Config API omitted fields: - `updateMask` - * @param functionId (required) - * @param updateFunctionV1Input (required) - * @return UpdateFunction200Response - * @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 Resource not found -
422 Validation failure -
429 Too many requests -
- */ - public UpdateFunction200Response updateFunction(String functionId, UpdateFunctionV1Input updateFunctionV1Input) throws ApiException { - ApiResponse localVarResp = updateFunctionWithHttpInfo(functionId, updateFunctionV1Input); + * Get Insert Function Instance Gets an insert Function instance. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Functions feature enabled. + * Please reach out to your customer success manager for more information. + * + * @param instanceId (required) + * @return GetInsertFunctionInstance200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetInsertFunctionInstance200Response getInsertFunctionInstance(String instanceId) + throws ApiException { + ApiResponse localVarResp = + getInsertFunctionInstanceWithHttpInfo(instanceId); return localVarResp.getData(); } /** - * Update Function - * Updates a Function. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. Config API omitted fields: - `updateMask` - * @param functionId (required) - * @param updateFunctionV1Input (required) - * @return ApiResponse<UpdateFunction200Response> - * @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 Resource not found -
422 Validation failure -
429 Too many requests -
- */ - public ApiResponse updateFunctionWithHttpInfo(String functionId, UpdateFunctionV1Input updateFunctionV1Input) throws ApiException { - okhttp3.Call localVarCall = updateFunctionValidateBeforeCall(functionId, updateFunctionV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + * Get Insert Function Instance Gets an insert Function instance. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Functions feature enabled. + * Please reach out to your customer success manager for more information. + * + * @param instanceId (required) + * @return ApiResponse<GetInsertFunctionInstance200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse getInsertFunctionInstanceWithHttpInfo( + String instanceId) throws ApiException { + okhttp3.Call localVarCall = getInsertFunctionInstanceValidateBeforeCall(instanceId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Function (asynchronously) - * Updates a Function. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach out to your customer success manager for more information. Config API omitted fields: - `updateMask` - * @param functionId (required) - * @param updateFunctionV1Input (required) + * Get Insert Function Instance (asynchronously) Gets an insert Function instance. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Functions feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param instanceId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getInsertFunctionInstanceAsync( + String instanceId, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getInsertFunctionInstanceValidateBeforeCall(instanceId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listFunctionVersions + * + * @param functionId (required) + * @param pagination Pagination parameters. This parameter exists in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateFunctionAsync(String functionId, UpdateFunctionV1Input updateFunctionV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listFunctionVersionsCall( + String functionId, PaginationInput pagination, 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 = + "/functions/{functionId}/versions" + .replace( + "{" + "functionId" + "}", + localVarApiClient.escapeString(functionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listFunctionVersionsValidateBeforeCall( + String functionId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'functionId' is set + if (functionId == null) { + throw new ApiException( + "Missing the required parameter 'functionId' when calling" + + " listFunctionVersions(Async)"); + } + + return listFunctionVersionsCall(functionId, pagination, _callback); + } - okhttp3.Call localVarCall = updateFunctionValidateBeforeCall(functionId, updateFunctionV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + /** + * List Function Versions Lists versions for a Function in a Workspace. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Functions feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param functionId (required) + * @param pagination Pagination parameters. This parameter exists in alpha. (optional) + * @return ListFunctionVersions200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListFunctionVersions200Response listFunctionVersions( + String functionId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listFunctionVersionsWithHttpInfo(functionId, pagination); + return localVarResp.getData(); + } + + /** + * List Function Versions Lists versions for a Function in a Workspace. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Functions feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param functionId (required) + * @param pagination Pagination parameters. This parameter exists in alpha. (optional) + * @return ApiResponse<ListFunctionVersions200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse listFunctionVersionsWithHttpInfo( + String functionId, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + listFunctionVersionsValidateBeforeCall(functionId, pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Function Versions (asynchronously) Lists versions for a Function in a Workspace. • In + * order to successfully call this endpoint, the specified Workspace needs to have the Functions + * feature enabled. Please reach out to your customer success manager for more information. + * + * @param functionId (required) + * @param pagination Pagination parameters. This parameter exists in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listFunctionVersionsAsync( + String functionId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listFunctionVersionsValidateBeforeCall(functionId, pagination, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listFunctions + * + * @param pagination Pagination parameters. This parameter exists in v1. (optional) + * @param resourceType The Function type. Config API note: equal to `type`. This + * parameter exists in v1. (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listFunctionsCall( + PaginationInput pagination, String resourceType, 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 = "/functions"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + if (resourceType != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("resourceType", resourceType)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listFunctionsValidateBeforeCall( + PaginationInput pagination, String resourceType, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'resourceType' is set + if (resourceType == null) { + throw new ApiException( + "Missing the required parameter 'resourceType' when calling" + + " listFunctions(Async)"); + } + + return listFunctionsCall(pagination, resourceType, _callback); + } + + /** + * List Functions Lists all Functions in a Workspace. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach + * out to your customer success manager for more information. + * + * @param pagination Pagination parameters. This parameter exists in v1. (optional) + * @param resourceType The Function type. Config API note: equal to `type`. This + * parameter exists in v1. (required) + * @return ListFunctions200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListFunctions200Response listFunctions(PaginationInput pagination, String resourceType) + throws ApiException { + ApiResponse localVarResp = + listFunctionsWithHttpInfo(pagination, resourceType); + return localVarResp.getData(); + } + + /** + * List Functions Lists all Functions in a Workspace. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach + * out to your customer success manager for more information. + * + * @param pagination Pagination parameters. This parameter exists in v1. (optional) + * @param resourceType The Function type. Config API note: equal to `type`. This + * parameter exists in v1. (required) + * @return ApiResponse<ListFunctions200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse listFunctionsWithHttpInfo( + PaginationInput pagination, String resourceType) throws ApiException { + okhttp3.Call localVarCall = listFunctionsValidateBeforeCall(pagination, resourceType, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Functions (asynchronously) Lists all Functions in a Workspace. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Functions feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param pagination Pagination parameters. This parameter exists in v1. (optional) + * @param resourceType The Function type. Config API note: equal to `type`. This + * parameter exists in v1. (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listFunctionsAsync( + PaginationInput pagination, + String resourceType, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listFunctionsValidateBeforeCall(pagination, resourceType, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listInsertFunctionInstances + * + * @param pagination Pagination parameters. This parameter exists in alpha. (optional) + * @param functionId The insert Function class id to lookup. This parameter exists in alpha. + * (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listInsertFunctionInstancesCall( + PaginationInput pagination, String functionId, 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 = "/insert-function-instances"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + if (functionId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("functionId", functionId)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listInsertFunctionInstancesValidateBeforeCall( + PaginationInput pagination, String functionId, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'functionId' is set + if (functionId == null) { + throw new ApiException( + "Missing the required parameter 'functionId' when calling" + + " listInsertFunctionInstances(Async)"); + } + + return listInsertFunctionInstancesCall(pagination, functionId, _callback); + } + + /** + * List Insert Function Instances Lists all insert Function instances connected to the given + * insert Function. • In order to successfully call this endpoint, the specified Workspace needs + * to have the Functions feature enabled. Please reach out to your customer success manager for + * more information. + * + * @param pagination Pagination parameters. This parameter exists in alpha. (optional) + * @param functionId The insert Function class id to lookup. This parameter exists in alpha. + * (required) + * @return ListInsertFunctionInstances200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListInsertFunctionInstances200Response listInsertFunctionInstances( + PaginationInput pagination, String functionId) throws ApiException { + ApiResponse localVarResp = + listInsertFunctionInstancesWithHttpInfo(pagination, functionId); + return localVarResp.getData(); + } + + /** + * List Insert Function Instances Lists all insert Function instances connected to the given + * insert Function. • In order to successfully call this endpoint, the specified Workspace needs + * to have the Functions feature enabled. Please reach out to your customer success manager for + * more information. + * + * @param pagination Pagination parameters. This parameter exists in alpha. (optional) + * @param functionId The insert Function class id to lookup. This parameter exists in alpha. + * (required) + * @return ApiResponse<ListInsertFunctionInstances200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + listInsertFunctionInstancesWithHttpInfo(PaginationInput pagination, String functionId) + throws ApiException { + okhttp3.Call localVarCall = + listInsertFunctionInstancesValidateBeforeCall(pagination, functionId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Insert Function Instances (asynchronously) Lists all insert Function instances connected + * to the given insert Function. • In order to successfully call this endpoint, the specified + * Workspace needs to have the Functions feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param pagination Pagination parameters. This parameter exists in alpha. (optional) + * @param functionId The insert Function class id to lookup. This parameter exists in alpha. + * (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listInsertFunctionInstancesAsync( + PaginationInput pagination, + String functionId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listInsertFunctionInstancesValidateBeforeCall(pagination, functionId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for restoreFunctionVersion + * + * @param functionId (required) + * @param restoreFunctionVersionAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call restoreFunctionVersionCall( + String functionId, + RestoreFunctionVersionAlphaInput restoreFunctionVersionAlphaInput, + 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 = restoreFunctionVersionAlphaInput; + + // create path and map variables + String localVarPath = + "/functions/{functionId}/versions" + .replace( + "{" + "functionId" + "}", + localVarApiClient.escapeString(functionId.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call restoreFunctionVersionValidateBeforeCall( + String functionId, + RestoreFunctionVersionAlphaInput restoreFunctionVersionAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'functionId' is set + if (functionId == null) { + throw new ApiException( + "Missing the required parameter 'functionId' when calling" + + " restoreFunctionVersion(Async)"); + } + + // verify the required parameter 'restoreFunctionVersionAlphaInput' is set + if (restoreFunctionVersionAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'restoreFunctionVersionAlphaInput' when calling" + + " restoreFunctionVersion(Async)"); + } + + return restoreFunctionVersionCall(functionId, restoreFunctionVersionAlphaInput, _callback); + } + + /** + * Restore Function Version Restore an old Function version as the latest version. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Functions feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param functionId (required) + * @param restoreFunctionVersionAlphaInput (required) + * @return RestoreFunctionVersion200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public RestoreFunctionVersion200Response restoreFunctionVersion( + String functionId, RestoreFunctionVersionAlphaInput restoreFunctionVersionAlphaInput) + throws ApiException { + ApiResponse localVarResp = + restoreFunctionVersionWithHttpInfo(functionId, restoreFunctionVersionAlphaInput); + return localVarResp.getData(); + } + + /** + * Restore Function Version Restore an old Function version as the latest version. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Functions feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param functionId (required) + * @param restoreFunctionVersionAlphaInput (required) + * @return ApiResponse<RestoreFunctionVersion200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse restoreFunctionVersionWithHttpInfo( + String functionId, RestoreFunctionVersionAlphaInput restoreFunctionVersionAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + restoreFunctionVersionValidateBeforeCall( + functionId, restoreFunctionVersionAlphaInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Restore Function Version (asynchronously) Restore an old Function version as the latest + * version. • In order to successfully call this endpoint, the specified Workspace needs to have + * the Functions feature enabled. Please reach out to your customer success manager for more + * information. + * + * @param functionId (required) + * @param restoreFunctionVersionAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call restoreFunctionVersionAsync( + String functionId, + RestoreFunctionVersionAlphaInput restoreFunctionVersionAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + restoreFunctionVersionValidateBeforeCall( + functionId, restoreFunctionVersionAlphaInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateFunction + * + * @param functionId (required) + * @param updateFunctionV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateFunctionCall( + String functionId, + UpdateFunctionV1Input updateFunctionV1Input, + 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 = updateFunctionV1Input; + + // create path and map variables + String localVarPath = + "/functions/{functionId}" + .replace( + "{" + "functionId" + "}", + localVarApiClient.escapeString(functionId.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.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" + }; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateFunctionValidateBeforeCall( + String functionId, + UpdateFunctionV1Input updateFunctionV1Input, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'functionId' is set + if (functionId == null) { + throw new ApiException( + "Missing the required parameter 'functionId' when calling" + + " updateFunction(Async)"); + } + + // verify the required parameter 'updateFunctionV1Input' is set + if (updateFunctionV1Input == null) { + throw new ApiException( + "Missing the required parameter 'updateFunctionV1Input' when calling" + + " updateFunction(Async)"); + } + + return updateFunctionCall(functionId, updateFunctionV1Input, _callback); + } + + /** + * Update Function Updates a Function. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Functions feature enabled. Please reach out to your + * customer success manager for more information. Config API omitted fields: - + * `updateMask` + * + * @param functionId (required) + * @param updateFunctionV1Input (required) + * @return UpdateFunction200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public UpdateFunction200Response updateFunction( + String functionId, UpdateFunctionV1Input updateFunctionV1Input) throws ApiException { + ApiResponse localVarResp = + updateFunctionWithHttpInfo(functionId, updateFunctionV1Input); + return localVarResp.getData(); + } + + /** + * Update Function Updates a Function. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Functions feature enabled. Please reach out to your + * customer success manager for more information. Config API omitted fields: - + * `updateMask` + * + * @param functionId (required) + * @param updateFunctionV1Input (required) + * @return ApiResponse<UpdateFunction200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse updateFunctionWithHttpInfo( + String functionId, UpdateFunctionV1Input updateFunctionV1Input) throws ApiException { + okhttp3.Call localVarCall = + updateFunctionValidateBeforeCall(functionId, updateFunctionV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Function (asynchronously) Updates a Function. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Functions feature enabled. Please reach + * out to your customer success manager for more information. Config API omitted fields: - + * `updateMask` + * + * @param functionId (required) + * @param updateFunctionV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateFunctionAsync( + String functionId, + UpdateFunctionV1Input updateFunctionV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateFunctionValidateBeforeCall(functionId, updateFunctionV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateInsertFunctionInstance + * + * @param instanceId (required) + * @param updateInsertFunctionInstanceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateInsertFunctionInstanceCall( + String instanceId, + UpdateInsertFunctionInstanceAlphaInput updateInsertFunctionInstanceAlphaInput, + 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 = updateInsertFunctionInstanceAlphaInput; + + // create path and map variables + String localVarPath = + "/insert-function-instances/{instanceId}" + .replace( + "{" + "instanceId" + "}", + localVarApiClient.escapeString(instanceId.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateInsertFunctionInstanceValidateBeforeCall( + String instanceId, + UpdateInsertFunctionInstanceAlphaInput updateInsertFunctionInstanceAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'instanceId' is set + if (instanceId == null) { + throw new ApiException( + "Missing the required parameter 'instanceId' when calling" + + " updateInsertFunctionInstance(Async)"); + } + + // verify the required parameter 'updateInsertFunctionInstanceAlphaInput' is set + if (updateInsertFunctionInstanceAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'updateInsertFunctionInstanceAlphaInput' when" + + " calling updateInsertFunctionInstance(Async)"); + } + + return updateInsertFunctionInstanceCall( + instanceId, updateInsertFunctionInstanceAlphaInput, _callback); + } + + /** + * Update Insert Function Instance Updates an insert Function instance connected to the given + * Destination. • In order to successfully call this endpoint, the specified Workspace needs to + * have the Functions feature enabled. Please reach out to your customer success manager for + * more information. + * + * @param instanceId (required) + * @param updateInsertFunctionInstanceAlphaInput (required) + * @return UpdateInsertFunctionInstance200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public UpdateInsertFunctionInstance200Response updateInsertFunctionInstance( + String instanceId, + UpdateInsertFunctionInstanceAlphaInput updateInsertFunctionInstanceAlphaInput) + throws ApiException { + ApiResponse localVarResp = + updateInsertFunctionInstanceWithHttpInfo( + instanceId, updateInsertFunctionInstanceAlphaInput); + return localVarResp.getData(); + } + + /** + * Update Insert Function Instance Updates an insert Function instance connected to the given + * Destination. • In order to successfully call this endpoint, the specified Workspace needs to + * have the Functions feature enabled. Please reach out to your customer success manager for + * more information. + * + * @param instanceId (required) + * @param updateInsertFunctionInstanceAlphaInput (required) + * @return ApiResponse<UpdateInsertFunctionInstance200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + updateInsertFunctionInstanceWithHttpInfo( + String instanceId, + UpdateInsertFunctionInstanceAlphaInput updateInsertFunctionInstanceAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + updateInsertFunctionInstanceValidateBeforeCall( + instanceId, updateInsertFunctionInstanceAlphaInput, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Insert Function Instance (asynchronously) Updates an insert Function instance + * connected to the given Destination. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Functions feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param instanceId (required) + * @param updateInsertFunctionInstanceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateInsertFunctionInstanceAsync( + String instanceId, + UpdateInsertFunctionInstanceAlphaInput updateInsertFunctionInstanceAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateInsertFunctionInstanceValidateBeforeCall( + instanceId, updateInsertFunctionInstanceAlphaInput, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/IamGroupsApi.java b/src/main/java/com/segment/publicapi/api/IamGroupsApi.java index ec08ca90..912fc0e6 100644 --- a/src/main/java/com/segment/publicapi/api/IamGroupsApi.java +++ b/src/main/java/com/segment/publicapi/api/IamGroupsApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,23 +9,15 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.AddPermissionsToUserGroup200Response; import com.segment.publicapi.models.AddPermissionsToUserGroupV1Input; import com.segment.publicapi.models.AddUsersToUserGroup200Response; @@ -44,16 +35,13 @@ import com.segment.publicapi.models.ReplacePermissionsForUserGroupV1Input; import com.segment.publicapi.models.ReplaceUsersInUserGroup200Response; import com.segment.publicapi.models.ReplaceUsersInUserGroupV1Input; -import com.segment.publicapi.models.RequestErrorEnvelope; import com.segment.publicapi.models.UpdateUserGroup200Response; import com.segment.publicapi.models.UpdateUserGroupV1Input; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class IamGroupsApi { private ApiClient localVarApiClient; @@ -94,29 +82,34 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for addPermissionsToUserGroup - * @param userGroupId (required) - * @param addPermissionsToUserGroupV1Input (required) + * + * @param userGroupId (required) + * @param addPermissionsToUserGroupV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call addPermissionsToUserGroupCall(String userGroupId, AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call addPermissionsToUserGroupCall( + String userGroupId, + AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -125,8 +118,11 @@ public okhttp3.Call addPermissionsToUserGroupCall(String userGroupId, AddPermiss Object localVarPostBody = addPermissionsToUserGroupV1Input; // create path and map variables - String localVarPath = "/groups/{userGroupId}/permissions" - .replaceAll("\\{" + "userGroupId" + "\\}", localVarApiClient.escapeString(userGroupId.toString())); + String localVarPath = + "/groups/{userGroupId}/permissions" + .replace( + "{" + "userGroupId" + "}", + localVarApiClient.escapeString(userGroupId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -135,7 +131,10 @@ public okhttp3.Call addPermissionsToUserGroupCall(String userGroupId, AddPermiss Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -143,128 +142,191 @@ public okhttp3.Call addPermissionsToUserGroupCall(String userGroupId, AddPermiss } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call addPermissionsToUserGroupValidateBeforeCall(String userGroupId, AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call addPermissionsToUserGroupValidateBeforeCall( + String userGroupId, + AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'userGroupId' is set if (userGroupId == null) { - throw new ApiException("Missing the required parameter 'userGroupId' when calling addPermissionsToUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'userGroupId' when calling" + + " addPermissionsToUserGroup(Async)"); } - + // verify the required parameter 'addPermissionsToUserGroupV1Input' is set if (addPermissionsToUserGroupV1Input == null) { - throw new ApiException("Missing the required parameter 'addPermissionsToUserGroupV1Input' when calling addPermissionsToUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'addPermissionsToUserGroupV1Input' when calling" + + " addPermissionsToUserGroup(Async)"); } - - - okhttp3.Call localVarCall = addPermissionsToUserGroupCall(userGroupId, addPermissionsToUserGroupV1Input, _callback); - return localVarCall; + return addPermissionsToUserGroupCall( + userGroupId, addPermissionsToUserGroupV1Input, _callback); } /** - * Add Permissions to User Group - * Adds a list of access permissions to a user group. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Policy Created * User Group Policy Updated The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param addPermissionsToUserGroupV1Input (required) + * Add Permissions to User Group Adds a list of access permissions to a user group. • When + * called, this endpoint may generate one or more of the following [audit + * trail](/tag/Audit-Trail) events:* Policy Created * User Group Policy Updated The rate limit + * for this endpoint is 60 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param userGroupId (required) + * @param addPermissionsToUserGroupV1Input (required) * @return AddPermissionsToUserGroup200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public AddPermissionsToUserGroup200Response addPermissionsToUserGroup(String userGroupId, AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input) throws ApiException { - ApiResponse localVarResp = addPermissionsToUserGroupWithHttpInfo(userGroupId, addPermissionsToUserGroupV1Input); + public AddPermissionsToUserGroup200Response addPermissionsToUserGroup( + String userGroupId, AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input) + throws ApiException { + ApiResponse localVarResp = + addPermissionsToUserGroupWithHttpInfo( + userGroupId, addPermissionsToUserGroupV1Input); return localVarResp.getData(); } /** - * Add Permissions to User Group - * Adds a list of access permissions to a user group. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Policy Created * User Group Policy Updated The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param addPermissionsToUserGroupV1Input (required) + * Add Permissions to User Group Adds a list of access permissions to a user group. • When + * called, this endpoint may generate one or more of the following [audit + * trail](/tag/Audit-Trail) events:* Policy Created * User Group Policy Updated The rate limit + * for this endpoint is 60 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param userGroupId (required) + * @param addPermissionsToUserGroupV1Input (required) * @return ApiResponse<AddPermissionsToUserGroup200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse addPermissionsToUserGroupWithHttpInfo(String userGroupId, AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input) throws ApiException { - okhttp3.Call localVarCall = addPermissionsToUserGroupValidateBeforeCall(userGroupId, addPermissionsToUserGroupV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse addPermissionsToUserGroupWithHttpInfo( + String userGroupId, AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input) + throws ApiException { + okhttp3.Call localVarCall = + addPermissionsToUserGroupValidateBeforeCall( + userGroupId, addPermissionsToUserGroupV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Add Permissions to User Group (asynchronously) - * Adds a list of access permissions to a user group. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Policy Created * User Group Policy Updated The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param addPermissionsToUserGroupV1Input (required) + * Add Permissions to User Group (asynchronously) Adds a list of access permissions to a user + * group. • When called, this endpoint may generate one or more of the following [audit + * trail](/tag/Audit-Trail) events:* Policy Created * User Group Policy Updated The rate limit + * for this endpoint is 60 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param userGroupId (required) + * @param addPermissionsToUserGroupV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call addPermissionsToUserGroupAsync(String userGroupId, AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = addPermissionsToUserGroupValidateBeforeCall(userGroupId, addPermissionsToUserGroupV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call addPermissionsToUserGroupAsync( + String userGroupId, + AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addPermissionsToUserGroupValidateBeforeCall( + userGroupId, addPermissionsToUserGroupV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for addUsersToUserGroup - * @param userGroupId (required) - * @param addUsersToUserGroupV1Input (required) + * + * @param userGroupId (required) + * @param addUsersToUserGroupV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call addUsersToUserGroupCall(String userGroupId, AddUsersToUserGroupV1Input addUsersToUserGroupV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call addUsersToUserGroupCall( + String userGroupId, + AddUsersToUserGroupV1Input addUsersToUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -273,8 +335,11 @@ public okhttp3.Call addUsersToUserGroupCall(String userGroupId, AddUsersToUserGr Object localVarPostBody = addUsersToUserGroupV1Input; // create path and map variables - String localVarPath = "/groups/{userGroupId}/users" - .replaceAll("\\{" + "userGroupId" + "\\}", localVarApiClient.escapeString(userGroupId.toString())); + String localVarPath = + "/groups/{userGroupId}/users" + .replace( + "{" + "userGroupId" + "}", + localVarApiClient.escapeString(userGroupId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -283,7 +348,10 @@ public okhttp3.Call addUsersToUserGroupCall(String userGroupId, AddUsersToUserGr Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -291,127 +359,182 @@ public okhttp3.Call addUsersToUserGroupCall(String userGroupId, AddUsersToUserGr } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call addUsersToUserGroupValidateBeforeCall(String userGroupId, AddUsersToUserGroupV1Input addUsersToUserGroupV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call addUsersToUserGroupValidateBeforeCall( + String userGroupId, + AddUsersToUserGroupV1Input addUsersToUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'userGroupId' is set if (userGroupId == null) { - throw new ApiException("Missing the required parameter 'userGroupId' when calling addUsersToUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'userGroupId' when calling" + + " addUsersToUserGroup(Async)"); } - + // verify the required parameter 'addUsersToUserGroupV1Input' is set if (addUsersToUserGroupV1Input == null) { - throw new ApiException("Missing the required parameter 'addUsersToUserGroupV1Input' when calling addUsersToUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'addUsersToUserGroupV1Input' when calling" + + " addUsersToUserGroup(Async)"); } - - - okhttp3.Call localVarCall = addUsersToUserGroupCall(userGroupId, addUsersToUserGroupV1Input, _callback); - return localVarCall; + return addUsersToUserGroupCall(userGroupId, addUsersToUserGroupV1Input, _callback); } /** - * Add Users to User Group - * Adds a list of users or invites to a user group. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Subjects Added to Group * User Added To User Group The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param addUsersToUserGroupV1Input (required) + * Add Users to User Group Adds a list of users or invites to a user group. • When called, this + * endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* + * Subjects Added to Group * User Added To User Group The rate limit for this endpoint is 60 + * requests per minute, which is lower than the default due to access pattern restrictions. Once + * reached, this endpoint will respond with the 429 HTTP status code with headers indicating the + * limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param addUsersToUserGroupV1Input (required) * @return AddUsersToUserGroup200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public AddUsersToUserGroup200Response addUsersToUserGroup(String userGroupId, AddUsersToUserGroupV1Input addUsersToUserGroupV1Input) throws ApiException { - ApiResponse localVarResp = addUsersToUserGroupWithHttpInfo(userGroupId, addUsersToUserGroupV1Input); + public AddUsersToUserGroup200Response addUsersToUserGroup( + String userGroupId, AddUsersToUserGroupV1Input addUsersToUserGroupV1Input) + throws ApiException { + ApiResponse localVarResp = + addUsersToUserGroupWithHttpInfo(userGroupId, addUsersToUserGroupV1Input); return localVarResp.getData(); } /** - * Add Users to User Group - * Adds a list of users or invites to a user group. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Subjects Added to Group * User Added To User Group The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param addUsersToUserGroupV1Input (required) + * Add Users to User Group Adds a list of users or invites to a user group. • When called, this + * endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* + * Subjects Added to Group * User Added To User Group The rate limit for this endpoint is 60 + * requests per minute, which is lower than the default due to access pattern restrictions. Once + * reached, this endpoint will respond with the 429 HTTP status code with headers indicating the + * limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param addUsersToUserGroupV1Input (required) * @return ApiResponse<AddUsersToUserGroup200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse addUsersToUserGroupWithHttpInfo(String userGroupId, AddUsersToUserGroupV1Input addUsersToUserGroupV1Input) throws ApiException { - okhttp3.Call localVarCall = addUsersToUserGroupValidateBeforeCall(userGroupId, addUsersToUserGroupV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse addUsersToUserGroupWithHttpInfo( + String userGroupId, AddUsersToUserGroupV1Input addUsersToUserGroupV1Input) + throws ApiException { + okhttp3.Call localVarCall = + addUsersToUserGroupValidateBeforeCall( + userGroupId, addUsersToUserGroupV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Add Users to User Group (asynchronously) - * Adds a list of users or invites to a user group. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Subjects Added to Group * User Added To User Group The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param addUsersToUserGroupV1Input (required) + * Add Users to User Group (asynchronously) Adds a list of users or invites to a user group. • + * When called, this endpoint may generate one or more of the following [audit + * trail](/tag/Audit-Trail) events:* Subjects Added to Group * User Added To User Group The rate + * limit for this endpoint is 60 requests per minute, which is lower than the default due to + * access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param addUsersToUserGroupV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call addUsersToUserGroupAsync(String userGroupId, AddUsersToUserGroupV1Input addUsersToUserGroupV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = addUsersToUserGroupValidateBeforeCall(userGroupId, addUsersToUserGroupV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call addUsersToUserGroupAsync( + String userGroupId, + AddUsersToUserGroupV1Input addUsersToUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addUsersToUserGroupValidateBeforeCall( + userGroupId, addUsersToUserGroupV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for createUserGroup - * @param createUserGroupV1Input (required) + * + * @param createUserGroupV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createUserGroupCall(CreateUserGroupV1Input createUserGroupV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createUserGroupCall( + CreateUserGroupV1Input createUserGroupV1Input, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -429,7 +552,10 @@ public okhttp3.Call createUserGroupCall(CreateUserGroupV1Input createUserGroupV1 Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -437,119 +563,162 @@ public okhttp3.Call createUserGroupCall(CreateUserGroupV1Input createUserGroupV1 } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createUserGroupValidateBeforeCall(CreateUserGroupV1Input createUserGroupV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createUserGroupValidateBeforeCall( + CreateUserGroupV1Input createUserGroupV1Input, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'createUserGroupV1Input' is set if (createUserGroupV1Input == null) { - throw new ApiException("Missing the required parameter 'createUserGroupV1Input' when calling createUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'createUserGroupV1Input' when calling" + + " createUserGroup(Async)"); } - - - okhttp3.Call localVarCall = createUserGroupCall(createUserGroupV1Input, _callback); - return localVarCall; + return createUserGroupCall(createUserGroupV1Input, _callback); } /** - * Create User Group - * Creates a user group. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * User Group Created * Policy Created The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param createUserGroupV1Input (required) + * Create User Group Creates a user group. • When called, this endpoint may generate one or more + * of the following [audit trail](/tag/Audit-Trail) events:* User Group Created * Policy Created + * The rate limit for this endpoint is 60 requests per minute, which is lower than the default + * due to access pattern restrictions. Once reached, this endpoint will respond with the 429 + * HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param createUserGroupV1Input (required) * @return CreateUserGroup200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateUserGroup200Response createUserGroup(CreateUserGroupV1Input createUserGroupV1Input) throws ApiException { - ApiResponse localVarResp = createUserGroupWithHttpInfo(createUserGroupV1Input); + public CreateUserGroup200Response createUserGroup(CreateUserGroupV1Input createUserGroupV1Input) + throws ApiException { + ApiResponse localVarResp = + createUserGroupWithHttpInfo(createUserGroupV1Input); return localVarResp.getData(); } /** - * Create User Group - * Creates a user group. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * User Group Created * Policy Created The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param createUserGroupV1Input (required) + * Create User Group Creates a user group. • When called, this endpoint may generate one or more + * of the following [audit trail](/tag/Audit-Trail) events:* User Group Created * Policy Created + * The rate limit for this endpoint is 60 requests per minute, which is lower than the default + * due to access pattern restrictions. Once reached, this endpoint will respond with the 429 + * HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param createUserGroupV1Input (required) * @return ApiResponse<CreateUserGroup200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createUserGroupWithHttpInfo(CreateUserGroupV1Input createUserGroupV1Input) throws ApiException { + public ApiResponse createUserGroupWithHttpInfo( + CreateUserGroupV1Input createUserGroupV1Input) throws ApiException { okhttp3.Call localVarCall = createUserGroupValidateBeforeCall(createUserGroupV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create User Group (asynchronously) - * Creates a user group. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * User Group Created * Policy Created The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param createUserGroupV1Input (required) + * Create User Group (asynchronously) Creates a user group. • When called, this endpoint may + * generate one or more of the following [audit trail](/tag/Audit-Trail) events:* User Group + * Created * Policy Created The rate limit for this endpoint is 60 requests per minute, which is + * lower than the default due to access pattern restrictions. Once reached, this endpoint will + * respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param createUserGroupV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createUserGroupAsync(CreateUserGroupV1Input createUserGroupV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createUserGroupValidateBeforeCall(createUserGroupV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createUserGroupAsync( + CreateUserGroupV1Input createUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createUserGroupValidateBeforeCall(createUserGroupV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for deleteUserGroup - * @param userGroupId (required) + * + * @param userGroupId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteUserGroupCall(String userGroupId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteUserGroupCall(String userGroupId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -558,8 +727,11 @@ public okhttp3.Call deleteUserGroupCall(String userGroupId, final ApiCallback _c Object localVarPostBody = null; // create path and map variables - String localVarPath = "/groups/{userGroupId}" - .replaceAll("\\{" + "userGroupId" + "\\}", localVarApiClient.escapeString(userGroupId.toString())); + String localVarPath = + "/groups/{userGroupId}" + .replace( + "{" + "userGroupId" + "}", + localVarApiClient.escapeString(userGroupId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -568,127 +740,164 @@ public okhttp3.Call deleteUserGroupCall(String userGroupId, final ApiCallback _c Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteUserGroupValidateBeforeCall(String userGroupId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call deleteUserGroupValidateBeforeCall( + String userGroupId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'userGroupId' is set if (userGroupId == null) { - throw new ApiException("Missing the required parameter 'userGroupId' when calling deleteUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'userGroupId' when calling" + + " deleteUserGroup(Async)"); } - - - okhttp3.Call localVarCall = deleteUserGroupCall(userGroupId, _callback); - return localVarCall; + return deleteUserGroupCall(userGroupId, _callback); } /** - * Delete User Group - * Removes a user group from a Workspace. When called, this endpoint may generate the `User Group Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) + * Delete User Group Removes a user group from a Workspace. • When called, this endpoint may + * generate the `User Group Deleted` event in the [audit trail](/tag/Audit-Trail). The + * rate limit for this endpoint is 60 requests per minute, which is lower than the default due + * to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) * @return DeleteUserGroup200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public DeleteUserGroup200Response deleteUserGroup(String userGroupId) throws ApiException { - ApiResponse localVarResp = deleteUserGroupWithHttpInfo(userGroupId); + ApiResponse localVarResp = + deleteUserGroupWithHttpInfo(userGroupId); return localVarResp.getData(); } /** - * Delete User Group - * Removes a user group from a Workspace. When called, this endpoint may generate the `User Group Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) + * Delete User Group Removes a user group from a Workspace. • When called, this endpoint may + * generate the `User Group Deleted` event in the [audit trail](/tag/Audit-Trail). The + * rate limit for this endpoint is 60 requests per minute, which is lower than the default due + * to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) * @return ApiResponse<DeleteUserGroup200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse deleteUserGroupWithHttpInfo(String userGroupId) throws ApiException { + public ApiResponse deleteUserGroupWithHttpInfo(String userGroupId) + throws ApiException { okhttp3.Call localVarCall = deleteUserGroupValidateBeforeCall(userGroupId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Delete User Group (asynchronously) - * Removes a user group from a Workspace. When called, this endpoint may generate the `User Group Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) + * Delete User Group (asynchronously) Removes a user group from a Workspace. • When called, this + * endpoint may generate the `User Group Deleted` event in the [audit + * trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which + * is lower than the default due to access pattern restrictions. Once reached, this endpoint + * will respond with the 429 HTTP status code with headers indicating the limit parameters. See + * [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteUserGroupAsync(String userGroupId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteUserGroupAsync( + String userGroupId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = deleteUserGroupValidateBeforeCall(userGroupId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getUserGroup - * @param userGroupId (required) + * + * @param userGroupId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getUserGroupCall(String userGroupId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getUserGroupCall(String userGroupId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -697,8 +906,11 @@ public okhttp3.Call getUserGroupCall(String userGroupId, final ApiCallback _call Object localVarPostBody = null; // create path and map variables - String localVarPath = "/groups/{userGroupId}" - .replaceAll("\\{" + "userGroupId" + "\\}", localVarApiClient.escapeString(userGroupId.toString())); + String localVarPath = + "/groups/{userGroupId}" + .replace( + "{" + "userGroupId" + "}", + localVarApiClient.escapeString(userGroupId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -707,53 +919,66 @@ public okhttp3.Call getUserGroupCall(String userGroupId, final ApiCallback _call Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getUserGroupValidateBeforeCall(String userGroupId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getUserGroupValidateBeforeCall( + String userGroupId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'userGroupId' is set if (userGroupId == null) { - throw new ApiException("Missing the required parameter 'userGroupId' when calling getUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'userGroupId' when calling" + + " getUserGroup(Async)"); } - - - okhttp3.Call localVarCall = getUserGroupCall(userGroupId, _callback); - return localVarCall; + return getUserGroupCall(userGroupId, _callback); } /** - * Get User Group - * Returns a user group. - * @param userGroupId (required) + * Get User Group Returns a user group. + * + * @param userGroupId (required) * @return GetUserGroup200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public GetUserGroup200Response getUserGroup(String userGroupId) throws ApiException { ApiResponse localVarResp = getUserGroupWithHttpInfo(userGroupId); @@ -761,74 +986,84 @@ public GetUserGroup200Response getUserGroup(String userGroupId) throws ApiExcept } /** - * Get User Group - * Returns a user group. - * @param userGroupId (required) + * Get User Group Returns a user group. + * + * @param userGroupId (required) * @return ApiResponse<GetUserGroup200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getUserGroupWithHttpInfo(String userGroupId) throws ApiException { + public ApiResponse getUserGroupWithHttpInfo(String userGroupId) + throws ApiException { okhttp3.Call localVarCall = getUserGroupValidateBeforeCall(userGroupId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get User Group (asynchronously) - * Returns a user group. - * @param userGroupId (required) + * Get User Group (asynchronously) Returns a user group. + * + * @param userGroupId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getUserGroupAsync(String userGroupId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getUserGroupAsync( + String userGroupId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = getUserGroupValidateBeforeCall(userGroupId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listInvitesFromUserGroup - * @param userGroupId (required) - * @param pagination Pagination for invites to the group. This parameter exists in alpha. (required) + * + * @param userGroupId (required) + * @param pagination Pagination for invites to the group. This parameter exists in v1. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listInvitesFromUserGroupCall(String userGroupId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listInvitesFromUserGroupCall( + String userGroupId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -837,8 +1072,11 @@ public okhttp3.Call listInvitesFromUserGroupCall(String userGroupId, PaginationI Object localVarPostBody = null; // create path and map variables - String localVarPath = "/groups/{userGroupId}/invites" - .replaceAll("\\{" + "userGroupId" + "\\}", localVarApiClient.escapeString(userGroupId.toString())); + String localVarPath = + "/groups/{userGroupId}/invites" + .replace( + "{" + "userGroupId" + "}", + localVarApiClient.escapeString(userGroupId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -851,135 +1089,161 @@ public okhttp3.Call listInvitesFromUserGroupCall(String userGroupId, PaginationI } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listInvitesFromUserGroupValidateBeforeCall(String userGroupId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listInvitesFromUserGroupValidateBeforeCall( + String userGroupId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'userGroupId' is set if (userGroupId == null) { - throw new ApiException("Missing the required parameter 'userGroupId' when calling listInvitesFromUserGroup(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listInvitesFromUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'userGroupId' when calling" + + " listInvitesFromUserGroup(Async)"); } - - - okhttp3.Call localVarCall = listInvitesFromUserGroupCall(userGroupId, pagination, _callback); - return localVarCall; + return listInvitesFromUserGroupCall(userGroupId, pagination, _callback); } /** - * List Invites from User Group - * Returns the emails of invitees to a user group. - * @param userGroupId (required) - * @param pagination Pagination for invites to the group. This parameter exists in alpha. (required) + * List Invites from User Group Returns the emails of invitees to a user group. + * + * @param userGroupId (required) + * @param pagination Pagination for invites to the group. This parameter exists in v1. + * (optional) * @return ListInvitesFromUserGroup200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListInvitesFromUserGroup200Response listInvitesFromUserGroup(String userGroupId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listInvitesFromUserGroupWithHttpInfo(userGroupId, pagination); + public ListInvitesFromUserGroup200Response listInvitesFromUserGroup( + String userGroupId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listInvitesFromUserGroupWithHttpInfo(userGroupId, pagination); return localVarResp.getData(); } /** - * List Invites from User Group - * Returns the emails of invitees to a user group. - * @param userGroupId (required) - * @param pagination Pagination for invites to the group. This parameter exists in alpha. (required) + * List Invites from User Group Returns the emails of invitees to a user group. + * + * @param userGroupId (required) + * @param pagination Pagination for invites to the group. This parameter exists in v1. + * (optional) * @return ApiResponse<ListInvitesFromUserGroup200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listInvitesFromUserGroupWithHttpInfo(String userGroupId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listInvitesFromUserGroupValidateBeforeCall(userGroupId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse listInvitesFromUserGroupWithHttpInfo( + String userGroupId, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + listInvitesFromUserGroupValidateBeforeCall(userGroupId, pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Invites from User Group (asynchronously) - * Returns the emails of invitees to a user group. - * @param userGroupId (required) - * @param pagination Pagination for invites to the group. This parameter exists in alpha. (required) + * List Invites from User Group (asynchronously) Returns the emails of invitees to a user group. + * + * @param userGroupId (required) + * @param pagination Pagination for invites to the group. This parameter exists in v1. + * (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listInvitesFromUserGroupAsync(String userGroupId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listInvitesFromUserGroupValidateBeforeCall(userGroupId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listInvitesFromUserGroupAsync( + String userGroupId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listInvitesFromUserGroupValidateBeforeCall(userGroupId, pagination, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listUserGroups - * @param pagination Pagination for user groups. This parameter exists in alpha. (required) + * + * @param pagination Pagination for user groups. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listUserGroupsCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listUserGroupsCall(PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1001,128 +1265,145 @@ public okhttp3.Call listUserGroupsCall(PaginationInput pagination, final ApiCall } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listUserGroupsValidateBeforeCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listUserGroups(Async)"); - } - - - okhttp3.Call localVarCall = listUserGroupsCall(pagination, _callback); - return localVarCall; - + private okhttp3.Call listUserGroupsValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return listUserGroupsCall(pagination, _callback); } /** - * List User Groups - * Returns all user groups. - * @param pagination Pagination for user groups. This parameter exists in alpha. (required) + * List User Groups Returns all user groups. + * + * @param pagination Pagination for user groups. This parameter exists in v1. (optional) * @return ListUserGroups200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListUserGroups200Response listUserGroups(PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listUserGroupsWithHttpInfo(pagination); + public ListUserGroups200Response listUserGroups(PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listUserGroupsWithHttpInfo(pagination); return localVarResp.getData(); } /** - * List User Groups - * Returns all user groups. - * @param pagination Pagination for user groups. This parameter exists in alpha. (required) + * List User Groups Returns all user groups. + * + * @param pagination Pagination for user groups. This parameter exists in v1. (optional) * @return ApiResponse<ListUserGroups200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listUserGroupsWithHttpInfo(PaginationInput pagination) throws ApiException { + public ApiResponse listUserGroupsWithHttpInfo( + PaginationInput pagination) throws ApiException { okhttp3.Call localVarCall = listUserGroupsValidateBeforeCall(pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List User Groups (asynchronously) - * Returns all user groups. - * @param pagination Pagination for user groups. This parameter exists in alpha. (required) + * List User Groups (asynchronously) Returns all user groups. + * + * @param pagination Pagination for user groups. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listUserGroupsAsync(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listUserGroupsAsync( + PaginationInput pagination, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = listUserGroupsValidateBeforeCall(pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listUsersFromUserGroup - * @param userGroupId (required) - * @param pagination Pagination for members of a group. This parameter exists in alpha. (required) + * + * @param userGroupId (required) + * @param pagination Pagination for members of a group. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listUsersFromUserGroupCall(String userGroupId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listUsersFromUserGroupCall( + String userGroupId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1131,8 +1412,11 @@ public okhttp3.Call listUsersFromUserGroupCall(String userGroupId, PaginationInp Object localVarPostBody = null; // create path and map variables - String localVarPath = "/groups/{userGroupId}/users" - .replaceAll("\\{" + "userGroupId" + "\\}", localVarApiClient.escapeString(userGroupId.toString())); + String localVarPath = + "/groups/{userGroupId}/users" + .replace( + "{" + "userGroupId" + "}", + localVarApiClient.escapeString(userGroupId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1145,136 +1429,161 @@ public okhttp3.Call listUsersFromUserGroupCall(String userGroupId, PaginationInp } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listUsersFromUserGroupValidateBeforeCall(String userGroupId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listUsersFromUserGroupValidateBeforeCall( + String userGroupId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'userGroupId' is set if (userGroupId == null) { - throw new ApiException("Missing the required parameter 'userGroupId' when calling listUsersFromUserGroup(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listUsersFromUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'userGroupId' when calling" + + " listUsersFromUserGroup(Async)"); } - - - okhttp3.Call localVarCall = listUsersFromUserGroupCall(userGroupId, pagination, _callback); - return localVarCall; + return listUsersFromUserGroupCall(userGroupId, pagination, _callback); } /** - * List Users from User Group - * Returns users belonging to a user group. - * @param userGroupId (required) - * @param pagination Pagination for members of a group. This parameter exists in alpha. (required) + * List Users from User Group Returns users belonging to a user group. + * + * @param userGroupId (required) + * @param pagination Pagination for members of a group. This parameter exists in v1. (optional) * @return ListUsersFromUserGroup200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListUsersFromUserGroup200Response listUsersFromUserGroup(String userGroupId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listUsersFromUserGroupWithHttpInfo(userGroupId, pagination); + public ListUsersFromUserGroup200Response listUsersFromUserGroup( + String userGroupId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listUsersFromUserGroupWithHttpInfo(userGroupId, pagination); return localVarResp.getData(); } /** - * List Users from User Group - * Returns users belonging to a user group. - * @param userGroupId (required) - * @param pagination Pagination for members of a group. This parameter exists in alpha. (required) + * List Users from User Group Returns users belonging to a user group. + * + * @param userGroupId (required) + * @param pagination Pagination for members of a group. This parameter exists in v1. (optional) * @return ApiResponse<ListUsersFromUserGroup200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listUsersFromUserGroupWithHttpInfo(String userGroupId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listUsersFromUserGroupValidateBeforeCall(userGroupId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse listUsersFromUserGroupWithHttpInfo( + String userGroupId, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + listUsersFromUserGroupValidateBeforeCall(userGroupId, pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Users from User Group (asynchronously) - * Returns users belonging to a user group. - * @param userGroupId (required) - * @param pagination Pagination for members of a group. This parameter exists in alpha. (required) + * List Users from User Group (asynchronously) Returns users belonging to a user group. + * + * @param userGroupId (required) + * @param pagination Pagination for members of a group. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listUsersFromUserGroupAsync(String userGroupId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listUsersFromUserGroupValidateBeforeCall(userGroupId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listUsersFromUserGroupAsync( + String userGroupId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listUsersFromUserGroupValidateBeforeCall(userGroupId, pagination, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for removeUsersFromUserGroup - * @param userGroupId (required) - * @param emails The list of emails to remove from the user group. This parameter exists in alpha. (required) + * + * @param userGroupId (required) + * @param emails The list of emails to remove from the user group. This parameter exists in v1. + * (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call removeUsersFromUserGroupCall(String userGroupId, List emails, final ApiCallback _callback) throws ApiException { + public okhttp3.Call removeUsersFromUserGroupCall( + String userGroupId, List emails, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1283,8 +1592,11 @@ public okhttp3.Call removeUsersFromUserGroupCall(String userGroupId, List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1293,140 +1605,195 @@ public okhttp3.Call removeUsersFromUserGroupCall(String userGroupId, List localVarFormParams = new HashMap(); if (emails != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "emails", emails)); + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "emails", emails)); } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call removeUsersFromUserGroupValidateBeforeCall(String userGroupId, List emails, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call removeUsersFromUserGroupValidateBeforeCall( + String userGroupId, List emails, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'userGroupId' is set if (userGroupId == null) { - throw new ApiException("Missing the required parameter 'userGroupId' when calling removeUsersFromUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'userGroupId' when calling" + + " removeUsersFromUserGroup(Async)"); } - + // verify the required parameter 'emails' is set if (emails == null) { - throw new ApiException("Missing the required parameter 'emails' when calling removeUsersFromUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'emails' when calling" + + " removeUsersFromUserGroup(Async)"); } - - - okhttp3.Call localVarCall = removeUsersFromUserGroupCall(userGroupId, emails, _callback); - return localVarCall; + return removeUsersFromUserGroupCall(userGroupId, emails, _callback); } /** - * Remove Users from User Group - * Removes one or multiple users or invites from a user group by email. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Group Memberships Deleted * User Removed From User Group The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param emails The list of emails to remove from the user group. This parameter exists in alpha. (required) + * Remove Users from User Group Removes one or multiple users or invites from a user group by + * email. • When called, this endpoint may generate one or more of the following [audit + * trail](/tag/Audit-Trail) events:* Group Memberships Deleted * User Removed From User Group + * The rate limit for this endpoint is 60 requests per minute, which is lower than the default + * due to access pattern restrictions. Once reached, this endpoint will respond with the 429 + * HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param emails The list of emails to remove from the user group. This parameter exists in v1. + * (required) * @return RemoveUsersFromUserGroup200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public RemoveUsersFromUserGroup200Response removeUsersFromUserGroup(String userGroupId, List emails) throws ApiException { - ApiResponse localVarResp = removeUsersFromUserGroupWithHttpInfo(userGroupId, emails); + public RemoveUsersFromUserGroup200Response removeUsersFromUserGroup( + String userGroupId, List emails) throws ApiException { + ApiResponse localVarResp = + removeUsersFromUserGroupWithHttpInfo(userGroupId, emails); return localVarResp.getData(); } /** - * Remove Users from User Group - * Removes one or multiple users or invites from a user group by email. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Group Memberships Deleted * User Removed From User Group The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param emails The list of emails to remove from the user group. This parameter exists in alpha. (required) + * Remove Users from User Group Removes one or multiple users or invites from a user group by + * email. • When called, this endpoint may generate one or more of the following [audit + * trail](/tag/Audit-Trail) events:* Group Memberships Deleted * User Removed From User Group + * The rate limit for this endpoint is 60 requests per minute, which is lower than the default + * due to access pattern restrictions. Once reached, this endpoint will respond with the 429 + * HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param emails The list of emails to remove from the user group. This parameter exists in v1. + * (required) * @return ApiResponse<RemoveUsersFromUserGroup200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse removeUsersFromUserGroupWithHttpInfo(String userGroupId, List emails) throws ApiException { - okhttp3.Call localVarCall = removeUsersFromUserGroupValidateBeforeCall(userGroupId, emails, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse removeUsersFromUserGroupWithHttpInfo( + String userGroupId, List emails) throws ApiException { + okhttp3.Call localVarCall = + removeUsersFromUserGroupValidateBeforeCall(userGroupId, emails, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Remove Users from User Group (asynchronously) - * Removes one or multiple users or invites from a user group by email. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Group Memberships Deleted * User Removed From User Group The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param emails The list of emails to remove from the user group. This parameter exists in alpha. (required) + * Remove Users from User Group (asynchronously) Removes one or multiple users or invites from a + * user group by email. • When called, this endpoint may generate one or more of the following + * [audit trail](/tag/Audit-Trail) events:* Group Memberships Deleted * User Removed From User + * Group The rate limit for this endpoint is 60 requests per minute, which is lower than the + * default due to access pattern restrictions. Once reached, this endpoint will respond with the + * 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param emails The list of emails to remove from the user group. This parameter exists in v1. + * (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call removeUsersFromUserGroupAsync(String userGroupId, List emails, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = removeUsersFromUserGroupValidateBeforeCall(userGroupId, emails, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call removeUsersFromUserGroupAsync( + String userGroupId, + List emails, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeUsersFromUserGroupValidateBeforeCall(userGroupId, emails, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for replacePermissionsForUserGroup - * @param userGroupId (required) - * @param replacePermissionsForUserGroupV1Input (required) + * + * @param userGroupId (required) + * @param replacePermissionsForUserGroupV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replacePermissionsForUserGroupCall(String userGroupId, ReplacePermissionsForUserGroupV1Input replacePermissionsForUserGroupV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call replacePermissionsForUserGroupCall( + String userGroupId, + ReplacePermissionsForUserGroupV1Input replacePermissionsForUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1435,8 +1802,11 @@ public okhttp3.Call replacePermissionsForUserGroupCall(String userGroupId, Repla Object localVarPostBody = replacePermissionsForUserGroupV1Input; // create path and map variables - String localVarPath = "/groups/{userGroupId}/permissions" - .replaceAll("\\{" + "userGroupId" + "\\}", localVarApiClient.escapeString(userGroupId.toString())); + String localVarPath = + "/groups/{userGroupId}/permissions" + .replace( + "{" + "userGroupId" + "}", + localVarApiClient.escapeString(userGroupId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1445,7 +1815,10 @@ public okhttp3.Call replacePermissionsForUserGroupCall(String userGroupId, Repla Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -1453,128 +1826,191 @@ public okhttp3.Call replacePermissionsForUserGroupCall(String userGroupId, Repla } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replacePermissionsForUserGroupValidateBeforeCall(String userGroupId, ReplacePermissionsForUserGroupV1Input replacePermissionsForUserGroupV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call replacePermissionsForUserGroupValidateBeforeCall( + String userGroupId, + ReplacePermissionsForUserGroupV1Input replacePermissionsForUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'userGroupId' is set if (userGroupId == null) { - throw new ApiException("Missing the required parameter 'userGroupId' when calling replacePermissionsForUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'userGroupId' when calling" + + " replacePermissionsForUserGroup(Async)"); } - + // verify the required parameter 'replacePermissionsForUserGroupV1Input' is set if (replacePermissionsForUserGroupV1Input == null) { - throw new ApiException("Missing the required parameter 'replacePermissionsForUserGroupV1Input' when calling replacePermissionsForUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'replacePermissionsForUserGroupV1Input' when" + + " calling replacePermissionsForUserGroup(Async)"); } - - - okhttp3.Call localVarCall = replacePermissionsForUserGroupCall(userGroupId, replacePermissionsForUserGroupV1Input, _callback); - return localVarCall; + return replacePermissionsForUserGroupCall( + userGroupId, replacePermissionsForUserGroupV1Input, _callback); } /** - * Replace Permissions for User Group - * Updates the list of access permissions for a user group. When called, this endpoint may generate the `Policy Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param replacePermissionsForUserGroupV1Input (required) + * Replace Permissions for User Group Updates the list of access permissions for a user group. • + * When called, this endpoint may generate the `Policy Deleted` event in the [audit + * trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which + * is lower than the default due to access pattern restrictions. Once reached, this endpoint + * will respond with the 429 HTTP status code with headers indicating the limit parameters. See + * [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param replacePermissionsForUserGroupV1Input (required) * @return ReplacePermissionsForUserGroup200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ReplacePermissionsForUserGroup200Response replacePermissionsForUserGroup(String userGroupId, ReplacePermissionsForUserGroupV1Input replacePermissionsForUserGroupV1Input) throws ApiException { - ApiResponse localVarResp = replacePermissionsForUserGroupWithHttpInfo(userGroupId, replacePermissionsForUserGroupV1Input); + public ReplacePermissionsForUserGroup200Response replacePermissionsForUserGroup( + String userGroupId, + ReplacePermissionsForUserGroupV1Input replacePermissionsForUserGroupV1Input) + throws ApiException { + ApiResponse localVarResp = + replacePermissionsForUserGroupWithHttpInfo( + userGroupId, replacePermissionsForUserGroupV1Input); return localVarResp.getData(); } /** - * Replace Permissions for User Group - * Updates the list of access permissions for a user group. When called, this endpoint may generate the `Policy Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param replacePermissionsForUserGroupV1Input (required) + * Replace Permissions for User Group Updates the list of access permissions for a user group. • + * When called, this endpoint may generate the `Policy Deleted` event in the [audit + * trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which + * is lower than the default due to access pattern restrictions. Once reached, this endpoint + * will respond with the 429 HTTP status code with headers indicating the limit parameters. See + * [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param replacePermissionsForUserGroupV1Input (required) * @return ApiResponse<ReplacePermissionsForUserGroup200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse replacePermissionsForUserGroupWithHttpInfo(String userGroupId, ReplacePermissionsForUserGroupV1Input replacePermissionsForUserGroupV1Input) throws ApiException { - okhttp3.Call localVarCall = replacePermissionsForUserGroupValidateBeforeCall(userGroupId, replacePermissionsForUserGroupV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + replacePermissionsForUserGroupWithHttpInfo( + String userGroupId, + ReplacePermissionsForUserGroupV1Input replacePermissionsForUserGroupV1Input) + throws ApiException { + okhttp3.Call localVarCall = + replacePermissionsForUserGroupValidateBeforeCall( + userGroupId, replacePermissionsForUserGroupV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace Permissions for User Group (asynchronously) - * Updates the list of access permissions for a user group. When called, this endpoint may generate the `Policy Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param replacePermissionsForUserGroupV1Input (required) + * Replace Permissions for User Group (asynchronously) Updates the list of access permissions + * for a user group. • When called, this endpoint may generate the `Policy Deleted` + * event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param replacePermissionsForUserGroupV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replacePermissionsForUserGroupAsync(String userGroupId, ReplacePermissionsForUserGroupV1Input replacePermissionsForUserGroupV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = replacePermissionsForUserGroupValidateBeforeCall(userGroupId, replacePermissionsForUserGroupV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call replacePermissionsForUserGroupAsync( + String userGroupId, + ReplacePermissionsForUserGroupV1Input replacePermissionsForUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + replacePermissionsForUserGroupValidateBeforeCall( + userGroupId, replacePermissionsForUserGroupV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for replaceUsersInUserGroup - * @param userGroupId (required) - * @param replaceUsersInUserGroupV1Input (required) + * + * @param userGroupId (required) + * @param replaceUsersInUserGroupV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replaceUsersInUserGroupCall(String userGroupId, ReplaceUsersInUserGroupV1Input replaceUsersInUserGroupV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call replaceUsersInUserGroupCall( + String userGroupId, + ReplaceUsersInUserGroupV1Input replaceUsersInUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1583,8 +2019,11 @@ public okhttp3.Call replaceUsersInUserGroupCall(String userGroupId, ReplaceUsers Object localVarPostBody = replaceUsersInUserGroupV1Input; // create path and map variables - String localVarPath = "/group/{userGroupId}/users" - .replaceAll("\\{" + "userGroupId" + "\\}", localVarApiClient.escapeString(userGroupId.toString())); + String localVarPath = + "/group/{userGroupId}/users" + .replace( + "{" + "userGroupId" + "}", + localVarApiClient.escapeString(userGroupId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1593,7 +2032,10 @@ public okhttp3.Call replaceUsersInUserGroupCall(String userGroupId, ReplaceUsers Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -1601,128 +2043,187 @@ public okhttp3.Call replaceUsersInUserGroupCall(String userGroupId, ReplaceUsers } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replaceUsersInUserGroupValidateBeforeCall(String userGroupId, ReplaceUsersInUserGroupV1Input replaceUsersInUserGroupV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call replaceUsersInUserGroupValidateBeforeCall( + String userGroupId, + ReplaceUsersInUserGroupV1Input replaceUsersInUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'userGroupId' is set if (userGroupId == null) { - throw new ApiException("Missing the required parameter 'userGroupId' when calling replaceUsersInUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'userGroupId' when calling" + + " replaceUsersInUserGroup(Async)"); } - + // verify the required parameter 'replaceUsersInUserGroupV1Input' is set if (replaceUsersInUserGroupV1Input == null) { - throw new ApiException("Missing the required parameter 'replaceUsersInUserGroupV1Input' when calling replaceUsersInUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'replaceUsersInUserGroupV1Input' when calling" + + " replaceUsersInUserGroup(Async)"); } - - - okhttp3.Call localVarCall = replaceUsersInUserGroupCall(userGroupId, replaceUsersInUserGroupV1Input, _callback); - return localVarCall; + return replaceUsersInUserGroupCall(userGroupId, replaceUsersInUserGroupV1Input, _callback); } /** - * Replace Users in User Group - * Replaces the members of a user group by email. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Subjects Added to Group * User Added To User Group * Group Memberships Deleted The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param replaceUsersInUserGroupV1Input (required) + * Replace Users in User Group Replaces the members of a user group by email. • When called, + * this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) + * events:* Subjects Added to Group * User Added To User Group * Group Memberships Deleted The + * rate limit for this endpoint is 60 requests per minute, which is lower than the default due + * to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param replaceUsersInUserGroupV1Input (required) * @return ReplaceUsersInUserGroup200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ReplaceUsersInUserGroup200Response replaceUsersInUserGroup(String userGroupId, ReplaceUsersInUserGroupV1Input replaceUsersInUserGroupV1Input) throws ApiException { - ApiResponse localVarResp = replaceUsersInUserGroupWithHttpInfo(userGroupId, replaceUsersInUserGroupV1Input); + public ReplaceUsersInUserGroup200Response replaceUsersInUserGroup( + String userGroupId, ReplaceUsersInUserGroupV1Input replaceUsersInUserGroupV1Input) + throws ApiException { + ApiResponse localVarResp = + replaceUsersInUserGroupWithHttpInfo(userGroupId, replaceUsersInUserGroupV1Input); return localVarResp.getData(); } /** - * Replace Users in User Group - * Replaces the members of a user group by email. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Subjects Added to Group * User Added To User Group * Group Memberships Deleted The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param replaceUsersInUserGroupV1Input (required) + * Replace Users in User Group Replaces the members of a user group by email. • When called, + * this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) + * events:* Subjects Added to Group * User Added To User Group * Group Memberships Deleted The + * rate limit for this endpoint is 60 requests per minute, which is lower than the default due + * to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param replaceUsersInUserGroupV1Input (required) * @return ApiResponse<ReplaceUsersInUserGroup200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse replaceUsersInUserGroupWithHttpInfo(String userGroupId, ReplaceUsersInUserGroupV1Input replaceUsersInUserGroupV1Input) throws ApiException { - okhttp3.Call localVarCall = replaceUsersInUserGroupValidateBeforeCall(userGroupId, replaceUsersInUserGroupV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse replaceUsersInUserGroupWithHttpInfo( + String userGroupId, ReplaceUsersInUserGroupV1Input replaceUsersInUserGroupV1Input) + throws ApiException { + okhttp3.Call localVarCall = + replaceUsersInUserGroupValidateBeforeCall( + userGroupId, replaceUsersInUserGroupV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace Users in User Group (asynchronously) - * Replaces the members of a user group by email. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Subjects Added to Group * User Added To User Group * Group Memberships Deleted The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param replaceUsersInUserGroupV1Input (required) + * Replace Users in User Group (asynchronously) Replaces the members of a user group by email. • + * When called, this endpoint may generate one or more of the following [audit + * trail](/tag/Audit-Trail) events:* Subjects Added to Group * User Added To User Group * Group + * Memberships Deleted The rate limit for this endpoint is 60 requests per minute, which is + * lower than the default due to access pattern restrictions. Once reached, this endpoint will + * respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param replaceUsersInUserGroupV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replaceUsersInUserGroupAsync(String userGroupId, ReplaceUsersInUserGroupV1Input replaceUsersInUserGroupV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = replaceUsersInUserGroupValidateBeforeCall(userGroupId, replaceUsersInUserGroupV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call replaceUsersInUserGroupAsync( + String userGroupId, + ReplaceUsersInUserGroupV1Input replaceUsersInUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + replaceUsersInUserGroupValidateBeforeCall( + userGroupId, replaceUsersInUserGroupV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for updateUserGroup - * @param userGroupId (required) - * @param updateUserGroupV1Input (required) + * + * @param userGroupId (required) + * @param updateUserGroupV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateUserGroupCall(String userGroupId, UpdateUserGroupV1Input updateUserGroupV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call updateUserGroupCall( + String userGroupId, + UpdateUserGroupV1Input updateUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1731,8 +2232,11 @@ public okhttp3.Call updateUserGroupCall(String userGroupId, UpdateUserGroupV1Inp Object localVarPostBody = updateUserGroupV1Input; // create path and map variables - String localVarPath = "/groups/{userGroupId}" - .replaceAll("\\{" + "userGroupId" + "\\}", localVarApiClient.escapeString(userGroupId.toString())); + String localVarPath = + "/groups/{userGroupId}" + .replace( + "{" + "userGroupId" + "}", + localVarApiClient.escapeString(userGroupId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1741,7 +2245,10 @@ public okhttp3.Call updateUserGroupCall(String userGroupId, UpdateUserGroupV1Inp Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -1749,100 +2256,146 @@ public okhttp3.Call updateUserGroupCall(String userGroupId, UpdateUserGroupV1Inp } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateUserGroupValidateBeforeCall(String userGroupId, UpdateUserGroupV1Input updateUserGroupV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call updateUserGroupValidateBeforeCall( + String userGroupId, + UpdateUserGroupV1Input updateUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'userGroupId' is set if (userGroupId == null) { - throw new ApiException("Missing the required parameter 'userGroupId' when calling updateUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'userGroupId' when calling" + + " updateUserGroup(Async)"); } - + // verify the required parameter 'updateUserGroupV1Input' is set if (updateUserGroupV1Input == null) { - throw new ApiException("Missing the required parameter 'updateUserGroupV1Input' when calling updateUserGroup(Async)"); + throw new ApiException( + "Missing the required parameter 'updateUserGroupV1Input' when calling" + + " updateUserGroup(Async)"); } - - - okhttp3.Call localVarCall = updateUserGroupCall(userGroupId, updateUserGroupV1Input, _callback); - return localVarCall; + return updateUserGroupCall(userGroupId, updateUserGroupV1Input, _callback); } /** - * Update User Group - * Updates a user group for a Workspace. When called, this endpoint may generate the `User Group Updated` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param updateUserGroupV1Input (required) + * Update User Group Updates a user group for a Workspace. • When called, this endpoint may + * generate the `User Group Updated` event in the [audit trail](/tag/Audit-Trail). The + * rate limit for this endpoint is 60 requests per minute, which is lower than the default due + * to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param updateUserGroupV1Input (required) * @return UpdateUserGroup200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public UpdateUserGroup200Response updateUserGroup(String userGroupId, UpdateUserGroupV1Input updateUserGroupV1Input) throws ApiException { - ApiResponse localVarResp = updateUserGroupWithHttpInfo(userGroupId, updateUserGroupV1Input); + public UpdateUserGroup200Response updateUserGroup( + String userGroupId, UpdateUserGroupV1Input updateUserGroupV1Input) throws ApiException { + ApiResponse localVarResp = + updateUserGroupWithHttpInfo(userGroupId, updateUserGroupV1Input); return localVarResp.getData(); } /** - * Update User Group - * Updates a user group for a Workspace. When called, this endpoint may generate the `User Group Updated` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param updateUserGroupV1Input (required) + * Update User Group Updates a user group for a Workspace. • When called, this endpoint may + * generate the `User Group Updated` event in the [audit trail](/tag/Audit-Trail). The + * rate limit for this endpoint is 60 requests per minute, which is lower than the default due + * to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param updateUserGroupV1Input (required) * @return ApiResponse<UpdateUserGroup200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse updateUserGroupWithHttpInfo(String userGroupId, UpdateUserGroupV1Input updateUserGroupV1Input) throws ApiException { - okhttp3.Call localVarCall = updateUserGroupValidateBeforeCall(userGroupId, updateUserGroupV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse updateUserGroupWithHttpInfo( + String userGroupId, UpdateUserGroupV1Input updateUserGroupV1Input) throws ApiException { + okhttp3.Call localVarCall = + updateUserGroupValidateBeforeCall(userGroupId, updateUserGroupV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update User Group (asynchronously) - * Updates a user group for a Workspace. When called, this endpoint may generate the `User Group Updated` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userGroupId (required) - * @param updateUserGroupV1Input (required) + * Update User Group (asynchronously) Updates a user group for a Workspace. • When called, this + * endpoint may generate the `User Group Updated` event in the [audit + * trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which + * is lower than the default due to access pattern restrictions. Once reached, this endpoint + * will respond with the 429 HTTP status code with headers indicating the limit parameters. See + * [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userGroupId (required) + * @param updateUserGroupV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateUserGroupAsync(String userGroupId, UpdateUserGroupV1Input updateUserGroupV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateUserGroupValidateBeforeCall(userGroupId, updateUserGroupV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call updateUserGroupAsync( + String userGroupId, + UpdateUserGroupV1Input updateUserGroupV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateUserGroupValidateBeforeCall(userGroupId, updateUserGroupV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/IamRolesApi.java b/src/main/java/com/segment/publicapi/api/IamRolesApi.java index 26b6ec83..a25633fa 100644 --- a/src/main/java/com/segment/publicapi/api/IamRolesApi.java +++ b/src/main/java/com/segment/publicapi/api/IamRolesApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,33 +9,22 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.ListRoles200Response; import com.segment.publicapi.models.PaginationInput; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class IamRolesApi { private ApiClient localVarApiClient; @@ -77,28 +65,30 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for listRoles - * @param pagination Pagination for roles. This parameter exists in alpha. (required) + * + * @param pagination Pagination for roles. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listRolesCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listRolesCall(PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -120,53 +110,59 @@ public okhttp3.Call listRolesCall(PaginationInput pagination, final ApiCallback } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listRolesValidateBeforeCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listRoles(Async)"); - } - - - okhttp3.Call localVarCall = listRolesCall(pagination, _callback); - return localVarCall; - + private okhttp3.Call listRolesValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return listRolesCall(pagination, _callback); } /** - * List Roles - * Returns a list of Roles available to apply to permissions for users and/or groups. - * @param pagination Pagination for roles. This parameter exists in alpha. (required) + * List Roles Returns a list of Roles available to apply to permissions for users and/or groups. + * + * @param pagination Pagination for roles. This parameter exists in v1. (optional) * @return ListRoles200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public ListRoles200Response listRoles(PaginationInput pagination) throws ApiException { ApiResponse localVarResp = listRolesWithHttpInfo(pagination); @@ -174,46 +170,52 @@ public ListRoles200Response listRoles(PaginationInput pagination) throws ApiExce } /** - * List Roles - * Returns a list of Roles available to apply to permissions for users and/or groups. - * @param pagination Pagination for roles. This parameter exists in alpha. (required) + * List Roles Returns a list of Roles available to apply to permissions for users and/or groups. + * + * @param pagination Pagination for roles. This parameter exists in v1. (optional) * @return ApiResponse<ListRoles200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listRolesWithHttpInfo(PaginationInput pagination) throws ApiException { + public ApiResponse listRolesWithHttpInfo(PaginationInput pagination) + throws ApiException { okhttp3.Call localVarCall = listRolesValidateBeforeCall(pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Roles (asynchronously) - * Returns a list of Roles available to apply to permissions for users and/or groups. - * @param pagination Pagination for roles. This parameter exists in alpha. (required) + * List Roles (asynchronously) Returns a list of Roles available to apply to permissions for + * users and/or groups. + * + * @param pagination Pagination for roles. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listRolesAsync(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listRolesAsync( + PaginationInput pagination, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = listRolesValidateBeforeCall(pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/IamUsersApi.java b/src/main/java/com/segment/publicapi/api/IamUsersApi.java index 5fae3256..59de3315 100644 --- a/src/main/java/com/segment/publicapi/api/IamUsersApi.java +++ b/src/main/java/com/segment/publicapi/api/IamUsersApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,26 +9,18 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.AddPermissionsToUser200Response; import com.segment.publicapi.models.AddPermissionsToUserV1Input; -import com.segment.publicapi.models.CreateInvites200Response; +import com.segment.publicapi.models.CreateInvites201Response; import com.segment.publicapi.models.CreateInvitesV1Input; import com.segment.publicapi.models.DeleteInvites200Response; import com.segment.publicapi.models.DeleteUsers200Response; @@ -40,14 +31,11 @@ import com.segment.publicapi.models.PaginationInput; import com.segment.publicapi.models.ReplacePermissionsForUser200Response; import com.segment.publicapi.models.ReplacePermissionsForUserV1Input; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class IamUsersApi { private ApiClient localVarApiClient; @@ -88,29 +76,34 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for addPermissionsToUser - * @param userId (required) - * @param addPermissionsToUserV1Input (required) + * + * @param userId (required) + * @param addPermissionsToUserV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call addPermissionsToUserCall(String userId, AddPermissionsToUserV1Input addPermissionsToUserV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call addPermissionsToUserCall( + String userId, + AddPermissionsToUserV1Input addPermissionsToUserV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -119,8 +112,11 @@ public okhttp3.Call addPermissionsToUserCall(String userId, AddPermissionsToUser Object localVarPostBody = addPermissionsToUserV1Input; // create path and map variables - String localVarPath = "/users/{userId}/permissions" - .replaceAll("\\{" + "userId" + "\\}", localVarApiClient.escapeString(userId.toString())); + String localVarPath = + "/users/{userId}/permissions" + .replace( + "{" + "userId" + "}", + localVarApiClient.escapeString(userId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -129,7 +125,10 @@ public okhttp3.Call addPermissionsToUserCall(String userId, AddPermissionsToUser Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -137,127 +136,181 @@ public okhttp3.Call addPermissionsToUserCall(String userId, AddPermissionsToUser } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call addPermissionsToUserValidateBeforeCall(String userId, AddPermissionsToUserV1Input addPermissionsToUserV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call addPermissionsToUserValidateBeforeCall( + String userId, + AddPermissionsToUserV1Input addPermissionsToUserV1Input, + 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 addPermissionsToUser(Async)"); + throw new ApiException( + "Missing the required parameter 'userId' when calling" + + " addPermissionsToUser(Async)"); } - + // verify the required parameter 'addPermissionsToUserV1Input' is set if (addPermissionsToUserV1Input == null) { - throw new ApiException("Missing the required parameter 'addPermissionsToUserV1Input' when calling addPermissionsToUser(Async)"); + throw new ApiException( + "Missing the required parameter 'addPermissionsToUserV1Input' when calling" + + " addPermissionsToUser(Async)"); } - - - okhttp3.Call localVarCall = addPermissionsToUserCall(userId, addPermissionsToUserV1Input, _callback); - return localVarCall; + return addPermissionsToUserCall(userId, addPermissionsToUserV1Input, _callback); } /** - * Add Permissions to User - * Adds a list of access permissions to a user. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Policy Created * User Policy Updated The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userId (required) - * @param addPermissionsToUserV1Input (required) + * Add Permissions to User Adds a list of access permissions to a user. • When called, this + * endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* + * Policy Created * User Policy Updated The rate limit for this endpoint is 60 requests per + * minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userId (required) + * @param addPermissionsToUserV1Input (required) * @return AddPermissionsToUser200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public AddPermissionsToUser200Response addPermissionsToUser(String userId, AddPermissionsToUserV1Input addPermissionsToUserV1Input) throws ApiException { - ApiResponse localVarResp = addPermissionsToUserWithHttpInfo(userId, addPermissionsToUserV1Input); + public AddPermissionsToUser200Response addPermissionsToUser( + String userId, AddPermissionsToUserV1Input addPermissionsToUserV1Input) + throws ApiException { + ApiResponse localVarResp = + addPermissionsToUserWithHttpInfo(userId, addPermissionsToUserV1Input); return localVarResp.getData(); } /** - * Add Permissions to User - * Adds a list of access permissions to a user. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Policy Created * User Policy Updated The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userId (required) - * @param addPermissionsToUserV1Input (required) + * Add Permissions to User Adds a list of access permissions to a user. • When called, this + * endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* + * Policy Created * User Policy Updated The rate limit for this endpoint is 60 requests per + * minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userId (required) + * @param addPermissionsToUserV1Input (required) * @return ApiResponse<AddPermissionsToUser200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse addPermissionsToUserWithHttpInfo(String userId, AddPermissionsToUserV1Input addPermissionsToUserV1Input) throws ApiException { - okhttp3.Call localVarCall = addPermissionsToUserValidateBeforeCall(userId, addPermissionsToUserV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse addPermissionsToUserWithHttpInfo( + String userId, AddPermissionsToUserV1Input addPermissionsToUserV1Input) + throws ApiException { + okhttp3.Call localVarCall = + addPermissionsToUserValidateBeforeCall(userId, addPermissionsToUserV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Add Permissions to User (asynchronously) - * Adds a list of access permissions to a user. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Policy Created * User Policy Updated The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userId (required) - * @param addPermissionsToUserV1Input (required) + * Add Permissions to User (asynchronously) Adds a list of access permissions to a user. • When + * called, this endpoint may generate one or more of the following [audit + * trail](/tag/Audit-Trail) events:* Policy Created * User Policy Updated The rate limit for + * this endpoint is 60 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param userId (required) + * @param addPermissionsToUserV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call addPermissionsToUserAsync(String userId, AddPermissionsToUserV1Input addPermissionsToUserV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = addPermissionsToUserValidateBeforeCall(userId, addPermissionsToUserV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call addPermissionsToUserAsync( + String userId, + AddPermissionsToUserV1Input addPermissionsToUserV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addPermissionsToUserValidateBeforeCall( + userId, addPermissionsToUserV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for createInvites - * @param createInvitesV1Input (required) + * + * @param createInvitesV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createInvitesCall(CreateInvitesV1Input createInvitesV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createInvitesCall( + CreateInvitesV1Input createInvitesV1Input, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -275,7 +328,10 @@ public okhttp3.Call createInvitesCall(CreateInvitesV1Input createInvitesV1Input, Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -283,119 +339,166 @@ public okhttp3.Call createInvitesCall(CreateInvitesV1Input createInvitesV1Input, } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createInvitesValidateBeforeCall(CreateInvitesV1Input createInvitesV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createInvitesValidateBeforeCall( + CreateInvitesV1Input createInvitesV1Input, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'createInvitesV1Input' is set if (createInvitesV1Input == null) { - throw new ApiException("Missing the required parameter 'createInvitesV1Input' when calling createInvites(Async)"); + throw new ApiException( + "Missing the required parameter 'createInvitesV1Input' when calling" + + " createInvites(Async)"); } - - - okhttp3.Call localVarCall = createInvitesCall(createInvitesV1Input, _callback); - return localVarCall; + return createInvitesCall(createInvitesV1Input, _callback); } /** - * Create Invites - * Invites a list of users to join a Workspace. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Non-Segment User Invited to Workspace * Policy Created * New Segment User Invited to Workspace Config API omitted fields: - `parent` The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param createInvitesV1Input (required) - * @return CreateInvites200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * Create Invites Invites a list of users to join a Workspace. • When called, this endpoint may + * generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Non-Segment + * User Invited to Workspace * Policy Created * New Segment User Invited to Workspace Config API + * omitted fields: - `parent` The rate limit for this endpoint is 60 requests per + * minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param createInvitesV1Input (required) + * @return CreateInvites201Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateInvites200Response createInvites(CreateInvitesV1Input createInvitesV1Input) throws ApiException { - ApiResponse localVarResp = createInvitesWithHttpInfo(createInvitesV1Input); + public CreateInvites201Response createInvites(CreateInvitesV1Input createInvitesV1Input) + throws ApiException { + ApiResponse localVarResp = + createInvitesWithHttpInfo(createInvitesV1Input); return localVarResp.getData(); } /** - * Create Invites - * Invites a list of users to join a Workspace. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Non-Segment User Invited to Workspace * Policy Created * New Segment User Invited to Workspace Config API omitted fields: - `parent` The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param createInvitesV1Input (required) - * @return ApiResponse<CreateInvites200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * Create Invites Invites a list of users to join a Workspace. • When called, this endpoint may + * generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Non-Segment + * User Invited to Workspace * Policy Created * New Segment User Invited to Workspace Config API + * omitted fields: - `parent` The rate limit for this endpoint is 60 requests per + * minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param createInvitesV1Input (required) + * @return ApiResponse<CreateInvites201Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createInvitesWithHttpInfo(CreateInvitesV1Input createInvitesV1Input) throws ApiException { + public ApiResponse createInvitesWithHttpInfo( + CreateInvitesV1Input createInvitesV1Input) throws ApiException { okhttp3.Call localVarCall = createInvitesValidateBeforeCall(createInvitesV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Invites (asynchronously) - * Invites a list of users to join a Workspace. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Non-Segment User Invited to Workspace * Policy Created * New Segment User Invited to Workspace Config API omitted fields: - `parent` The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param createInvitesV1Input (required) + * Create Invites (asynchronously) Invites a list of users to join a Workspace. • When called, + * this endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) + * events:* Non-Segment User Invited to Workspace * Policy Created * New Segment User Invited to + * Workspace Config API omitted fields: - `parent` The rate limit for this endpoint is + * 60 requests per minute, which is lower than the default due to access pattern restrictions. + * Once reached, this endpoint will respond with the 429 HTTP status code with headers + * indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param createInvitesV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createInvitesAsync(CreateInvitesV1Input createInvitesV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createInvitesValidateBeforeCall(createInvitesV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createInvitesAsync( + CreateInvitesV1Input createInvitesV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createInvitesValidateBeforeCall(createInvitesV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for deleteInvites - * @param emails The list of emails to delete invites for. This parameter exists in alpha. (required) + * + * @param emails The list of emails to delete invites for. This parameter exists in v1. + * (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteInvitesCall(List emails, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteInvitesCall(List emails, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -413,57 +516,76 @@ public okhttp3.Call deleteInvitesCall(List emails, final ApiCallback _ca Map localVarFormParams = new HashMap(); if (emails != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "emails", emails)); + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "emails", emails)); } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteInvitesValidateBeforeCall(List emails, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call deleteInvitesValidateBeforeCall( + List emails, final ApiCallback _callback) throws ApiException { // verify the required parameter 'emails' is set if (emails == null) { - throw new ApiException("Missing the required parameter 'emails' when calling deleteInvites(Async)"); + throw new ApiException( + "Missing the required parameter 'emails' when calling deleteInvites(Async)"); } - - - okhttp3.Call localVarCall = deleteInvitesCall(emails, _callback); - return localVarCall; + return deleteInvitesCall(emails, _callback); } /** - * Delete Invites - * Removes a list of invitations to join a Workspace. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Invite Deleted * Group Memberships Deleted The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param emails The list of emails to delete invites for. This parameter exists in alpha. (required) + * Delete Invites Removes a list of invitations to join a Workspace. • When called, this + * endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* + * Invite Deleted * Group Memberships Deleted The rate limit for this endpoint is 60 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param emails The list of emails to delete invites for. This parameter exists in v1. + * (required) * @return DeleteInvites200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public DeleteInvites200Response deleteInvites(List emails) throws ApiException { ApiResponse localVarResp = deleteInvitesWithHttpInfo(emails); @@ -471,73 +593,94 @@ public DeleteInvites200Response deleteInvites(List emails) throws ApiExc } /** - * Delete Invites - * Removes a list of invitations to join a Workspace. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Invite Deleted * Group Memberships Deleted The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param emails The list of emails to delete invites for. This parameter exists in alpha. (required) + * Delete Invites Removes a list of invitations to join a Workspace. • When called, this + * endpoint may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* + * Invite Deleted * Group Memberships Deleted The rate limit for this endpoint is 60 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param emails The list of emails to delete invites for. This parameter exists in v1. + * (required) * @return ApiResponse<DeleteInvites200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse deleteInvitesWithHttpInfo(List emails) throws ApiException { + public ApiResponse deleteInvitesWithHttpInfo(List emails) + throws ApiException { okhttp3.Call localVarCall = deleteInvitesValidateBeforeCall(emails, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Delete Invites (asynchronously) - * Removes a list of invitations to join a Workspace. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Invite Deleted * Group Memberships Deleted The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param emails The list of emails to delete invites for. This parameter exists in alpha. (required) + * Delete Invites (asynchronously) Removes a list of invitations to join a Workspace. • When + * called, this endpoint may generate one or more of the following [audit + * trail](/tag/Audit-Trail) events:* Invite Deleted * Group Memberships Deleted The rate limit + * for this endpoint is 60 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param emails The list of emails to delete invites for. This parameter exists in v1. + * (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteInvitesAsync(List emails, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteInvitesAsync( + List emails, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = deleteInvitesValidateBeforeCall(emails, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for deleteUsers - * @param userIds The ids of the users to remove. This parameter exists in alpha. (required) + * + * @param userIds The ids of the users to remove. This parameter exists in v1. (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteUsersCall(List userIds, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteUsersCall(List userIds, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -555,57 +698,75 @@ public okhttp3.Call deleteUsersCall(List userIds, final ApiCallback _cal Map localVarFormParams = new HashMap(); if (userIds != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "userIds", userIds)); + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "userIds", userIds)); } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteUsersValidateBeforeCall(List userIds, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call deleteUsersValidateBeforeCall( + List userIds, final ApiCallback _callback) throws ApiException { // verify the required parameter 'userIds' is set if (userIds == null) { - throw new ApiException("Missing the required parameter 'userIds' when calling deleteUsers(Async)"); + throw new ApiException( + "Missing the required parameter 'userIds' when calling deleteUsers(Async)"); } - - - okhttp3.Call localVarCall = deleteUsersCall(userIds, _callback); - return localVarCall; + return deleteUsersCall(userIds, _callback); } /** - * Delete Users - * Removes one or multiple users. When called, this endpoint may generate the `Group Memberships Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userIds The ids of the users to remove. This parameter exists in alpha. (required) + * Delete Users Removes one or multiple users. • When called, this endpoint may generate the + * `Group Memberships Deleted` event in the [audit trail](/tag/Audit-Trail). The rate + * limit for this endpoint is 60 requests per minute, which is lower than the default due to + * access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userIds The ids of the users to remove. This parameter exists in v1. (required) * @return DeleteUsers200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public DeleteUsers200Response deleteUsers(List userIds) throws ApiException { ApiResponse localVarResp = deleteUsersWithHttpInfo(userIds); @@ -613,73 +774,91 @@ public DeleteUsers200Response deleteUsers(List userIds) throws ApiExcept } /** - * Delete Users - * Removes one or multiple users. When called, this endpoint may generate the `Group Memberships Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userIds The ids of the users to remove. This parameter exists in alpha. (required) + * Delete Users Removes one or multiple users. • When called, this endpoint may generate the + * `Group Memberships Deleted` event in the [audit trail](/tag/Audit-Trail). The rate + * limit for this endpoint is 60 requests per minute, which is lower than the default due to + * access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param userIds The ids of the users to remove. This parameter exists in v1. (required) * @return ApiResponse<DeleteUsers200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse deleteUsersWithHttpInfo(List userIds) throws ApiException { + public ApiResponse deleteUsersWithHttpInfo(List userIds) + throws ApiException { okhttp3.Call localVarCall = deleteUsersValidateBeforeCall(userIds, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Delete Users (asynchronously) - * Removes one or multiple users. When called, this endpoint may generate the `Group Memberships Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userIds The ids of the users to remove. This parameter exists in alpha. (required) + * Delete Users (asynchronously) Removes one or multiple users. • When called, this endpoint may + * generate the `Group Memberships Deleted` event in the [audit + * trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which + * is lower than the default due to access pattern restrictions. Once reached, this endpoint + * will respond with the 429 HTTP status code with headers indicating the limit parameters. See + * [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userIds The ids of the users to remove. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteUsersAsync(List userIds, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteUsersAsync( + List userIds, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = deleteUsersValidateBeforeCall(userIds, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getUser - * @param userId (required) + * + * @param userId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getUserCall(String userId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getUserCall(String userId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -688,8 +867,11 @@ public okhttp3.Call getUserCall(String userId, final ApiCallback _callback) thro Object localVarPostBody = null; // create path and map variables - String localVarPath = "/users/{userId}" - .replaceAll("\\{" + "userId" + "\\}", localVarApiClient.escapeString(userId.toString())); + String localVarPath = + "/users/{userId}" + .replace( + "{" + "userId" + "}", + localVarApiClient.escapeString(userId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -698,53 +880,65 @@ public okhttp3.Call getUserCall(String userId, final ApiCallback _callback) thro Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getUserValidateBeforeCall(String userId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getUserValidateBeforeCall(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 getUser(Async)"); + throw new ApiException( + "Missing the required parameter 'userId' when calling getUser(Async)"); } - - - okhttp3.Call localVarCall = getUserCall(userId, _callback); - return localVarCall; + return getUserCall(userId, _callback); } /** - * Get User - * Returns a user given their id. - * @param userId (required) + * Get User Returns a user given their id. + * + * @param userId (required) * @return GetUser200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public GetUser200Response getUser(String userId) throws ApiException { ApiResponse localVarResp = getUserWithHttpInfo(userId); @@ -752,73 +946,79 @@ public GetUser200Response getUser(String userId) throws ApiException { } /** - * Get User - * Returns a user given their id. - * @param userId (required) + * Get User Returns a user given their id. + * + * @param userId (required) * @return ApiResponse<GetUser200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public ApiResponse getUserWithHttpInfo(String userId) throws ApiException { okhttp3.Call localVarCall = getUserValidateBeforeCall(userId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get User (asynchronously) - * Returns a user given their id. - * @param userId (required) + * Get User (asynchronously) Returns a user given their id. + * + * @param userId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getUserAsync(String userId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getUserAsync(String userId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = getUserValidateBeforeCall(userId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listInvites - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listInvitesCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listInvitesCall(PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -840,53 +1040,60 @@ public okhttp3.Call listInvitesCall(PaginationInput pagination, final ApiCallbac } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listInvitesValidateBeforeCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listInvites(Async)"); - } - - - okhttp3.Call localVarCall = listInvitesCall(pagination, _callback); - return localVarCall; - + private okhttp3.Call listInvitesValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return listInvitesCall(pagination, _callback); } /** - * List Invites - * Returns a list of invitations to join a Workspace. Config API omitted fields: - `parent` - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Invites Returns a list of invitations to join a Workspace. Config API omitted fields: - + * `parent` + * + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ListInvites200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public ListInvites200Response listInvites(PaginationInput pagination) throws ApiException { ApiResponse localVarResp = listInvitesWithHttpInfo(pagination); @@ -894,74 +1101,85 @@ public ListInvites200Response listInvites(PaginationInput pagination) throws Api } /** - * List Invites - * Returns a list of invitations to join a Workspace. Config API omitted fields: - `parent` - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Invites Returns a list of invitations to join a Workspace. Config API omitted fields: - + * `parent` + * + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ApiResponse<ListInvites200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listInvitesWithHttpInfo(PaginationInput pagination) throws ApiException { + public ApiResponse listInvitesWithHttpInfo(PaginationInput pagination) + throws ApiException { okhttp3.Call localVarCall = listInvitesValidateBeforeCall(pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Invites (asynchronously) - * Returns a list of invitations to join a Workspace. Config API omitted fields: - `parent` - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Invites (asynchronously) Returns a list of invitations to join a Workspace. Config API + * omitted fields: - `parent` + * + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listInvitesAsync(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listInvitesAsync( + PaginationInput pagination, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = listInvitesValidateBeforeCall(pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listUserGroupsFromUser - * @param userId (required) - * @param pagination Pagination for groups. This parameter exists in alpha. (required) + * + * @param userId (required) + * @param pagination Pagination for groups. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listUserGroupsFromUserCall(String userId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listUserGroupsFromUserCall( + String userId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -970,8 +1188,11 @@ public okhttp3.Call listUserGroupsFromUserCall(String userId, PaginationInput pa Object localVarPostBody = null; // create path and map variables - String localVarPath = "/users/{userId}/groups" - .replaceAll("\\{" + "userId" + "\\}", localVarApiClient.escapeString(userId.toString())); + String localVarPath = + "/users/{userId}/groups" + .replace( + "{" + "userId" + "}", + localVarApiClient.escapeString(userId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -984,135 +1205,158 @@ public okhttp3.Call listUserGroupsFromUserCall(String userId, PaginationInput pa } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listUserGroupsFromUserValidateBeforeCall(String userId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listUserGroupsFromUserValidateBeforeCall( + String userId, PaginationInput pagination, 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 listUserGroupsFromUser(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listUserGroupsFromUser(Async)"); + throw new ApiException( + "Missing the required parameter 'userId' when calling" + + " listUserGroupsFromUser(Async)"); } - - - okhttp3.Call localVarCall = listUserGroupsFromUserCall(userId, pagination, _callback); - return localVarCall; + return listUserGroupsFromUserCall(userId, pagination, _callback); } /** - * List User Groups from User - * Returns all groups a user belongs to. - * @param userId (required) - * @param pagination Pagination for groups. This parameter exists in alpha. (required) + * List User Groups from User Returns all groups a user belongs to. + * + * @param userId (required) + * @param pagination Pagination for groups. This parameter exists in v1. (optional) * @return ListUserGroupsFromUser200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListUserGroupsFromUser200Response listUserGroupsFromUser(String userId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listUserGroupsFromUserWithHttpInfo(userId, pagination); + public ListUserGroupsFromUser200Response listUserGroupsFromUser( + String userId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listUserGroupsFromUserWithHttpInfo(userId, pagination); return localVarResp.getData(); } /** - * List User Groups from User - * Returns all groups a user belongs to. - * @param userId (required) - * @param pagination Pagination for groups. This parameter exists in alpha. (required) + * List User Groups from User Returns all groups a user belongs to. + * + * @param userId (required) + * @param pagination Pagination for groups. This parameter exists in v1. (optional) * @return ApiResponse<ListUserGroupsFromUser200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listUserGroupsFromUserWithHttpInfo(String userId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listUserGroupsFromUserValidateBeforeCall(userId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse listUserGroupsFromUserWithHttpInfo( + String userId, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + listUserGroupsFromUserValidateBeforeCall(userId, pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List User Groups from User (asynchronously) - * Returns all groups a user belongs to. - * @param userId (required) - * @param pagination Pagination for groups. This parameter exists in alpha. (required) + * List User Groups from User (asynchronously) Returns all groups a user belongs to. + * + * @param userId (required) + * @param pagination Pagination for groups. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listUserGroupsFromUserAsync(String userId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listUserGroupsFromUserValidateBeforeCall(userId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listUserGroupsFromUserAsync( + String userId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listUserGroupsFromUserValidateBeforeCall(userId, pagination, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listUsers - * @param pagination Pagination for users. This parameter exists in alpha. (required) + * + * @param pagination Pagination for users. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listUsersCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listUsersCall(PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1134,53 +1378,59 @@ public okhttp3.Call listUsersCall(PaginationInput pagination, final ApiCallback } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listUsersValidateBeforeCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listUsers(Async)"); - } - - - okhttp3.Call localVarCall = listUsersCall(pagination, _callback); - return localVarCall; - + private okhttp3.Call listUsersValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return listUsersCall(pagination, _callback); } /** - * List Users - * Returns a list of users with access to the Workspace. - * @param pagination Pagination for users. This parameter exists in alpha. (required) + * List Users Returns a list of users with access to the Workspace. + * + * @param pagination Pagination for users. This parameter exists in v1. (optional) * @return ListUsers200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public ListUsers200Response listUsers(PaginationInput pagination) throws ApiException { ApiResponse localVarResp = listUsersWithHttpInfo(pagination); @@ -1188,74 +1438,85 @@ public ListUsers200Response listUsers(PaginationInput pagination) throws ApiExce } /** - * List Users - * Returns a list of users with access to the Workspace. - * @param pagination Pagination for users. This parameter exists in alpha. (required) + * List Users Returns a list of users with access to the Workspace. + * + * @param pagination Pagination for users. This parameter exists in v1. (optional) * @return ApiResponse<ListUsers200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listUsersWithHttpInfo(PaginationInput pagination) throws ApiException { + public ApiResponse listUsersWithHttpInfo(PaginationInput pagination) + throws ApiException { okhttp3.Call localVarCall = listUsersValidateBeforeCall(pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Users (asynchronously) - * Returns a list of users with access to the Workspace. - * @param pagination Pagination for users. This parameter exists in alpha. (required) + * List Users (asynchronously) Returns a list of users with access to the Workspace. + * + * @param pagination Pagination for users. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listUsersAsync(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listUsersAsync( + PaginationInput pagination, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = listUsersValidateBeforeCall(pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for replacePermissionsForUser - * @param userId (required) - * @param replacePermissionsForUserV1Input (required) + * + * @param userId (required) + * @param replacePermissionsForUserV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replacePermissionsForUserCall(String userId, ReplacePermissionsForUserV1Input replacePermissionsForUserV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call replacePermissionsForUserCall( + String userId, + ReplacePermissionsForUserV1Input replacePermissionsForUserV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1264,8 +1525,11 @@ public okhttp3.Call replacePermissionsForUserCall(String userId, ReplacePermissi Object localVarPostBody = replacePermissionsForUserV1Input; // create path and map variables - String localVarPath = "/users/{userId}/permissions" - .replaceAll("\\{" + "userId" + "\\}", localVarApiClient.escapeString(userId.toString())); + String localVarPath = + "/users/{userId}/permissions" + .replace( + "{" + "userId" + "}", + localVarApiClient.escapeString(userId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1274,7 +1538,10 @@ public okhttp3.Call replacePermissionsForUserCall(String userId, ReplacePermissi Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -1282,100 +1549,152 @@ public okhttp3.Call replacePermissionsForUserCall(String userId, ReplacePermissi } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replacePermissionsForUserValidateBeforeCall(String userId, ReplacePermissionsForUserV1Input replacePermissionsForUserV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call replacePermissionsForUserValidateBeforeCall( + String userId, + ReplacePermissionsForUserV1Input replacePermissionsForUserV1Input, + 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 replacePermissionsForUser(Async)"); + throw new ApiException( + "Missing the required parameter 'userId' when calling" + + " replacePermissionsForUser(Async)"); } - + // verify the required parameter 'replacePermissionsForUserV1Input' is set if (replacePermissionsForUserV1Input == null) { - throw new ApiException("Missing the required parameter 'replacePermissionsForUserV1Input' when calling replacePermissionsForUser(Async)"); + throw new ApiException( + "Missing the required parameter 'replacePermissionsForUserV1Input' when calling" + + " replacePermissionsForUser(Async)"); } - - - okhttp3.Call localVarCall = replacePermissionsForUserCall(userId, replacePermissionsForUserV1Input, _callback); - return localVarCall; + return replacePermissionsForUserCall(userId, replacePermissionsForUserV1Input, _callback); } /** - * Replace Permissions for User - * Updates the list of access permissions for a user. When called, this endpoint may generate the `Policy Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userId (required) - * @param replacePermissionsForUserV1Input (required) + * Replace Permissions for User Updates the list of access permissions for a user. • When + * called, this endpoint may generate the `Policy Deleted` event in the [audit + * trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which + * is lower than the default due to access pattern restrictions. Once reached, this endpoint + * will respond with the 429 HTTP status code with headers indicating the limit parameters. See + * [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userId (required) + * @param replacePermissionsForUserV1Input (required) * @return ReplacePermissionsForUser200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ReplacePermissionsForUser200Response replacePermissionsForUser(String userId, ReplacePermissionsForUserV1Input replacePermissionsForUserV1Input) throws ApiException { - ApiResponse localVarResp = replacePermissionsForUserWithHttpInfo(userId, replacePermissionsForUserV1Input); + public ReplacePermissionsForUser200Response replacePermissionsForUser( + String userId, ReplacePermissionsForUserV1Input replacePermissionsForUserV1Input) + throws ApiException { + ApiResponse localVarResp = + replacePermissionsForUserWithHttpInfo(userId, replacePermissionsForUserV1Input); return localVarResp.getData(); } /** - * Replace Permissions for User - * Updates the list of access permissions for a user. When called, this endpoint may generate the `Policy Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userId (required) - * @param replacePermissionsForUserV1Input (required) + * Replace Permissions for User Updates the list of access permissions for a user. • When + * called, this endpoint may generate the `Policy Deleted` event in the [audit + * trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, which + * is lower than the default due to access pattern restrictions. Once reached, this endpoint + * will respond with the 429 HTTP status code with headers indicating the limit parameters. See + * [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userId (required) + * @param replacePermissionsForUserV1Input (required) * @return ApiResponse<ReplacePermissionsForUser200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse replacePermissionsForUserWithHttpInfo(String userId, ReplacePermissionsForUserV1Input replacePermissionsForUserV1Input) throws ApiException { - okhttp3.Call localVarCall = replacePermissionsForUserValidateBeforeCall(userId, replacePermissionsForUserV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse replacePermissionsForUserWithHttpInfo( + String userId, ReplacePermissionsForUserV1Input replacePermissionsForUserV1Input) + throws ApiException { + okhttp3.Call localVarCall = + replacePermissionsForUserValidateBeforeCall( + userId, replacePermissionsForUserV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace Permissions for User (asynchronously) - * Updates the list of access permissions for a user. When called, this endpoint may generate the `Policy Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param userId (required) - * @param replacePermissionsForUserV1Input (required) + * Replace Permissions for User (asynchronously) Updates the list of access permissions for a + * user. • When called, this endpoint may generate the `Policy Deleted` event in the + * [audit trail](/tag/Audit-Trail). The rate limit for this endpoint is 60 requests per minute, + * which is lower than the default due to access pattern restrictions. Once reached, this + * endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param userId (required) + * @param replacePermissionsForUserV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replacePermissionsForUserAsync(String userId, ReplacePermissionsForUserV1Input replacePermissionsForUserV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = replacePermissionsForUserValidateBeforeCall(userId, replacePermissionsForUserV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call replacePermissionsForUserAsync( + String userId, + ReplacePermissionsForUserV1Input replacePermissionsForUserV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + replacePermissionsForUserValidateBeforeCall( + userId, replacePermissionsForUserV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/LabelsApi.java b/src/main/java/com/segment/publicapi/api/LabelsApi.java index b59e8678..3903b93e 100644 --- a/src/main/java/com/segment/publicapi/api/LabelsApi.java +++ b/src/main/java/com/segment/publicapi/api/LabelsApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,39 +9,24 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import com.segment.publicapi.models.CreateLabel200Response; -import com.segment.publicapi.models.CreateLabel200Response1; -import com.segment.publicapi.models.CreateLabelAlphaInput; +import com.segment.publicapi.models.CreateLabel201Response; import com.segment.publicapi.models.CreateLabelV1Input; import com.segment.publicapi.models.DeleteLabel200Response; -import com.segment.publicapi.models.DeleteLabel200Response1; import com.segment.publicapi.models.ListLabels200Response; -import com.segment.publicapi.models.ListLabels200Response1; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class LabelsApi { private ApiClient localVarApiClient; @@ -83,34 +67,37 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createLabel - * @param createLabelAlphaInput (required) + * + * @param createLabelV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createLabelCall(CreateLabelAlphaInput createLabelAlphaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createLabelCall( + CreateLabelV1Input createLabelV1Input, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } - Object localVarPostBody = createLabelAlphaInput; + Object localVarPostBody = createLabelV1Input; // create path and map variables String localVarPath = "/labels"; @@ -122,7 +109,10 @@ public okhttp3.Call createLabelCall(CreateLabelAlphaInput createLabelAlphaInput, Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -130,120 +120,162 @@ public okhttp3.Call createLabelCall(CreateLabelAlphaInput createLabelAlphaInput, } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createLabelValidateBeforeCall(CreateLabelAlphaInput createLabelAlphaInput, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'createLabelAlphaInput' is set - if (createLabelAlphaInput == null) { - throw new ApiException("Missing the required parameter 'createLabelAlphaInput' when calling createLabel(Async)"); + private okhttp3.Call createLabelValidateBeforeCall( + CreateLabelV1Input createLabelV1Input, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'createLabelV1Input' is set + if (createLabelV1Input == null) { + throw new ApiException( + "Missing the required parameter 'createLabelV1Input' when calling" + + " createLabel(Async)"); } - - - okhttp3.Call localVarCall = createLabelCall(createLabelAlphaInput, _callback); - return localVarCall; + return createLabelCall(createLabelV1Input, _callback); } /** - * Create Label - * Creates a new label. When called, this endpoint may generate the `Label Created` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param createLabelAlphaInput (required) - * @return CreateLabel200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * Create Label Creates a new label. • When called, this endpoint may generate the `Label + * Created` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint + * is 60 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param createLabelV1Input (required) + * @return CreateLabel201Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateLabel200Response createLabel(CreateLabelAlphaInput createLabelAlphaInput) throws ApiException { - ApiResponse localVarResp = createLabelWithHttpInfo(createLabelAlphaInput); + public CreateLabel201Response createLabel(CreateLabelV1Input createLabelV1Input) + throws ApiException { + ApiResponse localVarResp = + createLabelWithHttpInfo(createLabelV1Input); return localVarResp.getData(); } /** - * Create Label - * Creates a new label. When called, this endpoint may generate the `Label Created` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param createLabelAlphaInput (required) - * @return ApiResponse<CreateLabel200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * Create Label Creates a new label. • When called, this endpoint may generate the `Label + * Created` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint + * is 60 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param createLabelV1Input (required) + * @return ApiResponse<CreateLabel201Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createLabelWithHttpInfo(CreateLabelAlphaInput createLabelAlphaInput) throws ApiException { - okhttp3.Call localVarCall = createLabelValidateBeforeCall(createLabelAlphaInput, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse createLabelWithHttpInfo( + CreateLabelV1Input createLabelV1Input) throws ApiException { + okhttp3.Call localVarCall = createLabelValidateBeforeCall(createLabelV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Label (asynchronously) - * Creates a new label. When called, this endpoint may generate the `Label Created` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param createLabelAlphaInput (required) + * Create Label (asynchronously) Creates a new label. • When called, this endpoint may generate + * the `Label Created` event in the [audit trail](/tag/Audit-Trail). The rate limit + * for this endpoint is 60 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param createLabelV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createLabelAsync(CreateLabelAlphaInput createLabelAlphaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createLabelAsync( + CreateLabelV1Input createLabelV1Input, + final ApiCallback _callback) + throws ApiException { - okhttp3.Call localVarCall = createLabelValidateBeforeCall(createLabelAlphaInput, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + okhttp3.Call localVarCall = createLabelValidateBeforeCall(createLabelV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for deleteLabel - * @param key (required) - * @param value (required) + * + * @param key (required) + * @param value (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteLabelCall(String key, String value, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteLabelCall(String key, String value, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -252,9 +284,12 @@ public okhttp3.Call deleteLabelCall(String key, String value, final ApiCallback Object localVarPostBody = null; // create path and map variables - String localVarPath = "/labels/{key}/{value}" - .replaceAll("\\{" + "key" + "\\}", localVarApiClient.escapeString(key.toString())) - .replaceAll("\\{" + "value" + "\\}", localVarApiClient.escapeString(value.toString())); + String localVarPath = + "/labels/{key}/{value}" + .replace("{" + "key" + "}", localVarApiClient.escapeString(key.toString())) + .replace( + "{" + "value" + "}", + localVarApiClient.escapeString(value.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -263,59 +298,77 @@ public okhttp3.Call deleteLabelCall(String key, String value, final ApiCallback Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteLabelValidateBeforeCall(String key, String value, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call deleteLabelValidateBeforeCall( + String key, String value, final ApiCallback _callback) throws ApiException { // verify the required parameter 'key' is set if (key == null) { - throw new ApiException("Missing the required parameter 'key' when calling deleteLabel(Async)"); + throw new ApiException( + "Missing the required parameter 'key' when calling deleteLabel(Async)"); } - + // verify the required parameter 'value' is set if (value == null) { - throw new ApiException("Missing the required parameter 'value' when calling deleteLabel(Async)"); + throw new ApiException( + "Missing the required parameter 'value' when calling deleteLabel(Async)"); } - - - okhttp3.Call localVarCall = deleteLabelCall(key, value, _callback); - return localVarCall; + return deleteLabelCall(key, value, _callback); } /** - * Delete Label - * Deletes a label. When called, this endpoint may generate the `Label Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param key (required) - * @param value (required) + * Delete Label Deletes a label. • When called, this endpoint may generate the `Label + * Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint + * is 60 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param key (required) + * @param value (required) * @return DeleteLabel200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public DeleteLabel200Response deleteLabel(String key, String value) throws ApiException { ApiResponse localVarResp = deleteLabelWithHttpInfo(key, value); @@ -323,74 +376,91 @@ public DeleteLabel200Response deleteLabel(String key, String value) throws ApiEx } /** - * Delete Label - * Deletes a label. When called, this endpoint may generate the `Label Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param key (required) - * @param value (required) + * Delete Label Deletes a label. • When called, this endpoint may generate the `Label + * Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for this endpoint + * is 60 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param key (required) + * @param value (required) * @return ApiResponse<DeleteLabel200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse deleteLabelWithHttpInfo(String key, String value) throws ApiException { + public ApiResponse deleteLabelWithHttpInfo(String key, String value) + throws ApiException { okhttp3.Call localVarCall = deleteLabelValidateBeforeCall(key, value, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Delete Label (asynchronously) - * Deletes a label. When called, this endpoint may generate the `Label Deleted` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param key (required) - * @param value (required) + * Delete Label (asynchronously) Deletes a label. • When called, this endpoint may generate the + * `Label Deleted` event in the [audit trail](/tag/Audit-Trail). The rate limit for + * this endpoint is 60 requests per minute, which is lower than the default due to access + * pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code + * with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param key (required) + * @param value (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteLabelAsync(String key, String value, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteLabelAsync( + String key, String value, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = deleteLabelValidateBeforeCall(key, value, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listLabels + * * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public okhttp3.Call listLabelsCall(final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -408,47 +478,58 @@ public okhttp3.Call listLabelsCall(final ApiCallback _callback) throws ApiExcept Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listLabelsValidateBeforeCall(final ApiCallback _callback) throws ApiException { - - - okhttp3.Call localVarCall = listLabelsCall(_callback); - return localVarCall; - + private okhttp3.Call listLabelsValidateBeforeCall(final ApiCallback _callback) + throws ApiException { + return listLabelsCall(_callback); } /** - * List Labels - * Returns a list of all available labels. + * List Labels Returns a list of all available labels. + * * @return ListLabels200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public ListLabels200Response listLabels() throws ApiException { ApiResponse localVarResp = listLabelsWithHttpInfo(); @@ -456,44 +537,47 @@ public ListLabels200Response listLabels() throws ApiException { } /** - * List Labels - * Returns a list of all available labels. + * List Labels Returns a list of all available labels. + * * @return ApiResponse<ListLabels200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public ApiResponse listLabelsWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = listLabelsValidateBeforeCall(null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Labels (asynchronously) - * Returns a list of all available labels. + * List Labels (asynchronously) Returns a list of all available labels. + * * @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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listLabelsAsync(final ApiCallback _callback) throws ApiException { + public okhttp3.Call listLabelsAsync(final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = listLabelsValidateBeforeCall(_callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/MonthlyTrackedUsersApi.java b/src/main/java/com/segment/publicapi/api/MonthlyTrackedUsersApi.java index 6359e3d0..5b07ee22 100644 --- a/src/main/java/com/segment/publicapi/api/MonthlyTrackedUsersApi.java +++ b/src/main/java/com/segment/publicapi/api/MonthlyTrackedUsersApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,34 +9,23 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.GetDailyPerSourceMTUUsage200Response; import com.segment.publicapi.models.GetDailyWorkspaceMTUUsage200Response; import com.segment.publicapi.models.PaginationInput; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class MonthlyTrackedUsersApi { private ApiClient localVarApiClient; @@ -78,29 +66,34 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getDailyPerSourceMTUUsage - * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for per Source MTU counts. This parameter exists in alpha. (required) + * + * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for per Source MTU counts. This parameter exists in v1. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDailyPerSourceMTUUsageCall(String period, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getDailyPerSourceMTUUsageCall( + String period, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -126,136 +119,173 @@ public okhttp3.Call getDailyPerSourceMTUUsageCall(String period, PaginationInput } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getDailyPerSourceMTUUsageValidateBeforeCall(String period, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getDailyPerSourceMTUUsageValidateBeforeCall( + String period, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'period' is set if (period == null) { - throw new ApiException("Missing the required parameter 'period' when calling getDailyPerSourceMTUUsage(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling getDailyPerSourceMTUUsage(Async)"); + throw new ApiException( + "Missing the required parameter 'period' when calling" + + " getDailyPerSourceMTUUsage(Async)"); } - - - okhttp3.Call localVarCall = getDailyPerSourceMTUUsageCall(period, pagination, _callback); - return localVarCall; + return getDailyPerSourceMTUUsageCall(period, pagination, _callback); } /** - * Get Daily Per Source MTU Usage - * Provides daily cumulative per-source MTU counts for a usage period. - * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for per Source MTU counts. This parameter exists in alpha. (required) + * Get Daily Per Source MTU Usage Provides daily cumulative per-source MTU counts for a usage + * period. + * + * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for per Source MTU counts. This parameter exists in v1. + * (optional) * @return GetDailyPerSourceMTUUsage200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetDailyPerSourceMTUUsage200Response getDailyPerSourceMTUUsage(String period, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = getDailyPerSourceMTUUsageWithHttpInfo(period, pagination); + public GetDailyPerSourceMTUUsage200Response getDailyPerSourceMTUUsage( + String period, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + getDailyPerSourceMTUUsageWithHttpInfo(period, pagination); return localVarResp.getData(); } /** - * Get Daily Per Source MTU Usage - * Provides daily cumulative per-source MTU counts for a usage period. - * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for per Source MTU counts. This parameter exists in alpha. (required) + * Get Daily Per Source MTU Usage Provides daily cumulative per-source MTU counts for a usage + * period. + * + * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for per Source MTU counts. This parameter exists in v1. + * (optional) * @return ApiResponse<GetDailyPerSourceMTUUsage200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getDailyPerSourceMTUUsageWithHttpInfo(String period, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = getDailyPerSourceMTUUsageValidateBeforeCall(period, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse getDailyPerSourceMTUUsageWithHttpInfo( + String period, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + getDailyPerSourceMTUUsageValidateBeforeCall(period, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Daily Per Source MTU Usage (asynchronously) - * Provides daily cumulative per-source MTU counts for a usage period. - * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for per Source MTU counts. This parameter exists in alpha. (required) + * Get Daily Per Source MTU Usage (asynchronously) Provides daily cumulative per-source MTU + * counts for a usage period. + * + * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for per Source MTU counts. This parameter exists in v1. + * (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDailyPerSourceMTUUsageAsync(String period, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getDailyPerSourceMTUUsageValidateBeforeCall(period, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getDailyPerSourceMTUUsageAsync( + String period, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getDailyPerSourceMTUUsageValidateBeforeCall(period, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getDailyWorkspaceMTUUsage - * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for Workspace MTU counts. This parameter exists in alpha. (required) + * + * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for Workspace MTU counts. This parameter exists in v1. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDailyWorkspaceMTUUsageCall(String period, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getDailyWorkspaceMTUUsageCall( + String period, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -281,108 +311,137 @@ public okhttp3.Call getDailyWorkspaceMTUUsageCall(String period, PaginationInput } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getDailyWorkspaceMTUUsageValidateBeforeCall(String period, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getDailyWorkspaceMTUUsageValidateBeforeCall( + String period, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'period' is set if (period == null) { - throw new ApiException("Missing the required parameter 'period' when calling getDailyWorkspaceMTUUsage(Async)"); + throw new ApiException( + "Missing the required parameter 'period' when calling" + + " getDailyWorkspaceMTUUsage(Async)"); } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling getDailyWorkspaceMTUUsage(Async)"); - } - - - okhttp3.Call localVarCall = getDailyWorkspaceMTUUsageCall(period, pagination, _callback); - return localVarCall; + return getDailyWorkspaceMTUUsageCall(period, pagination, _callback); } /** - * Get Daily Workspace MTU Usage - * Provides daily cumulative MTU counts for a usage period. - * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for Workspace MTU counts. This parameter exists in alpha. (required) + * Get Daily Workspace MTU Usage Provides daily cumulative MTU counts for a usage period. + * + * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for Workspace MTU counts. This parameter exists in v1. + * (optional) * @return GetDailyWorkspaceMTUUsage200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetDailyWorkspaceMTUUsage200Response getDailyWorkspaceMTUUsage(String period, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = getDailyWorkspaceMTUUsageWithHttpInfo(period, pagination); + public GetDailyWorkspaceMTUUsage200Response getDailyWorkspaceMTUUsage( + String period, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + getDailyWorkspaceMTUUsageWithHttpInfo(period, pagination); return localVarResp.getData(); } /** - * Get Daily Workspace MTU Usage - * Provides daily cumulative MTU counts for a usage period. - * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for Workspace MTU counts. This parameter exists in alpha. (required) + * Get Daily Workspace MTU Usage Provides daily cumulative MTU counts for a usage period. + * + * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for Workspace MTU counts. This parameter exists in v1. + * (optional) * @return ApiResponse<GetDailyWorkspaceMTUUsage200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getDailyWorkspaceMTUUsageWithHttpInfo(String period, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = getDailyWorkspaceMTUUsageValidateBeforeCall(period, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse getDailyWorkspaceMTUUsageWithHttpInfo( + String period, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + getDailyWorkspaceMTUUsageValidateBeforeCall(period, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Daily Workspace MTU Usage (asynchronously) - * Provides daily cumulative MTU counts for a usage period. - * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in alpha. (required) - * @param pagination Pagination input for Workspace MTU counts. This parameter exists in alpha. (required) + * Get Daily Workspace MTU Usage (asynchronously) Provides daily cumulative MTU counts for a + * usage period. + * + * @param period The start of the usage month, in the ISO-8601 format. This parameter exists in + * v1. (required) + * @param pagination Pagination input for Workspace MTU counts. This parameter exists in v1. + * (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getDailyWorkspaceMTUUsageAsync(String period, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getDailyWorkspaceMTUUsageValidateBeforeCall(period, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getDailyWorkspaceMTUUsageAsync( + String period, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getDailyWorkspaceMTUUsageValidateBeforeCall(period, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/ProfilesSyncApi.java b/src/main/java/com/segment/publicapi/api/ProfilesSyncApi.java new file mode 100644 index 00000000..3c4a04f4 --- /dev/null +++ b/src/main/java/com/segment/publicapi/api/ProfilesSyncApi.java @@ -0,0 +1,1328 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.api; + +import com.google.gson.reflect.TypeToken; +import com.segment.publicapi.ApiCallback; +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.ApiResponse; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.Pair; +import com.segment.publicapi.models.CreateProfilesWarehouse201Response; +import com.segment.publicapi.models.CreateProfilesWarehouseAlphaInput; +import com.segment.publicapi.models.ListProfilesWarehouseInSpace200Response; +import com.segment.publicapi.models.ListSelectiveSyncsFromWarehouseAndSpace200Response; +import com.segment.publicapi.models.PaginationInput; +import com.segment.publicapi.models.RemoveProfilesWarehouseFromSpace200Response; +import com.segment.publicapi.models.UpdateProfilesWarehouseForSpaceWarehouse200Response; +import com.segment.publicapi.models.UpdateProfilesWarehouseForSpaceWarehouseAlphaInput; +import com.segment.publicapi.models.UpdateSelectiveSyncForWarehouseAndSpace200Response; +import com.segment.publicapi.models.UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ProfilesSyncApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ProfilesSyncApi() { + this(Configuration.getDefaultApiClient()); + } + + public ProfilesSyncApi(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 createProfilesWarehouse + * + * @param spaceId (required) + * @param createProfilesWarehouseAlphaInput (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 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createProfilesWarehouseCall( + String spaceId, + CreateProfilesWarehouseAlphaInput createProfilesWarehouseAlphaInput, + 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 = createProfilesWarehouseAlphaInput; + + // create path and map variables + String localVarPath = + "/spaces/{spaceId}/profiles-warehouses" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createProfilesWarehouseValidateBeforeCall( + String spaceId, + CreateProfilesWarehouseAlphaInput createProfilesWarehouseAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " createProfilesWarehouse(Async)"); + } + + // verify the required parameter 'createProfilesWarehouseAlphaInput' is set + if (createProfilesWarehouseAlphaInput == null) { + throw new ApiException( + "Missing the required parameter 'createProfilesWarehouseAlphaInput' when" + + " calling createProfilesWarehouse(Async)"); + } + + return createProfilesWarehouseCall(spaceId, createProfilesWarehouseAlphaInput, _callback); + } + + /** + * Create Profiles Warehouse Creates a new Profiles Warehouse. • When called, this endpoint may + * generate the `Profiles Sync Warehouse Created` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param createProfilesWarehouseAlphaInput (required) + * @return CreateProfilesWarehouse201Response + * @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 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateProfilesWarehouse201Response createProfilesWarehouse( + String spaceId, CreateProfilesWarehouseAlphaInput createProfilesWarehouseAlphaInput) + throws ApiException { + ApiResponse localVarResp = + createProfilesWarehouseWithHttpInfo(spaceId, createProfilesWarehouseAlphaInput); + return localVarResp.getData(); + } + + /** + * Create Profiles Warehouse Creates a new Profiles Warehouse. • When called, this endpoint may + * generate the `Profiles Sync Warehouse Created` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param createProfilesWarehouseAlphaInput (required) + * @return ApiResponse<CreateProfilesWarehouse201Response> + * @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 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse createProfilesWarehouseWithHttpInfo( + String spaceId, CreateProfilesWarehouseAlphaInput createProfilesWarehouseAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + createProfilesWarehouseValidateBeforeCall( + spaceId, createProfilesWarehouseAlphaInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Profiles Warehouse (asynchronously) Creates a new Profiles Warehouse. • When called, + * this endpoint may generate the `Profiles Sync Warehouse Created` event in the + * [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param createProfilesWarehouseAlphaInput (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 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createProfilesWarehouseAsync( + String spaceId, + CreateProfilesWarehouseAlphaInput createProfilesWarehouseAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createProfilesWarehouseValidateBeforeCall( + spaceId, createProfilesWarehouseAlphaInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listProfilesWarehouseInSpace + * + * @param spaceId (required) + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listProfilesWarehouseInSpaceCall( + String spaceId, PaginationInput pagination, 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 = + "/spaces/{spaceId}/profiles-warehouses" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listProfilesWarehouseInSpaceValidateBeforeCall( + String spaceId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " listProfilesWarehouseInSpace(Async)"); + } + + return listProfilesWarehouseInSpaceCall(spaceId, pagination, _callback); + } + + /** + * List Profiles Warehouse in Space Lists all Profile Warehouses for a given space id. • When + * called, this endpoint may generate the `Profiles Sync Warehouse Retrieved` event in + * the [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (optional) + * @return ListProfilesWarehouseInSpace200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListProfilesWarehouseInSpace200Response listProfilesWarehouseInSpace( + String spaceId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listProfilesWarehouseInSpaceWithHttpInfo(spaceId, pagination); + return localVarResp.getData(); + } + + /** + * List Profiles Warehouse in Space Lists all Profile Warehouses for a given space id. • When + * called, this endpoint may generate the `Profiles Sync Warehouse Retrieved` event in + * the [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (optional) + * @return ApiResponse<ListProfilesWarehouseInSpace200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + listProfilesWarehouseInSpaceWithHttpInfo(String spaceId, PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + listProfilesWarehouseInSpaceValidateBeforeCall(spaceId, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Profiles Warehouse in Space (asynchronously) Lists all Profile Warehouses for a given + * space id. • When called, this endpoint may generate the `Profiles Sync Warehouse + * Retrieved` event in the [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listProfilesWarehouseInSpaceAsync( + String spaceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listProfilesWarehouseInSpaceValidateBeforeCall(spaceId, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listSelectiveSyncsFromWarehouseAndSpace + * + * @param spaceId (required) + * @param warehouseId (required) + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listSelectiveSyncsFromWarehouseAndSpaceCall( + String spaceId, + String warehouseId, + PaginationInput pagination, + 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 = + "/spaces/{spaceId}/profiles-warehouses/{warehouseId}/selective-syncs" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listSelectiveSyncsFromWarehouseAndSpaceValidateBeforeCall( + String spaceId, + String warehouseId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " listSelectiveSyncsFromWarehouseAndSpace(Async)"); + } + + // verify the required parameter 'warehouseId' is set + if (warehouseId == null) { + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " listSelectiveSyncsFromWarehouseAndSpace(Async)"); + } + + return listSelectiveSyncsFromWarehouseAndSpaceCall( + spaceId, warehouseId, pagination, _callback); + } + + /** + * List Selective Syncs from Warehouse And Space Returns the schema for a Space Warehouse + * connection, including Collections and Properties. + * + * @param spaceId (required) + * @param warehouseId (required) + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (optional) + * @return ListSelectiveSyncsFromWarehouseAndSpace200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListSelectiveSyncsFromWarehouseAndSpace200Response + listSelectiveSyncsFromWarehouseAndSpace( + String spaceId, String warehouseId, PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listSelectiveSyncsFromWarehouseAndSpaceWithHttpInfo( + spaceId, warehouseId, pagination); + return localVarResp.getData(); + } + + /** + * List Selective Syncs from Warehouse And Space Returns the schema for a Space Warehouse + * connection, including Collections and Properties. + * + * @param spaceId (required) + * @param warehouseId (required) + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (optional) + * @return ApiResponse<ListSelectiveSyncsFromWarehouseAndSpace200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + listSelectiveSyncsFromWarehouseAndSpaceWithHttpInfo( + String spaceId, String warehouseId, PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + listSelectiveSyncsFromWarehouseAndSpaceValidateBeforeCall( + spaceId, warehouseId, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Selective Syncs from Warehouse And Space (asynchronously) Returns the schema for a Space + * Warehouse connection, including Collections and Properties. + * + * @param spaceId (required) + * @param warehouseId (required) + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listSelectiveSyncsFromWarehouseAndSpaceAsync( + String spaceId, + String warehouseId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSelectiveSyncsFromWarehouseAndSpaceValidateBeforeCall( + spaceId, warehouseId, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for removeProfilesWarehouseFromSpace + * + * @param spaceId (required) + * @param warehouseId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call removeProfilesWarehouseFromSpaceCall( + String spaceId, String warehouseId, 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 = + "/spaces/{spaceId}/profiles-warehouses/{warehouseId}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.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.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call removeProfilesWarehouseFromSpaceValidateBeforeCall( + String spaceId, String warehouseId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " removeProfilesWarehouseFromSpace(Async)"); + } + + // verify the required parameter 'warehouseId' is set + if (warehouseId == null) { + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " removeProfilesWarehouseFromSpace(Async)"); + } + + return removeProfilesWarehouseFromSpaceCall(spaceId, warehouseId, _callback); + } + + /** + * Remove Profiles Warehouse from Space Deletes an existing Profiles Warehouse. • When called, + * this endpoint may generate the `Profiles Sync Warehouse Deleted` event in the + * [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param warehouseId (required) + * @return RemoveProfilesWarehouseFromSpace200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public RemoveProfilesWarehouseFromSpace200Response removeProfilesWarehouseFromSpace( + String spaceId, String warehouseId) throws ApiException { + ApiResponse localVarResp = + removeProfilesWarehouseFromSpaceWithHttpInfo(spaceId, warehouseId); + return localVarResp.getData(); + } + + /** + * Remove Profiles Warehouse from Space Deletes an existing Profiles Warehouse. • When called, + * this endpoint may generate the `Profiles Sync Warehouse Deleted` event in the + * [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param warehouseId (required) + * @return ApiResponse<RemoveProfilesWarehouseFromSpace200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + removeProfilesWarehouseFromSpaceWithHttpInfo(String spaceId, String warehouseId) + throws ApiException { + okhttp3.Call localVarCall = + removeProfilesWarehouseFromSpaceValidateBeforeCall(spaceId, warehouseId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Remove Profiles Warehouse from Space (asynchronously) Deletes an existing Profiles Warehouse. + * • When called, this endpoint may generate the `Profiles Sync Warehouse Deleted` + * event in the [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param warehouseId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call removeProfilesWarehouseFromSpaceAsync( + String spaceId, + String warehouseId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeProfilesWarehouseFromSpaceValidateBeforeCall(spaceId, warehouseId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateProfilesWarehouseForSpaceWarehouse + * + * @param spaceId (required) + * @param warehouseId (required) + * @param updateProfilesWarehouseForSpaceWarehouseAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateProfilesWarehouseForSpaceWarehouseCall( + String spaceId, + String warehouseId, + UpdateProfilesWarehouseForSpaceWarehouseAlphaInput + updateProfilesWarehouseForSpaceWarehouseAlphaInput, + 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 = updateProfilesWarehouseForSpaceWarehouseAlphaInput; + + // create path and map variables + String localVarPath = + "/spaces/{spaceId}/profiles-warehouses/{warehouseId}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateProfilesWarehouseForSpaceWarehouseValidateBeforeCall( + String spaceId, + String warehouseId, + UpdateProfilesWarehouseForSpaceWarehouseAlphaInput + updateProfilesWarehouseForSpaceWarehouseAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " updateProfilesWarehouseForSpaceWarehouse(Async)"); + } + + // verify the required parameter 'warehouseId' is set + if (warehouseId == null) { + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " updateProfilesWarehouseForSpaceWarehouse(Async)"); + } + + // verify the required parameter 'updateProfilesWarehouseForSpaceWarehouseAlphaInput' is set + if (updateProfilesWarehouseForSpaceWarehouseAlphaInput == null) { + throw new ApiException( + "Missing the required parameter" + + " 'updateProfilesWarehouseForSpaceWarehouseAlphaInput' when calling" + + " updateProfilesWarehouseForSpaceWarehouse(Async)"); + } + + return updateProfilesWarehouseForSpaceWarehouseCall( + spaceId, + warehouseId, + updateProfilesWarehouseForSpaceWarehouseAlphaInput, + _callback); + } + + /** + * Update Profiles Warehouse for Space Warehouse Updates an existing Profiles Warehouse. • When + * called, this endpoint may generate the `Profiles Sync Warehouse Updated` event in + * the [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param warehouseId (required) + * @param updateProfilesWarehouseForSpaceWarehouseAlphaInput (required) + * @return UpdateProfilesWarehouseForSpaceWarehouse200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public UpdateProfilesWarehouseForSpaceWarehouse200Response + updateProfilesWarehouseForSpaceWarehouse( + String spaceId, + String warehouseId, + UpdateProfilesWarehouseForSpaceWarehouseAlphaInput + updateProfilesWarehouseForSpaceWarehouseAlphaInput) + throws ApiException { + ApiResponse localVarResp = + updateProfilesWarehouseForSpaceWarehouseWithHttpInfo( + spaceId, warehouseId, updateProfilesWarehouseForSpaceWarehouseAlphaInput); + return localVarResp.getData(); + } + + /** + * Update Profiles Warehouse for Space Warehouse Updates an existing Profiles Warehouse. • When + * called, this endpoint may generate the `Profiles Sync Warehouse Updated` event in + * the [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param warehouseId (required) + * @param updateProfilesWarehouseForSpaceWarehouseAlphaInput (required) + * @return ApiResponse<UpdateProfilesWarehouseForSpaceWarehouse200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + updateProfilesWarehouseForSpaceWarehouseWithHttpInfo( + String spaceId, + String warehouseId, + UpdateProfilesWarehouseForSpaceWarehouseAlphaInput + updateProfilesWarehouseForSpaceWarehouseAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + updateProfilesWarehouseForSpaceWarehouseValidateBeforeCall( + spaceId, + warehouseId, + updateProfilesWarehouseForSpaceWarehouseAlphaInput, + null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Profiles Warehouse for Space Warehouse (asynchronously) Updates an existing Profiles + * Warehouse. • When called, this endpoint may generate the `Profiles Sync Warehouse + * Updated` event in the [audit trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param warehouseId (required) + * @param updateProfilesWarehouseForSpaceWarehouseAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateProfilesWarehouseForSpaceWarehouseAsync( + String spaceId, + String warehouseId, + UpdateProfilesWarehouseForSpaceWarehouseAlphaInput + updateProfilesWarehouseForSpaceWarehouseAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateProfilesWarehouseForSpaceWarehouseValidateBeforeCall( + spaceId, + warehouseId, + updateProfilesWarehouseForSpaceWarehouseAlphaInput, + _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateSelectiveSyncForWarehouseAndSpace + * + * @param spaceId (required) + * @param warehouseId (required) + * @param updateSelectiveSyncForWarehouseAndSpaceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateSelectiveSyncForWarehouseAndSpaceCall( + String spaceId, + String warehouseId, + UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput + updateSelectiveSyncForWarehouseAndSpaceAlphaInput, + 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 = updateSelectiveSyncForWarehouseAndSpaceAlphaInput; + + // create path and map variables + String localVarPath = + "/spaces/{spaceId}/profiles-warehouses/{warehouseId}/selective-syncs" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())) + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateSelectiveSyncForWarehouseAndSpaceValidateBeforeCall( + String spaceId, + String warehouseId, + UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput + updateSelectiveSyncForWarehouseAndSpaceAlphaInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " updateSelectiveSyncForWarehouseAndSpace(Async)"); + } + + // verify the required parameter 'warehouseId' is set + if (warehouseId == null) { + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " updateSelectiveSyncForWarehouseAndSpace(Async)"); + } + + // verify the required parameter 'updateSelectiveSyncForWarehouseAndSpaceAlphaInput' is set + if (updateSelectiveSyncForWarehouseAndSpaceAlphaInput == null) { + throw new ApiException( + "Missing the required parameter" + + " 'updateSelectiveSyncForWarehouseAndSpaceAlphaInput' when calling" + + " updateSelectiveSyncForWarehouseAndSpace(Async)"); + } + + return updateSelectiveSyncForWarehouseAndSpaceCall( + spaceId, warehouseId, updateSelectiveSyncForWarehouseAndSpaceAlphaInput, _callback); + } + + /** + * Update Selective Sync for Warehouse And Space Updates the schema for a Space Warehouse + * connection, including Collections and Properties. • When called, this endpoint may generate + * the `Profiles Sync Warehouse Modified` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param warehouseId (required) + * @param updateSelectiveSyncForWarehouseAndSpaceAlphaInput (required) + * @return UpdateSelectiveSyncForWarehouseAndSpace200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public UpdateSelectiveSyncForWarehouseAndSpace200Response + updateSelectiveSyncForWarehouseAndSpace( + String spaceId, + String warehouseId, + UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput + updateSelectiveSyncForWarehouseAndSpaceAlphaInput) + throws ApiException { + ApiResponse localVarResp = + updateSelectiveSyncForWarehouseAndSpaceWithHttpInfo( + spaceId, warehouseId, updateSelectiveSyncForWarehouseAndSpaceAlphaInput); + return localVarResp.getData(); + } + + /** + * Update Selective Sync for Warehouse And Space Updates the schema for a Space Warehouse + * connection, including Collections and Properties. • When called, this endpoint may generate + * the `Profiles Sync Warehouse Modified` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param warehouseId (required) + * @param updateSelectiveSyncForWarehouseAndSpaceAlphaInput (required) + * @return ApiResponse<UpdateSelectiveSyncForWarehouseAndSpace200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + updateSelectiveSyncForWarehouseAndSpaceWithHttpInfo( + String spaceId, + String warehouseId, + UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput + updateSelectiveSyncForWarehouseAndSpaceAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + updateSelectiveSyncForWarehouseAndSpaceValidateBeforeCall( + spaceId, + warehouseId, + updateSelectiveSyncForWarehouseAndSpaceAlphaInput, + null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Selective Sync for Warehouse And Space (asynchronously) Updates the schema for a Space + * Warehouse connection, including Collections and Properties. • When called, this endpoint may + * generate the `Profiles Sync Warehouse Modified` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param spaceId (required) + * @param warehouseId (required) + * @param updateSelectiveSyncForWarehouseAndSpaceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateSelectiveSyncForWarehouseAndSpaceAsync( + String spaceId, + String warehouseId, + UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput + updateSelectiveSyncForWarehouseAndSpaceAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateSelectiveSyncForWarehouseAndSpaceValidateBeforeCall( + spaceId, + warehouseId, + updateSelectiveSyncForWarehouseAndSpaceAlphaInput, + _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/segment/publicapi/api/ReverseEtlApi.java b/src/main/java/com/segment/publicapi/api/ReverseEtlApi.java new file mode 100644 index 00000000..0352a333 --- /dev/null +++ b/src/main/java/com/segment/publicapi/api/ReverseEtlApi.java @@ -0,0 +1,1777 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.api; + +import com.google.gson.reflect.TypeToken; +import com.segment.publicapi.ApiCallback; +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.ApiResponse; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.Pair; +import com.segment.publicapi.models.CancelReverseETLSyncForModel200Response; +import com.segment.publicapi.models.CancelReverseETLSyncForModelInput; +import com.segment.publicapi.models.CreateReverseETLManualSync200Response; +import com.segment.publicapi.models.CreateReverseETLManualSyncInput; +import com.segment.publicapi.models.CreateReverseEtlModel201Response; +import com.segment.publicapi.models.CreateReverseEtlModelInput; +import com.segment.publicapi.models.DeleteReverseEtlModel200Response; +import com.segment.publicapi.models.GetReverseETLSyncStatus200Response; +import com.segment.publicapi.models.GetReverseEtlModel200Response; +import com.segment.publicapi.models.ListReverseETLSyncStatusesFromModelAndSubscriptionId200Response; +import com.segment.publicapi.models.ListReverseEtlModels200Response; +import com.segment.publicapi.models.PaginationInput; +import com.segment.publicapi.models.UpdateReverseEtlModel200Response; +import com.segment.publicapi.models.UpdateReverseEtlModelInput; +import java.lang.reflect.Type; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ReverseEtlApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ReverseEtlApi() { + this(Configuration.getDefaultApiClient()); + } + + public ReverseEtlApi(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 cancelReverseETLSyncForModel + * + * @param modelId (required) + * @param syncId (required) + * @param cancelReverseETLSyncForModelInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call cancelReverseETLSyncForModelCall( + String modelId, + String syncId, + CancelReverseETLSyncForModelInput cancelReverseETLSyncForModelInput, + 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 = cancelReverseETLSyncForModelInput; + + // create path and map variables + String localVarPath = + "/reverse-etl-models/{modelId}/syncs/{syncId}/cancel" + .replace( + "{" + "modelId" + "}", + localVarApiClient.escapeString(modelId.toString())) + .replace( + "{" + "syncId" + "}", + localVarApiClient.escapeString(syncId.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call cancelReverseETLSyncForModelValidateBeforeCall( + String modelId, + String syncId, + CancelReverseETLSyncForModelInput cancelReverseETLSyncForModelInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'modelId' is set + if (modelId == null) { + throw new ApiException( + "Missing the required parameter 'modelId' when calling" + + " cancelReverseETLSyncForModel(Async)"); + } + + // verify the required parameter 'syncId' is set + if (syncId == null) { + throw new ApiException( + "Missing the required parameter 'syncId' when calling" + + " cancelReverseETLSyncForModel(Async)"); + } + + // verify the required parameter 'cancelReverseETLSyncForModelInput' is set + if (cancelReverseETLSyncForModelInput == null) { + throw new ApiException( + "Missing the required parameter 'cancelReverseETLSyncForModelInput' when" + + " calling cancelReverseETLSyncForModel(Async)"); + } + + return cancelReverseETLSyncForModelCall( + modelId, syncId, cancelReverseETLSyncForModelInput, _callback); + } + + /** + * Cancel Reverse ETL Sync for Model Cancels a sync for a Reverse ETL Connection. It might take + * a few seconds to completely cancel the sync. Will return an error if the sync is already + * completed or cancelled. + * + * @param modelId (required) + * @param syncId (required) + * @param cancelReverseETLSyncForModelInput (required) + * @return CancelReverseETLSyncForModel200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CancelReverseETLSyncForModel200Response cancelReverseETLSyncForModel( + String modelId, + String syncId, + CancelReverseETLSyncForModelInput cancelReverseETLSyncForModelInput) + throws ApiException { + ApiResponse localVarResp = + cancelReverseETLSyncForModelWithHttpInfo( + modelId, syncId, cancelReverseETLSyncForModelInput); + return localVarResp.getData(); + } + + /** + * Cancel Reverse ETL Sync for Model Cancels a sync for a Reverse ETL Connection. It might take + * a few seconds to completely cancel the sync. Will return an error if the sync is already + * completed or cancelled. + * + * @param modelId (required) + * @param syncId (required) + * @param cancelReverseETLSyncForModelInput (required) + * @return ApiResponse<CancelReverseETLSyncForModel200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + cancelReverseETLSyncForModelWithHttpInfo( + String modelId, + String syncId, + CancelReverseETLSyncForModelInput cancelReverseETLSyncForModelInput) + throws ApiException { + okhttp3.Call localVarCall = + cancelReverseETLSyncForModelValidateBeforeCall( + modelId, syncId, cancelReverseETLSyncForModelInput, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Cancel Reverse ETL Sync for Model (asynchronously) Cancels a sync for a Reverse ETL + * Connection. It might take a few seconds to completely cancel the sync. Will return an error + * if the sync is already completed or cancelled. + * + * @param modelId (required) + * @param syncId (required) + * @param cancelReverseETLSyncForModelInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call cancelReverseETLSyncForModelAsync( + String modelId, + String syncId, + CancelReverseETLSyncForModelInput cancelReverseETLSyncForModelInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + cancelReverseETLSyncForModelValidateBeforeCall( + modelId, syncId, cancelReverseETLSyncForModelInput, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createReverseETLManualSync + * + * @param createReverseETLManualSyncInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createReverseETLManualSyncCall( + CreateReverseETLManualSyncInput createReverseETLManualSyncInput, + 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 = createReverseETLManualSyncInput; + + // create path and map variables + String localVarPath = "/reverse-etl-syncs"; + + 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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createReverseETLManualSyncValidateBeforeCall( + CreateReverseETLManualSyncInput createReverseETLManualSyncInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'createReverseETLManualSyncInput' is set + if (createReverseETLManualSyncInput == null) { + throw new ApiException( + "Missing the required parameter 'createReverseETLManualSyncInput' when calling" + + " createReverseETLManualSync(Async)"); + } + + return createReverseETLManualSyncCall(createReverseETLManualSyncInput, _callback); + } + + /** + * Create Reverse ETL Manual Sync Triggers a manual sync for a Reverse ETL Connection. In the + * request body, the `subscription id` is the id that follows after + * `/mappings/` portion in the URL of the sync. For example, the `subscription + * id` would be `2` for this sync: + * https://app.Segment.com/example-workspace/reverse-etl/destinations/example-destination/sources/example-source/instances/1/mappings/2/source-id/3/model-id/4/sync-details + * The rate limit for this endpoint is 20 requests per minute, which is lower than the default + * due to access pattern restrictions. Once reached, this endpoint will respond with the 429 + * HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param createReverseETLManualSyncInput (required) + * @return CreateReverseETLManualSync200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateReverseETLManualSync200Response createReverseETLManualSync( + CreateReverseETLManualSyncInput createReverseETLManualSyncInput) throws ApiException { + ApiResponse localVarResp = + createReverseETLManualSyncWithHttpInfo(createReverseETLManualSyncInput); + return localVarResp.getData(); + } + + /** + * Create Reverse ETL Manual Sync Triggers a manual sync for a Reverse ETL Connection. In the + * request body, the `subscription id` is the id that follows after + * `/mappings/` portion in the URL of the sync. For example, the `subscription + * id` would be `2` for this sync: + * https://app.Segment.com/example-workspace/reverse-etl/destinations/example-destination/sources/example-source/instances/1/mappings/2/source-id/3/model-id/4/sync-details + * The rate limit for this endpoint is 20 requests per minute, which is lower than the default + * due to access pattern restrictions. Once reached, this endpoint will respond with the 429 + * HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param createReverseETLManualSyncInput (required) + * @return ApiResponse<CreateReverseETLManualSync200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + createReverseETLManualSyncWithHttpInfo( + CreateReverseETLManualSyncInput createReverseETLManualSyncInput) + throws ApiException { + okhttp3.Call localVarCall = + createReverseETLManualSyncValidateBeforeCall(createReverseETLManualSyncInput, null); + Type localVarReturnType = + new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Reverse ETL Manual Sync (asynchronously) Triggers a manual sync for a Reverse ETL + * Connection. In the request body, the `subscription id` is the id that follows after + * `/mappings/` portion in the URL of the sync. For example, the `subscription + * id` would be `2` for this sync: + * https://app.Segment.com/example-workspace/reverse-etl/destinations/example-destination/sources/example-source/instances/1/mappings/2/source-id/3/model-id/4/sync-details + * The rate limit for this endpoint is 20 requests per minute, which is lower than the default + * due to access pattern restrictions. Once reached, this endpoint will respond with the 429 + * HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param createReverseETLManualSyncInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createReverseETLManualSyncAsync( + CreateReverseETLManualSyncInput createReverseETLManualSyncInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createReverseETLManualSyncValidateBeforeCall( + createReverseETLManualSyncInput, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createReverseEtlModel + * + * @param createReverseEtlModelInput (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 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createReverseEtlModelCall( + CreateReverseEtlModelInput createReverseEtlModelInput, 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 = createReverseEtlModelInput; + + // create path and map variables + String localVarPath = "/reverse-etl-models"; + + 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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createReverseEtlModelValidateBeforeCall( + CreateReverseEtlModelInput createReverseEtlModelInput, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'createReverseEtlModelInput' is set + if (createReverseEtlModelInput == null) { + throw new ApiException( + "Missing the required parameter 'createReverseEtlModelInput' when calling" + + " createReverseEtlModel(Async)"); + } + + return createReverseEtlModelCall(createReverseEtlModelInput, _callback); + } + + /** + * Create Reverse Etl Model Creates a new Reverse ETL Model. • When called, this endpoint may + * generate the `Model Created` event in the [audit trail](/tag/Audit-Trail). + * + * @param createReverseEtlModelInput (required) + * @return CreateReverseEtlModel201Response + * @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 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateReverseEtlModel201Response createReverseEtlModel( + CreateReverseEtlModelInput createReverseEtlModelInput) throws ApiException { + ApiResponse localVarResp = + createReverseEtlModelWithHttpInfo(createReverseEtlModelInput); + return localVarResp.getData(); + } + + /** + * Create Reverse Etl Model Creates a new Reverse ETL Model. • When called, this endpoint may + * generate the `Model Created` event in the [audit trail](/tag/Audit-Trail). + * + * @param createReverseEtlModelInput (required) + * @return ApiResponse<CreateReverseEtlModel201Response> + * @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 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse createReverseEtlModelWithHttpInfo( + CreateReverseEtlModelInput createReverseEtlModelInput) throws ApiException { + okhttp3.Call localVarCall = + createReverseEtlModelValidateBeforeCall(createReverseEtlModelInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Reverse Etl Model (asynchronously) Creates a new Reverse ETL Model. • When called, + * this endpoint may generate the `Model Created` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param createReverseEtlModelInput (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 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createReverseEtlModelAsync( + CreateReverseEtlModelInput createReverseEtlModelInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createReverseEtlModelValidateBeforeCall(createReverseEtlModelInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for deleteReverseEtlModel + * + * @param modelId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call deleteReverseEtlModelCall(String modelId, 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 = + "/reverse-etl-models/{modelId}" + .replace( + "{" + "modelId" + "}", + localVarApiClient.escapeString(modelId.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.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteReverseEtlModelValidateBeforeCall( + String modelId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'modelId' is set + if (modelId == null) { + throw new ApiException( + "Missing the required parameter 'modelId' when calling" + + " deleteReverseEtlModel(Async)"); + } + + return deleteReverseEtlModelCall(modelId, _callback); + } + + /** + * Delete Reverse Etl Model Deletes an existing Model. • When called, this endpoint may generate + * the `Model Deleted` event in the [audit trail](/tag/Audit-Trail). + * + * @param modelId (required) + * @return DeleteReverseEtlModel200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public DeleteReverseEtlModel200Response deleteReverseEtlModel(String modelId) + throws ApiException { + ApiResponse localVarResp = + deleteReverseEtlModelWithHttpInfo(modelId); + return localVarResp.getData(); + } + + /** + * Delete Reverse Etl Model Deletes an existing Model. • When called, this endpoint may generate + * the `Model Deleted` event in the [audit trail](/tag/Audit-Trail). + * + * @param modelId (required) + * @return ApiResponse<DeleteReverseEtlModel200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse deleteReverseEtlModelWithHttpInfo( + String modelId) throws ApiException { + okhttp3.Call localVarCall = deleteReverseEtlModelValidateBeforeCall(modelId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete Reverse Etl Model (asynchronously) Deletes an existing Model. • When called, this + * endpoint may generate the `Model Deleted` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param modelId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call deleteReverseEtlModelAsync( + String modelId, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = deleteReverseEtlModelValidateBeforeCall(modelId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getReverseETLSyncStatus + * + * @param modelId (required) + * @param syncId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getReverseETLSyncStatusCall( + String modelId, String syncId, 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 = + "/reverse-etl-models/{modelId}/syncs/{syncId}" + .replace( + "{" + "modelId" + "}", + localVarApiClient.escapeString(modelId.toString())) + .replace( + "{" + "syncId" + "}", + localVarApiClient.escapeString(syncId.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.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getReverseETLSyncStatusValidateBeforeCall( + String modelId, String syncId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'modelId' is set + if (modelId == null) { + throw new ApiException( + "Missing the required parameter 'modelId' when calling" + + " getReverseETLSyncStatus(Async)"); + } + + // verify the required parameter 'syncId' is set + if (syncId == null) { + throw new ApiException( + "Missing the required parameter 'syncId' when calling" + + " getReverseETLSyncStatus(Async)"); + } + + return getReverseETLSyncStatusCall(modelId, syncId, _callback); + } + + /** + * Get Reverse ETL Sync Status Get the sync status for a Reverse ETL sync. The sync status + * includes all detailed information about the sync - sync status, duration, details about the + * extract and load phase if applicable, etc. The rate limit for this endpoint is 250 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param modelId (required) + * @param syncId (required) + * @return GetReverseETLSyncStatus200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetReverseETLSyncStatus200Response getReverseETLSyncStatus(String modelId, String syncId) + throws ApiException { + ApiResponse localVarResp = + getReverseETLSyncStatusWithHttpInfo(modelId, syncId); + return localVarResp.getData(); + } + + /** + * Get Reverse ETL Sync Status Get the sync status for a Reverse ETL sync. The sync status + * includes all detailed information about the sync - sync status, duration, details about the + * extract and load phase if applicable, etc. The rate limit for this endpoint is 250 requests + * per minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param modelId (required) + * @param syncId (required) + * @return ApiResponse<GetReverseETLSyncStatus200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse getReverseETLSyncStatusWithHttpInfo( + String modelId, String syncId) throws ApiException { + okhttp3.Call localVarCall = + getReverseETLSyncStatusValidateBeforeCall(modelId, syncId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Reverse ETL Sync Status (asynchronously) Get the sync status for a Reverse ETL sync. The + * sync status includes all detailed information about the sync - sync status, duration, details + * about the extract and load phase if applicable, etc. The rate limit for this endpoint is 250 + * requests per minute, which is lower than the default due to access pattern restrictions. Once + * reached, this endpoint will respond with the 429 HTTP status code with headers indicating the + * limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param modelId (required) + * @param syncId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getReverseETLSyncStatusAsync( + String modelId, + String syncId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getReverseETLSyncStatusValidateBeforeCall(modelId, syncId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getReverseEtlModel + * + * @param modelId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getReverseEtlModelCall(String modelId, 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 = + "/reverse-etl-models/{modelId}" + .replace( + "{" + "modelId" + "}", + localVarApiClient.escapeString(modelId.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.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getReverseEtlModelValidateBeforeCall( + String modelId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'modelId' is set + if (modelId == null) { + throw new ApiException( + "Missing the required parameter 'modelId' when calling" + + " getReverseEtlModel(Async)"); + } + + return getReverseEtlModelCall(modelId, _callback); + } + + /** + * Get Reverse Etl Model Returns a Reverse ETL Model by its id. + * + * @param modelId (required) + * @return GetReverseEtlModel200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetReverseEtlModel200Response getReverseEtlModel(String modelId) throws ApiException { + ApiResponse localVarResp = + getReverseEtlModelWithHttpInfo(modelId); + return localVarResp.getData(); + } + + /** + * Get Reverse Etl Model Returns a Reverse ETL Model by its id. + * + * @param modelId (required) + * @return ApiResponse<GetReverseEtlModel200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse getReverseEtlModelWithHttpInfo(String modelId) + throws ApiException { + okhttp3.Call localVarCall = getReverseEtlModelValidateBeforeCall(modelId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Reverse Etl Model (asynchronously) Returns a Reverse ETL Model by its id. + * + * @param modelId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getReverseEtlModelAsync( + String modelId, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getReverseEtlModelValidateBeforeCall(modelId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listReverseETLSyncStatusesFromModelAndSubscriptionId + * + * @param modelId (required) + * @param subscriptionId (required) + * @param count The number of items to retrieve in a page, between 1 and 100. Default is 10 This + * parameter exists in alpha. (optional) + * @param cursor The page to request. Acceptable values to use are from the `current`, + * `next`, and `previous` keys. This parameter exists in alpha. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listReverseETLSyncStatusesFromModelAndSubscriptionIdCall( + String modelId, + String subscriptionId, + BigDecimal count, + String cursor, + 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 = + "/reverse-etl-models/{modelId}/subscriptionId/{subscriptionId}/syncs" + .replace( + "{" + "modelId" + "}", + localVarApiClient.escapeString(modelId.toString())) + .replace( + "{" + "subscriptionId" + "}", + localVarApiClient.escapeString(subscriptionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (count != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("count", count)); + } + + if (cursor != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("cursor", cursor)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listReverseETLSyncStatusesFromModelAndSubscriptionIdValidateBeforeCall( + String modelId, + String subscriptionId, + BigDecimal count, + String cursor, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'modelId' is set + if (modelId == null) { + throw new ApiException( + "Missing the required parameter 'modelId' when calling" + + " listReverseETLSyncStatusesFromModelAndSubscriptionId(Async)"); + } + + // verify the required parameter 'subscriptionId' is set + if (subscriptionId == null) { + throw new ApiException( + "Missing the required parameter 'subscriptionId' when calling" + + " listReverseETLSyncStatusesFromModelAndSubscriptionId(Async)"); + } + + return listReverseETLSyncStatusesFromModelAndSubscriptionIdCall( + modelId, subscriptionId, count, cursor, _callback); + } + + /** + * List Reverse ETL Sync Statuses from Model And Subscription Id Get the sync statuses for a + * Reverse ETL mapping subscription. The sync status includes all detailed information about the + * sync - sync status, duration, details about the extract and load phase if applicable, etc. + * The default page count is 10, and then the next page can be fetched by passing the + * `cursor` query parameter. + * + * @param modelId (required) + * @param subscriptionId (required) + * @param count The number of items to retrieve in a page, between 1 and 100. Default is 10 This + * parameter exists in alpha. (optional) + * @param cursor The page to request. Acceptable values to use are from the `current`, + * `next`, and `previous` keys. This parameter exists in alpha. + * (optional) + * @return ListReverseETLSyncStatusesFromModelAndSubscriptionId200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListReverseETLSyncStatusesFromModelAndSubscriptionId200Response + listReverseETLSyncStatusesFromModelAndSubscriptionId( + String modelId, String subscriptionId, BigDecimal count, String cursor) + throws ApiException { + ApiResponse localVarResp = + listReverseETLSyncStatusesFromModelAndSubscriptionIdWithHttpInfo( + modelId, subscriptionId, count, cursor); + return localVarResp.getData(); + } + + /** + * List Reverse ETL Sync Statuses from Model And Subscription Id Get the sync statuses for a + * Reverse ETL mapping subscription. The sync status includes all detailed information about the + * sync - sync status, duration, details about the extract and load phase if applicable, etc. + * The default page count is 10, and then the next page can be fetched by passing the + * `cursor` query parameter. + * + * @param modelId (required) + * @param subscriptionId (required) + * @param count The number of items to retrieve in a page, between 1 and 100. Default is 10 This + * parameter exists in alpha. (optional) + * @param cursor The page to request. Acceptable values to use are from the `current`, + * `next`, and `previous` keys. This parameter exists in alpha. + * (optional) + * @return ApiResponse<ListReverseETLSyncStatusesFromModelAndSubscriptionId200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse + listReverseETLSyncStatusesFromModelAndSubscriptionIdWithHttpInfo( + String modelId, String subscriptionId, BigDecimal count, String cursor) + throws ApiException { + okhttp3.Call localVarCall = + listReverseETLSyncStatusesFromModelAndSubscriptionIdValidateBeforeCall( + modelId, subscriptionId, count, cursor, null); + Type localVarReturnType = + new TypeToken< + ListReverseETLSyncStatusesFromModelAndSubscriptionId200Response>() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Reverse ETL Sync Statuses from Model And Subscription Id (asynchronously) Get the sync + * statuses for a Reverse ETL mapping subscription. The sync status includes all detailed + * information about the sync - sync status, duration, details about the extract and load phase + * if applicable, etc. The default page count is 10, and then the next page can be fetched by + * passing the `cursor` query parameter. + * + * @param modelId (required) + * @param subscriptionId (required) + * @param count The number of items to retrieve in a page, between 1 and 100. Default is 10 This + * parameter exists in alpha. (optional) + * @param cursor The page to request. Acceptable values to use are from the `current`, + * `next`, and `previous` keys. This parameter exists in alpha. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listReverseETLSyncStatusesFromModelAndSubscriptionIdAsync( + String modelId, + String subscriptionId, + BigDecimal count, + String cursor, + final ApiCallback + _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listReverseETLSyncStatusesFromModelAndSubscriptionIdValidateBeforeCall( + modelId, subscriptionId, count, cursor, _callback); + Type localVarReturnType = + new TypeToken< + ListReverseETLSyncStatusesFromModelAndSubscriptionId200Response>() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listReverseEtlModels + * + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listReverseEtlModelsCall( + PaginationInput pagination, 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 = "/reverse-etl-models"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listReverseEtlModelsValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return listReverseEtlModelsCall(pagination, _callback); + } + + /** + * List Reverse Etl Models Returns a list of Reverse ETL Models. + * + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (optional) + * @return ListReverseEtlModels200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListReverseEtlModels200Response listReverseEtlModels(PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listReverseEtlModelsWithHttpInfo(pagination); + return localVarResp.getData(); + } + + /** + * List Reverse Etl Models Returns a list of Reverse ETL Models. + * + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (optional) + * @return ApiResponse<ListReverseEtlModels200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse listReverseEtlModelsWithHttpInfo( + PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = listReverseEtlModelsValidateBeforeCall(pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Reverse Etl Models (asynchronously) Returns a list of Reverse ETL Models. + * + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listReverseEtlModelsAsync( + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = listReverseEtlModelsValidateBeforeCall(pagination, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateReverseEtlModel + * + * @param modelId (required) + * @param updateReverseEtlModelInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateReverseEtlModelCall( + String modelId, + UpdateReverseEtlModelInput updateReverseEtlModelInput, + 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 = updateReverseEtlModelInput; + + // create path and map variables + String localVarPath = + "/reverse-etl-models/{modelId}" + .replace( + "{" + "modelId" + "}", + localVarApiClient.escapeString(modelId.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.segment.v1alpha+json", "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateReverseEtlModelValidateBeforeCall( + String modelId, + UpdateReverseEtlModelInput updateReverseEtlModelInput, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'modelId' is set + if (modelId == null) { + throw new ApiException( + "Missing the required parameter 'modelId' when calling" + + " updateReverseEtlModel(Async)"); + } + + // verify the required parameter 'updateReverseEtlModelInput' is set + if (updateReverseEtlModelInput == null) { + throw new ApiException( + "Missing the required parameter 'updateReverseEtlModelInput' when calling" + + " updateReverseEtlModel(Async)"); + } + + return updateReverseEtlModelCall(modelId, updateReverseEtlModelInput, _callback); + } + + /** + * Update Reverse Etl Model Updates an existing Reverse ETL Model. • When called, this endpoint + * may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Model + * Settings Saved * Model State Change Toggled + * + * @param modelId (required) + * @param updateReverseEtlModelInput (required) + * @return UpdateReverseEtlModel200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public UpdateReverseEtlModel200Response updateReverseEtlModel( + String modelId, UpdateReverseEtlModelInput updateReverseEtlModelInput) + throws ApiException { + ApiResponse localVarResp = + updateReverseEtlModelWithHttpInfo(modelId, updateReverseEtlModelInput); + return localVarResp.getData(); + } + + /** + * Update Reverse Etl Model Updates an existing Reverse ETL Model. • When called, this endpoint + * may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Model + * Settings Saved * Model State Change Toggled + * + * @param modelId (required) + * @param updateReverseEtlModelInput (required) + * @return ApiResponse<UpdateReverseEtlModel200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse updateReverseEtlModelWithHttpInfo( + String modelId, UpdateReverseEtlModelInput updateReverseEtlModelInput) + throws ApiException { + okhttp3.Call localVarCall = + updateReverseEtlModelValidateBeforeCall(modelId, updateReverseEtlModelInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Reverse Etl Model (asynchronously) Updates an existing Reverse ETL Model. • When + * called, this endpoint may generate one or more of the following [audit + * trail](/tag/Audit-Trail) events:* Model Settings Saved * Model State Change Toggled + * + * @param modelId (required) + * @param updateReverseEtlModelInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateReverseEtlModelAsync( + String modelId, + UpdateReverseEtlModelInput updateReverseEtlModelInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateReverseEtlModelValidateBeforeCall( + modelId, updateReverseEtlModelInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/segment/publicapi/api/SelectiveSyncApi.java b/src/main/java/com/segment/publicapi/api/SelectiveSyncApi.java index 2bde3039..8a6aef0c 100644 --- a/src/main/java/com/segment/publicapi/api/SelectiveSyncApi.java +++ b/src/main/java/com/segment/publicapi/api/SelectiveSyncApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,23 +9,15 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.GetAdvancedSyncScheduleFromWarehouse200Response; import com.segment.publicapi.models.ListSelectiveSyncsFromWarehouseAndSource200Response; import com.segment.publicapi.models.ListSyncsFromWarehouse200Response; @@ -34,16 +25,13 @@ import com.segment.publicapi.models.PaginationInput; import com.segment.publicapi.models.ReplaceAdvancedSyncScheduleForWarehouse200Response; import com.segment.publicapi.models.ReplaceAdvancedSyncScheduleForWarehouseV1Input; -import com.segment.publicapi.models.RequestErrorEnvelope; import com.segment.publicapi.models.UpdateSelectiveSyncForWarehouse200Response; import com.segment.publicapi.models.UpdateSelectiveSyncForWarehouseV1Input; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class SelectiveSyncApi { private ApiClient localVarApiClient; @@ -84,28 +72,30 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getAdvancedSyncScheduleFromWarehouse - * @param warehouseId (required) + * + * @param warehouseId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getAdvancedSyncScheduleFromWarehouseCall(String warehouseId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getAdvancedSyncScheduleFromWarehouseCall( + String warehouseId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -114,8 +104,11 @@ public okhttp3.Call getAdvancedSyncScheduleFromWarehouseCall(String warehouseId, Object localVarPostBody = null; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}/advanced-sync-schedule" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())); + String localVarPath = + "/warehouses/{warehouseId}/advanced-sync-schedule" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -124,129 +117,174 @@ public okhttp3.Call getAdvancedSyncScheduleFromWarehouseCall(String warehouseId, Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getAdvancedSyncScheduleFromWarehouseValidateBeforeCall(String warehouseId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getAdvancedSyncScheduleFromWarehouseValidateBeforeCall( + String warehouseId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling getAdvancedSyncScheduleFromWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " getAdvancedSyncScheduleFromWarehouse(Async)"); } - - - okhttp3.Call localVarCall = getAdvancedSyncScheduleFromWarehouseCall(warehouseId, _callback); - return localVarCall; + return getAdvancedSyncScheduleFromWarehouseCall(warehouseId, _callback); } /** - * Get Advanced Sync Schedule from Warehouse - * Returns the advanced sync schedule for a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) + * Get Advanced Sync Schedule from Warehouse Returns the advanced sync schedule for a Warehouse. + * The rate limit for this endpoint is 2 requests per minute, which is lower than the default + * due to access pattern restrictions. Once reached, this endpoint will respond with the 429 + * HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) * @return GetAdvancedSyncScheduleFromWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetAdvancedSyncScheduleFromWarehouse200Response getAdvancedSyncScheduleFromWarehouse(String warehouseId) throws ApiException { - ApiResponse localVarResp = getAdvancedSyncScheduleFromWarehouseWithHttpInfo(warehouseId); + public GetAdvancedSyncScheduleFromWarehouse200Response getAdvancedSyncScheduleFromWarehouse( + String warehouseId) throws ApiException { + ApiResponse localVarResp = + getAdvancedSyncScheduleFromWarehouseWithHttpInfo(warehouseId); return localVarResp.getData(); } /** - * Get Advanced Sync Schedule from Warehouse - * Returns the advanced sync schedule for a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) + * Get Advanced Sync Schedule from Warehouse Returns the advanced sync schedule for a Warehouse. + * The rate limit for this endpoint is 2 requests per minute, which is lower than the default + * due to access pattern restrictions. Once reached, this endpoint will respond with the 429 + * HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) * @return ApiResponse<GetAdvancedSyncScheduleFromWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getAdvancedSyncScheduleFromWarehouseWithHttpInfo(String warehouseId) throws ApiException { - okhttp3.Call localVarCall = getAdvancedSyncScheduleFromWarehouseValidateBeforeCall(warehouseId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + getAdvancedSyncScheduleFromWarehouseWithHttpInfo(String warehouseId) + throws ApiException { + okhttp3.Call localVarCall = + getAdvancedSyncScheduleFromWarehouseValidateBeforeCall(warehouseId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Advanced Sync Schedule from Warehouse (asynchronously) - * Returns the advanced sync schedule for a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) + * Get Advanced Sync Schedule from Warehouse (asynchronously) Returns the advanced sync schedule + * for a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower + * than the default due to access pattern restrictions. Once reached, this endpoint will respond + * with the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getAdvancedSyncScheduleFromWarehouseAsync(String warehouseId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getAdvancedSyncScheduleFromWarehouseValidateBeforeCall(warehouseId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getAdvancedSyncScheduleFromWarehouseAsync( + String warehouseId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getAdvancedSyncScheduleFromWarehouseValidateBeforeCall(warehouseId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listSelectiveSyncsFromWarehouseAndSource - * @param warehouseId (required) - * @param sourceId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * + * @param warehouseId (required) + * @param sourceId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSelectiveSyncsFromWarehouseAndSourceCall(String warehouseId, String sourceId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listSelectiveSyncsFromWarehouseAndSourceCall( + String warehouseId, + String sourceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -255,9 +293,14 @@ public okhttp3.Call listSelectiveSyncsFromWarehouseAndSourceCall(String warehous Object localVarPostBody = null; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}/connected-sources/{sourceId}/selective-syncs" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())) - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/warehouses/{warehouseId}/connected-sources/{sourceId}/selective-syncs" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())) + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -270,144 +313,196 @@ public okhttp3.Call listSelectiveSyncsFromWarehouseAndSourceCall(String warehous } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listSelectiveSyncsFromWarehouseAndSourceValidateBeforeCall(String warehouseId, String sourceId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listSelectiveSyncsFromWarehouseAndSourceValidateBeforeCall( + String warehouseId, + String sourceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling listSelectiveSyncsFromWarehouseAndSource(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " listSelectiveSyncsFromWarehouseAndSource(Async)"); } - + // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling listSelectiveSyncsFromWarehouseAndSource(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listSelectiveSyncsFromWarehouseAndSource(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " listSelectiveSyncsFromWarehouseAndSource(Async)"); } - - - okhttp3.Call localVarCall = listSelectiveSyncsFromWarehouseAndSourceCall(warehouseId, sourceId, pagination, _callback); - return localVarCall; + return listSelectiveSyncsFromWarehouseAndSourceCall( + warehouseId, sourceId, pagination, _callback); } /** - * List Selective Syncs from Warehouse And Source - * Returns the schema for a Warehouse, including Sources, Collections, and Properties. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param sourceId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Selective Syncs from Warehouse And Source Returns the schema for a Warehouse, including + * Sources, Collections, and Properties. The rate limit for this endpoint is 2 requests per + * minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) + * @param sourceId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ListSelectiveSyncsFromWarehouseAndSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListSelectiveSyncsFromWarehouseAndSource200Response listSelectiveSyncsFromWarehouseAndSource(String warehouseId, String sourceId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listSelectiveSyncsFromWarehouseAndSourceWithHttpInfo(warehouseId, sourceId, pagination); + public ListSelectiveSyncsFromWarehouseAndSource200Response + listSelectiveSyncsFromWarehouseAndSource( + String warehouseId, String sourceId, PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listSelectiveSyncsFromWarehouseAndSourceWithHttpInfo( + warehouseId, sourceId, pagination); return localVarResp.getData(); } /** - * List Selective Syncs from Warehouse And Source - * Returns the schema for a Warehouse, including Sources, Collections, and Properties. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param sourceId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Selective Syncs from Warehouse And Source Returns the schema for a Warehouse, including + * Sources, Collections, and Properties. The rate limit for this endpoint is 2 requests per + * minute, which is lower than the default due to access pattern restrictions. Once reached, + * this endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) + * @param sourceId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ApiResponse<ListSelectiveSyncsFromWarehouseAndSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listSelectiveSyncsFromWarehouseAndSourceWithHttpInfo(String warehouseId, String sourceId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listSelectiveSyncsFromWarehouseAndSourceValidateBeforeCall(warehouseId, sourceId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + listSelectiveSyncsFromWarehouseAndSourceWithHttpInfo( + String warehouseId, String sourceId, PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + listSelectiveSyncsFromWarehouseAndSourceValidateBeforeCall( + warehouseId, sourceId, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Selective Syncs from Warehouse And Source (asynchronously) - * Returns the schema for a Warehouse, including Sources, Collections, and Properties. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param sourceId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Selective Syncs from Warehouse And Source (asynchronously) Returns the schema for a + * Warehouse, including Sources, Collections, and Properties. The rate limit for this endpoint + * is 2 requests per minute, which is lower than the default due to access pattern restrictions. + * Once reached, this endpoint will respond with the 429 HTTP status code with headers + * indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) + * @param sourceId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSelectiveSyncsFromWarehouseAndSourceAsync(String warehouseId, String sourceId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listSelectiveSyncsFromWarehouseAndSourceValidateBeforeCall(warehouseId, sourceId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listSelectiveSyncsFromWarehouseAndSourceAsync( + String warehouseId, + String sourceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSelectiveSyncsFromWarehouseAndSourceValidateBeforeCall( + warehouseId, sourceId, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listSyncsFromWarehouse - * @param warehouseId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * + * @param warehouseId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSyncsFromWarehouseCall(String warehouseId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listSyncsFromWarehouseCall( + String warehouseId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -416,8 +511,11 @@ public okhttp3.Call listSyncsFromWarehouseCall(String warehouseId, PaginationInp Object localVarPostBody = null; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}/syncs" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())); + String localVarPath = + "/warehouses/{warehouseId}/syncs" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -430,137 +528,176 @@ public okhttp3.Call listSyncsFromWarehouseCall(String warehouseId, PaginationInp } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listSyncsFromWarehouseValidateBeforeCall(String warehouseId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listSyncsFromWarehouseValidateBeforeCall( + String warehouseId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling listSyncsFromWarehouse(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listSyncsFromWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " listSyncsFromWarehouse(Async)"); } - - - okhttp3.Call localVarCall = listSyncsFromWarehouseCall(warehouseId, pagination, _callback); - return localVarCall; + return listSyncsFromWarehouseCall(warehouseId, pagination, _callback); } /** - * List Syncs from Warehouse - * Returns the overview of syncs for every Source connected to a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Syncs from Warehouse Returns the overview of syncs for every Source connected to a + * Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the + * default due to access pattern restrictions. Once reached, this endpoint will respond with the + * 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ListSyncsFromWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListSyncsFromWarehouse200Response listSyncsFromWarehouse(String warehouseId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listSyncsFromWarehouseWithHttpInfo(warehouseId, pagination); + public ListSyncsFromWarehouse200Response listSyncsFromWarehouse( + String warehouseId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listSyncsFromWarehouseWithHttpInfo(warehouseId, pagination); return localVarResp.getData(); } /** - * List Syncs from Warehouse - * Returns the overview of syncs for every Source connected to a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Syncs from Warehouse Returns the overview of syncs for every Source connected to a + * Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the + * default due to access pattern restrictions. Once reached, this endpoint will respond with the + * 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ApiResponse<ListSyncsFromWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listSyncsFromWarehouseWithHttpInfo(String warehouseId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listSyncsFromWarehouseValidateBeforeCall(warehouseId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse listSyncsFromWarehouseWithHttpInfo( + String warehouseId, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + listSyncsFromWarehouseValidateBeforeCall(warehouseId, pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Syncs from Warehouse (asynchronously) - * Returns the overview of syncs for every Source connected to a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Syncs from Warehouse (asynchronously) Returns the overview of syncs for every Source + * connected to a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is + * lower than the default due to access pattern restrictions. Once reached, this endpoint will + * respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSyncsFromWarehouseAsync(String warehouseId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listSyncsFromWarehouseValidateBeforeCall(warehouseId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listSyncsFromWarehouseAsync( + String warehouseId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSyncsFromWarehouseValidateBeforeCall(warehouseId, pagination, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listSyncsFromWarehouseAndSource - * @param warehouseId (required) - * @param sourceId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * + * @param warehouseId (required) + * @param sourceId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSyncsFromWarehouseAndSourceCall(String warehouseId, String sourceId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listSyncsFromWarehouseAndSourceCall( + String warehouseId, + String sourceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -569,9 +706,14 @@ public okhttp3.Call listSyncsFromWarehouseAndSourceCall(String warehouseId, Stri Object localVarPostBody = null; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}/connected-sources/{sourceId}/syncs" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())) - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/warehouses/{warehouseId}/connected-sources/{sourceId}/syncs" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())) + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -584,144 +726,195 @@ public okhttp3.Call listSyncsFromWarehouseAndSourceCall(String warehouseId, Stri } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listSyncsFromWarehouseAndSourceValidateBeforeCall(String warehouseId, String sourceId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listSyncsFromWarehouseAndSourceValidateBeforeCall( + String warehouseId, + String sourceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling listSyncsFromWarehouseAndSource(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " listSyncsFromWarehouseAndSource(Async)"); } - + // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling listSyncsFromWarehouseAndSource(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " listSyncsFromWarehouseAndSource(Async)"); } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listSyncsFromWarehouseAndSource(Async)"); - } - - - okhttp3.Call localVarCall = listSyncsFromWarehouseAndSourceCall(warehouseId, sourceId, pagination, _callback); - return localVarCall; + return listSyncsFromWarehouseAndSourceCall(warehouseId, sourceId, pagination, _callback); } /** - * List Syncs from Warehouse And Source - * Returns the overview of syncs for a Source connected to a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param sourceId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Syncs from Warehouse And Source Returns the overview of syncs for a Source connected to + * a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) + * @param sourceId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ListSyncsFromWarehouseAndSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListSyncsFromWarehouseAndSource200Response listSyncsFromWarehouseAndSource(String warehouseId, String sourceId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listSyncsFromWarehouseAndSourceWithHttpInfo(warehouseId, sourceId, pagination); + public ListSyncsFromWarehouseAndSource200Response listSyncsFromWarehouseAndSource( + String warehouseId, String sourceId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listSyncsFromWarehouseAndSourceWithHttpInfo(warehouseId, sourceId, pagination); return localVarResp.getData(); } /** - * List Syncs from Warehouse And Source - * Returns the overview of syncs for a Source connected to a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param sourceId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Syncs from Warehouse And Source Returns the overview of syncs for a Source connected to + * a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than + * the default due to access pattern restrictions. Once reached, this endpoint will respond with + * the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) + * @param sourceId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ApiResponse<ListSyncsFromWarehouseAndSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listSyncsFromWarehouseAndSourceWithHttpInfo(String warehouseId, String sourceId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listSyncsFromWarehouseAndSourceValidateBeforeCall(warehouseId, sourceId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + listSyncsFromWarehouseAndSourceWithHttpInfo( + String warehouseId, String sourceId, PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = + listSyncsFromWarehouseAndSourceValidateBeforeCall( + warehouseId, sourceId, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Syncs from Warehouse And Source (asynchronously) - * Returns the overview of syncs for a Source connected to a Warehouse. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param sourceId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Syncs from Warehouse And Source (asynchronously) Returns the overview of syncs for a + * Source connected to a Warehouse. The rate limit for this endpoint is 2 requests per minute, + * which is lower than the default due to access pattern restrictions. Once reached, this + * endpoint will respond with the 429 HTTP status code with headers indicating the limit + * parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) + * @param sourceId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSyncsFromWarehouseAndSourceAsync(String warehouseId, String sourceId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listSyncsFromWarehouseAndSourceValidateBeforeCall(warehouseId, sourceId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listSyncsFromWarehouseAndSourceAsync( + String warehouseId, + String sourceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSyncsFromWarehouseAndSourceValidateBeforeCall( + warehouseId, sourceId, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for replaceAdvancedSyncScheduleForWarehouse - * @param warehouseId (required) - * @param replaceAdvancedSyncScheduleForWarehouseV1Input (required) + * + * @param warehouseId (required) + * @param replaceAdvancedSyncScheduleForWarehouseV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replaceAdvancedSyncScheduleForWarehouseCall(String warehouseId, ReplaceAdvancedSyncScheduleForWarehouseV1Input replaceAdvancedSyncScheduleForWarehouseV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call replaceAdvancedSyncScheduleForWarehouseCall( + String warehouseId, + ReplaceAdvancedSyncScheduleForWarehouseV1Input + replaceAdvancedSyncScheduleForWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -730,8 +923,11 @@ public okhttp3.Call replaceAdvancedSyncScheduleForWarehouseCall(String warehouse Object localVarPostBody = replaceAdvancedSyncScheduleForWarehouseV1Input; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}/advanced-sync-schedule" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())); + String localVarPath = + "/warehouses/{warehouseId}/advanced-sync-schedule" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -740,7 +936,10 @@ public okhttp3.Call replaceAdvancedSyncScheduleForWarehouseCall(String warehouse Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -748,128 +947,195 @@ public okhttp3.Call replaceAdvancedSyncScheduleForWarehouseCall(String warehouse } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replaceAdvancedSyncScheduleForWarehouseValidateBeforeCall(String warehouseId, ReplaceAdvancedSyncScheduleForWarehouseV1Input replaceAdvancedSyncScheduleForWarehouseV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call replaceAdvancedSyncScheduleForWarehouseValidateBeforeCall( + String warehouseId, + ReplaceAdvancedSyncScheduleForWarehouseV1Input + replaceAdvancedSyncScheduleForWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling replaceAdvancedSyncScheduleForWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " replaceAdvancedSyncScheduleForWarehouse(Async)"); } - + // verify the required parameter 'replaceAdvancedSyncScheduleForWarehouseV1Input' is set if (replaceAdvancedSyncScheduleForWarehouseV1Input == null) { - throw new ApiException("Missing the required parameter 'replaceAdvancedSyncScheduleForWarehouseV1Input' when calling replaceAdvancedSyncScheduleForWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter" + + " 'replaceAdvancedSyncScheduleForWarehouseV1Input' when calling" + + " replaceAdvancedSyncScheduleForWarehouse(Async)"); } - - - okhttp3.Call localVarCall = replaceAdvancedSyncScheduleForWarehouseCall(warehouseId, replaceAdvancedSyncScheduleForWarehouseV1Input, _callback); - return localVarCall; + return replaceAdvancedSyncScheduleForWarehouseCall( + warehouseId, replaceAdvancedSyncScheduleForWarehouseV1Input, _callback); } /** - * Replace Advanced Sync Schedule for Warehouse - * Updates the advanced sync schedule for a Warehouse, replacing the sync schedule with a new schedule. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param replaceAdvancedSyncScheduleForWarehouseV1Input (required) + * Replace Advanced Sync Schedule for Warehouse Updates the advanced sync schedule for a + * Warehouse, replacing the sync schedule with a new schedule. The rate limit for this endpoint + * is 2 requests per minute, which is lower than the default due to access pattern restrictions. + * Once reached, this endpoint will respond with the 429 HTTP status code with headers + * indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) + * @param replaceAdvancedSyncScheduleForWarehouseV1Input (required) * @return ReplaceAdvancedSyncScheduleForWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ReplaceAdvancedSyncScheduleForWarehouse200Response replaceAdvancedSyncScheduleForWarehouse(String warehouseId, ReplaceAdvancedSyncScheduleForWarehouseV1Input replaceAdvancedSyncScheduleForWarehouseV1Input) throws ApiException { - ApiResponse localVarResp = replaceAdvancedSyncScheduleForWarehouseWithHttpInfo(warehouseId, replaceAdvancedSyncScheduleForWarehouseV1Input); + public ReplaceAdvancedSyncScheduleForWarehouse200Response + replaceAdvancedSyncScheduleForWarehouse( + String warehouseId, + ReplaceAdvancedSyncScheduleForWarehouseV1Input + replaceAdvancedSyncScheduleForWarehouseV1Input) + throws ApiException { + ApiResponse localVarResp = + replaceAdvancedSyncScheduleForWarehouseWithHttpInfo( + warehouseId, replaceAdvancedSyncScheduleForWarehouseV1Input); return localVarResp.getData(); } /** - * Replace Advanced Sync Schedule for Warehouse - * Updates the advanced sync schedule for a Warehouse, replacing the sync schedule with a new schedule. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param replaceAdvancedSyncScheduleForWarehouseV1Input (required) + * Replace Advanced Sync Schedule for Warehouse Updates the advanced sync schedule for a + * Warehouse, replacing the sync schedule with a new schedule. The rate limit for this endpoint + * is 2 requests per minute, which is lower than the default due to access pattern restrictions. + * Once reached, this endpoint will respond with the 429 HTTP status code with headers + * indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) + * @param replaceAdvancedSyncScheduleForWarehouseV1Input (required) * @return ApiResponse<ReplaceAdvancedSyncScheduleForWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse replaceAdvancedSyncScheduleForWarehouseWithHttpInfo(String warehouseId, ReplaceAdvancedSyncScheduleForWarehouseV1Input replaceAdvancedSyncScheduleForWarehouseV1Input) throws ApiException { - okhttp3.Call localVarCall = replaceAdvancedSyncScheduleForWarehouseValidateBeforeCall(warehouseId, replaceAdvancedSyncScheduleForWarehouseV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + replaceAdvancedSyncScheduleForWarehouseWithHttpInfo( + String warehouseId, + ReplaceAdvancedSyncScheduleForWarehouseV1Input + replaceAdvancedSyncScheduleForWarehouseV1Input) + throws ApiException { + okhttp3.Call localVarCall = + replaceAdvancedSyncScheduleForWarehouseValidateBeforeCall( + warehouseId, replaceAdvancedSyncScheduleForWarehouseV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace Advanced Sync Schedule for Warehouse (asynchronously) - * Updates the advanced sync schedule for a Warehouse, replacing the sync schedule with a new schedule. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param replaceAdvancedSyncScheduleForWarehouseV1Input (required) + * Replace Advanced Sync Schedule for Warehouse (asynchronously) Updates the advanced sync + * schedule for a Warehouse, replacing the sync schedule with a new schedule. The rate limit for + * this endpoint is 2 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param warehouseId (required) + * @param replaceAdvancedSyncScheduleForWarehouseV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replaceAdvancedSyncScheduleForWarehouseAsync(String warehouseId, ReplaceAdvancedSyncScheduleForWarehouseV1Input replaceAdvancedSyncScheduleForWarehouseV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = replaceAdvancedSyncScheduleForWarehouseValidateBeforeCall(warehouseId, replaceAdvancedSyncScheduleForWarehouseV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call replaceAdvancedSyncScheduleForWarehouseAsync( + String warehouseId, + ReplaceAdvancedSyncScheduleForWarehouseV1Input + replaceAdvancedSyncScheduleForWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + replaceAdvancedSyncScheduleForWarehouseValidateBeforeCall( + warehouseId, replaceAdvancedSyncScheduleForWarehouseV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for updateSelectiveSyncForWarehouse - * @param warehouseId (required) - * @param updateSelectiveSyncForWarehouseV1Input (required) + * + * @param warehouseId (required) + * @param updateSelectiveSyncForWarehouseV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateSelectiveSyncForWarehouseCall(String warehouseId, UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call updateSelectiveSyncForWarehouseCall( + String warehouseId, + UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -878,8 +1144,11 @@ public okhttp3.Call updateSelectiveSyncForWarehouseCall(String warehouseId, Upda Object localVarPostBody = updateSelectiveSyncForWarehouseV1Input; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}/selective-sync" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())); + String localVarPath = + "/warehouses/{warehouseId}/selective-sync" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -888,7 +1157,10 @@ public okhttp3.Call updateSelectiveSyncForWarehouseCall(String warehouseId, Upda Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -896,100 +1168,160 @@ public okhttp3.Call updateSelectiveSyncForWarehouseCall(String warehouseId, Upda } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateSelectiveSyncForWarehouseValidateBeforeCall(String warehouseId, UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call updateSelectiveSyncForWarehouseValidateBeforeCall( + String warehouseId, + UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling updateSelectiveSyncForWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " updateSelectiveSyncForWarehouse(Async)"); } - + // verify the required parameter 'updateSelectiveSyncForWarehouseV1Input' is set if (updateSelectiveSyncForWarehouseV1Input == null) { - throw new ApiException("Missing the required parameter 'updateSelectiveSyncForWarehouseV1Input' when calling updateSelectiveSyncForWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'updateSelectiveSyncForWarehouseV1Input' when" + + " calling updateSelectiveSyncForWarehouse(Async)"); } - - - okhttp3.Call localVarCall = updateSelectiveSyncForWarehouseCall(warehouseId, updateSelectiveSyncForWarehouseV1Input, _callback); - return localVarCall; + return updateSelectiveSyncForWarehouseCall( + warehouseId, updateSelectiveSyncForWarehouseV1Input, _callback); } /** - * Update Selective Sync for Warehouse - * Configures the schema for a Warehouse, including Sources, Collections, and Properties. When called, this endpoint may generate the `Storage Destination Modified` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param updateSelectiveSyncForWarehouseV1Input (required) + * Update Selective Sync for Warehouse Configures the schema for a Warehouse, including Sources, + * Collections, and Properties. • When called, this endpoint may generate the `Storage + * Destination Modified` event in the [audit trail](/tag/Audit-Trail). The rate limit for + * this endpoint is 2 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param warehouseId (required) + * @param updateSelectiveSyncForWarehouseV1Input (required) * @return UpdateSelectiveSyncForWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public UpdateSelectiveSyncForWarehouse200Response updateSelectiveSyncForWarehouse(String warehouseId, UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input) throws ApiException { - ApiResponse localVarResp = updateSelectiveSyncForWarehouseWithHttpInfo(warehouseId, updateSelectiveSyncForWarehouseV1Input); + public UpdateSelectiveSyncForWarehouse200Response updateSelectiveSyncForWarehouse( + String warehouseId, + UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input) + throws ApiException { + ApiResponse localVarResp = + updateSelectiveSyncForWarehouseWithHttpInfo( + warehouseId, updateSelectiveSyncForWarehouseV1Input); return localVarResp.getData(); } /** - * Update Selective Sync for Warehouse - * Configures the schema for a Warehouse, including Sources, Collections, and Properties. When called, this endpoint may generate the `Storage Destination Modified` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param updateSelectiveSyncForWarehouseV1Input (required) + * Update Selective Sync for Warehouse Configures the schema for a Warehouse, including Sources, + * Collections, and Properties. • When called, this endpoint may generate the `Storage + * Destination Modified` event in the [audit trail](/tag/Audit-Trail). The rate limit for + * this endpoint is 2 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param warehouseId (required) + * @param updateSelectiveSyncForWarehouseV1Input (required) * @return ApiResponse<UpdateSelectiveSyncForWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse updateSelectiveSyncForWarehouseWithHttpInfo(String warehouseId, UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input) throws ApiException { - okhttp3.Call localVarCall = updateSelectiveSyncForWarehouseValidateBeforeCall(warehouseId, updateSelectiveSyncForWarehouseV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + updateSelectiveSyncForWarehouseWithHttpInfo( + String warehouseId, + UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input) + throws ApiException { + okhttp3.Call localVarCall = + updateSelectiveSyncForWarehouseValidateBeforeCall( + warehouseId, updateSelectiveSyncForWarehouseV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Selective Sync for Warehouse (asynchronously) - * Configures the schema for a Warehouse, including Sources, Collections, and Properties. When called, this endpoint may generate the `Storage Destination Modified` [Audit Trail](/tag/Audit-Trail) event. The rate limit for this endpoint is 2 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) - * @param updateSelectiveSyncForWarehouseV1Input (required) + * Update Selective Sync for Warehouse (asynchronously) Configures the schema for a Warehouse, + * including Sources, Collections, and Properties. • When called, this endpoint may generate the + * `Storage Destination Modified` event in the [audit trail](/tag/Audit-Trail). The + * rate limit for this endpoint is 2 requests per minute, which is lower than the default due to + * access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) + * @param updateSelectiveSyncForWarehouseV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateSelectiveSyncForWarehouseAsync(String warehouseId, UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateSelectiveSyncForWarehouseValidateBeforeCall(warehouseId, updateSelectiveSyncForWarehouseV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call updateSelectiveSyncForWarehouseAsync( + String warehouseId, + UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateSelectiveSyncForWarehouseValidateBeforeCall( + warehouseId, updateSelectiveSyncForWarehouseV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/SourcesApi.java b/src/main/java/com/segment/publicapi/api/SourcesApi.java index 3d2e3ce9..b69f3d3e 100644 --- a/src/main/java/com/segment/publicapi/api/SourcesApi.java +++ b/src/main/java/com/segment/publicapi/api/SourcesApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,61 +9,39 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.AddLabelsToSource200Response; -import com.segment.publicapi.models.AddLabelsToSource200Response1; -import com.segment.publicapi.models.AddLabelsToSourceAlphaInput; import com.segment.publicapi.models.AddLabelsToSourceV1Input; -import com.segment.publicapi.models.CreateSource200Response; -import com.segment.publicapi.models.CreateSource200Response1; -import com.segment.publicapi.models.CreateSourceAlphaInput; +import com.segment.publicapi.models.CreateSource201Response; import com.segment.publicapi.models.CreateSourceV1Input; +import com.segment.publicapi.models.CreateWriteKeyForSource200Response; import com.segment.publicapi.models.DeleteSource200Response; -import com.segment.publicapi.models.DeleteSource200Response1; import com.segment.publicapi.models.GetSource200Response; -import com.segment.publicapi.models.GetSource200Response1; import com.segment.publicapi.models.ListConnectedDestinationsFromSource200Response; -import com.segment.publicapi.models.ListConnectedDestinationsFromSource200Response1; import com.segment.publicapi.models.ListConnectedWarehousesFromSource200Response; -import com.segment.publicapi.models.ListConnectedWarehousesFromSource200Response1; import com.segment.publicapi.models.ListSchemaSettingsInSource200Response; import com.segment.publicapi.models.ListSources200Response; -import com.segment.publicapi.models.ListSources200Response1; import com.segment.publicapi.models.PaginationInput; +import com.segment.publicapi.models.RemoveWriteKeyFromSource200Response; import com.segment.publicapi.models.ReplaceLabelsInSource200Response; -import com.segment.publicapi.models.ReplaceLabelsInSource200Response1; -import com.segment.publicapi.models.ReplaceLabelsInSourceAlphaInput; import com.segment.publicapi.models.ReplaceLabelsInSourceV1Input; -import com.segment.publicapi.models.RequestErrorEnvelope; import com.segment.publicapi.models.UpdateSchemaSettingsInSource200Response; import com.segment.publicapi.models.UpdateSchemaSettingsInSourceV1Input; import com.segment.publicapi.models.UpdateSource200Response; -import com.segment.publicapi.models.UpdateSource200Response1; -import com.segment.publicapi.models.UpdateSourceAlphaInput; import com.segment.publicapi.models.UpdateSourceV1Input; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class SourcesApi { private ApiClient localVarApiClient; @@ -105,39 +82,47 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for addLabelsToSource - * @param sourceId (required) - * @param addLabelsToSourceAlphaInput (required) + * + * @param sourceId (required) + * @param addLabelsToSourceV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call addLabelsToSourceCall(String sourceId, AddLabelsToSourceAlphaInput addLabelsToSourceAlphaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call addLabelsToSourceCall( + String sourceId, + AddLabelsToSourceV1Input addLabelsToSourceV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } - Object localVarPostBody = addLabelsToSourceAlphaInput; + Object localVarPostBody = addLabelsToSourceV1Input; // create path and map variables - String localVarPath = "/sources/{sourceId}/labels" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}/labels" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -146,7 +131,10 @@ public okhttp3.Call addLabelsToSourceCall(String sourceId, AddLabelsToSourceAlph Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -154,133 +142,174 @@ public okhttp3.Call addLabelsToSourceCall(String sourceId, AddLabelsToSourceAlph } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call addLabelsToSourceValidateBeforeCall(String sourceId, AddLabelsToSourceAlphaInput addLabelsToSourceAlphaInput, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call addLabelsToSourceValidateBeforeCall( + String sourceId, + AddLabelsToSourceV1Input addLabelsToSourceV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling addLabelsToSource(Async)"); - } - - // verify the required parameter 'addLabelsToSourceAlphaInput' is set - if (addLabelsToSourceAlphaInput == null) { - throw new ApiException("Missing the required parameter 'addLabelsToSourceAlphaInput' when calling addLabelsToSource(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " addLabelsToSource(Async)"); } - - okhttp3.Call localVarCall = addLabelsToSourceCall(sourceId, addLabelsToSourceAlphaInput, _callback); - return localVarCall; + // verify the required parameter 'addLabelsToSourceV1Input' is set + if (addLabelsToSourceV1Input == null) { + throw new ApiException( + "Missing the required parameter 'addLabelsToSourceV1Input' when calling" + + " addLabelsToSource(Async)"); + } + return addLabelsToSourceCall(sourceId, addLabelsToSourceV1Input, _callback); } /** - * Add Labels to Source - * Adds an existing label to a Source. When called, this endpoint may generate the `Source Modified` [Audit Trail](/tag/Audit-Trail) event. - * @param sourceId (required) - * @param addLabelsToSourceAlphaInput (required) + * Add Labels to Source Adds an existing label to a Source. • When called, this endpoint may + * generate the `Source Modified` event in the [audit trail](/tag/Audit-Trail). + * + * @param sourceId (required) + * @param addLabelsToSourceV1Input (required) * @return AddLabelsToSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public AddLabelsToSource200Response addLabelsToSource(String sourceId, AddLabelsToSourceAlphaInput addLabelsToSourceAlphaInput) throws ApiException { - ApiResponse localVarResp = addLabelsToSourceWithHttpInfo(sourceId, addLabelsToSourceAlphaInput); + public AddLabelsToSource200Response addLabelsToSource( + String sourceId, AddLabelsToSourceV1Input addLabelsToSourceV1Input) + throws ApiException { + ApiResponse localVarResp = + addLabelsToSourceWithHttpInfo(sourceId, addLabelsToSourceV1Input); return localVarResp.getData(); } /** - * Add Labels to Source - * Adds an existing label to a Source. When called, this endpoint may generate the `Source Modified` [Audit Trail](/tag/Audit-Trail) event. - * @param sourceId (required) - * @param addLabelsToSourceAlphaInput (required) + * Add Labels to Source Adds an existing label to a Source. • When called, this endpoint may + * generate the `Source Modified` event in the [audit trail](/tag/Audit-Trail). + * + * @param sourceId (required) + * @param addLabelsToSourceV1Input (required) * @return ApiResponse<AddLabelsToSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse addLabelsToSourceWithHttpInfo(String sourceId, AddLabelsToSourceAlphaInput addLabelsToSourceAlphaInput) throws ApiException { - okhttp3.Call localVarCall = addLabelsToSourceValidateBeforeCall(sourceId, addLabelsToSourceAlphaInput, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse addLabelsToSourceWithHttpInfo( + String sourceId, AddLabelsToSourceV1Input addLabelsToSourceV1Input) + throws ApiException { + okhttp3.Call localVarCall = + addLabelsToSourceValidateBeforeCall(sourceId, addLabelsToSourceV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Add Labels to Source (asynchronously) - * Adds an existing label to a Source. When called, this endpoint may generate the `Source Modified` [Audit Trail](/tag/Audit-Trail) event. - * @param sourceId (required) - * @param addLabelsToSourceAlphaInput (required) + * Add Labels to Source (asynchronously) Adds an existing label to a Source. • When called, this + * endpoint may generate the `Source Modified` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param sourceId (required) + * @param addLabelsToSourceV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call addLabelsToSourceAsync(String sourceId, AddLabelsToSourceAlphaInput addLabelsToSourceAlphaInput, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = addLabelsToSourceValidateBeforeCall(sourceId, addLabelsToSourceAlphaInput, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call addLabelsToSourceAsync( + String sourceId, + AddLabelsToSourceV1Input addLabelsToSourceV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addLabelsToSourceValidateBeforeCall(sourceId, addLabelsToSourceV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for createSource - * @param createSourceAlphaInput (required) + * + * @param createSourceV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createSourceCall(CreateSourceAlphaInput createSourceAlphaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createSourceCall( + CreateSourceV1Input createSourceV1Input, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } - Object localVarPostBody = createSourceAlphaInput; + Object localVarPostBody = createSourceV1Input; // create path and map variables String localVarPath = "/sources"; @@ -292,7 +321,10 @@ public okhttp3.Call createSourceCall(CreateSourceAlphaInput createSourceAlphaInp Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -300,119 +332,317 @@ public okhttp3.Call createSourceCall(CreateSourceAlphaInput createSourceAlphaInp } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createSourceValidateBeforeCall(CreateSourceAlphaInput createSourceAlphaInput, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'createSourceAlphaInput' is set - if (createSourceAlphaInput == null) { - throw new ApiException("Missing the required parameter 'createSourceAlphaInput' when calling createSource(Async)"); + private okhttp3.Call createSourceValidateBeforeCall( + CreateSourceV1Input createSourceV1Input, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'createSourceV1Input' is set + if (createSourceV1Input == null) { + throw new ApiException( + "Missing the required parameter 'createSourceV1Input' when calling" + + " createSource(Async)"); } - - okhttp3.Call localVarCall = createSourceCall(createSourceAlphaInput, _callback); + return createSourceCall(createSourceV1Input, _callback); + } + + /** + * Create Source Creates a new Source. • When called, this endpoint may generate the + * `Source Created` event in the [audit trail](/tag/Audit-Trail). + * + * @param createSourceV1Input (required) + * @return CreateSource201Response + * @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 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateSource201Response createSource(CreateSourceV1Input createSourceV1Input) + throws ApiException { + ApiResponse localVarResp = + createSourceWithHttpInfo(createSourceV1Input); + return localVarResp.getData(); + } + + /** + * Create Source Creates a new Source. • When called, this endpoint may generate the + * `Source Created` event in the [audit trail](/tag/Audit-Trail). + * + * @param createSourceV1Input (required) + * @return ApiResponse<CreateSource201Response> + * @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 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse createSourceWithHttpInfo( + CreateSourceV1Input createSourceV1Input) throws ApiException { + okhttp3.Call localVarCall = createSourceValidateBeforeCall(createSourceV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Source (asynchronously) Creates a new Source. • When called, this endpoint may + * generate the `Source Created` event in the [audit trail](/tag/Audit-Trail). + * + * @param createSourceV1Input (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 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createSourceAsync( + CreateSourceV1Input createSourceV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = createSourceValidateBeforeCall(createSourceV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; + } + + /** + * Build call for createWriteKeyForSource + * + * @param sourceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createWriteKeyForSourceCall(String sourceId, 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 = + "/sources/{sourceId}/writekey" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.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.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createWriteKeyForSourceValidateBeforeCall( + String sourceId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'sourceId' is set + if (sourceId == null) { + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " createWriteKeyForSource(Async)"); + } + return createWriteKeyForSourceCall(sourceId, _callback); } /** - * Create Source - * Creates a new Source. When called, this endpoint may generate the `Source Created` [Audit Trail](/tag/Audit-Trail) event. - * @param createSourceAlphaInput (required) - * @return CreateSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * Create Write Key for Source Creates a new Write Key for the Source. • When called, this + * endpoint may generate the `Source Modified` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param sourceId (required) + * @return CreateWriteKeyForSource200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateSource200Response createSource(CreateSourceAlphaInput createSourceAlphaInput) throws ApiException { - ApiResponse localVarResp = createSourceWithHttpInfo(createSourceAlphaInput); + public CreateWriteKeyForSource200Response createWriteKeyForSource(String sourceId) + throws ApiException { + ApiResponse localVarResp = + createWriteKeyForSourceWithHttpInfo(sourceId); return localVarResp.getData(); } /** - * Create Source - * Creates a new Source. When called, this endpoint may generate the `Source Created` [Audit Trail](/tag/Audit-Trail) event. - * @param createSourceAlphaInput (required) - * @return ApiResponse<CreateSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * Create Write Key for Source Creates a new Write Key for the Source. • When called, this + * endpoint may generate the `Source Modified` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param sourceId (required) + * @return ApiResponse<CreateWriteKeyForSource200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createSourceWithHttpInfo(CreateSourceAlphaInput createSourceAlphaInput) throws ApiException { - okhttp3.Call localVarCall = createSourceValidateBeforeCall(createSourceAlphaInput, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse createWriteKeyForSourceWithHttpInfo( + String sourceId) throws ApiException { + okhttp3.Call localVarCall = createWriteKeyForSourceValidateBeforeCall(sourceId, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Source (asynchronously) - * Creates a new Source. When called, this endpoint may generate the `Source Created` [Audit Trail](/tag/Audit-Trail) event. - * @param createSourceAlphaInput (required) + * Create Write Key for Source (asynchronously) Creates a new Write Key for the Source. • When + * called, this endpoint may generate the `Source Modified` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param sourceId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createSourceAsync(CreateSourceAlphaInput createSourceAlphaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createWriteKeyForSourceAsync( + String sourceId, final ApiCallback _callback) + throws ApiException { - okhttp3.Call localVarCall = createSourceValidateBeforeCall(createSourceAlphaInput, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + okhttp3.Call localVarCall = createWriteKeyForSourceValidateBeforeCall(sourceId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for deleteSource - * @param sourceId (required) + * + * @param sourceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteSourceCall(String sourceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteSourceCall(String sourceId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -421,8 +651,11 @@ public okhttp3.Call deleteSourceCall(String sourceId, final ApiCallback _callbac Object localVarPostBody = null; // create path and map variables - String localVarPath = "/sources/{sourceId}" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -431,53 +664,66 @@ public okhttp3.Call deleteSourceCall(String sourceId, final ApiCallback _callbac Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteSourceValidateBeforeCall(String sourceId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call deleteSourceValidateBeforeCall( + String sourceId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling deleteSource(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling deleteSource(Async)"); } - - - okhttp3.Call localVarCall = deleteSourceCall(sourceId, _callback); - return localVarCall; + return deleteSourceCall(sourceId, _callback); } /** - * Delete Source - * Deletes an existing Source. When called, this endpoint may generate the `Source Deleted` [Audit Trail](/tag/Audit-Trail) event. - * @param sourceId (required) + * Delete Source Deletes an existing Source. • When called, this endpoint may generate the + * `Source Deleted` event in the [audit trail](/tag/Audit-Trail). + * + * @param sourceId (required) * @return DeleteSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public DeleteSource200Response deleteSource(String sourceId) throws ApiException { ApiResponse localVarResp = deleteSourceWithHttpInfo(sourceId); @@ -485,73 +731,83 @@ public DeleteSource200Response deleteSource(String sourceId) throws ApiException } /** - * Delete Source - * Deletes an existing Source. When called, this endpoint may generate the `Source Deleted` [Audit Trail](/tag/Audit-Trail) event. - * @param sourceId (required) + * Delete Source Deletes an existing Source. • When called, this endpoint may generate the + * `Source Deleted` event in the [audit trail](/tag/Audit-Trail). + * + * @param sourceId (required) * @return ApiResponse<DeleteSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse deleteSourceWithHttpInfo(String sourceId) throws ApiException { + public ApiResponse deleteSourceWithHttpInfo(String sourceId) + throws ApiException { okhttp3.Call localVarCall = deleteSourceValidateBeforeCall(sourceId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Delete Source (asynchronously) - * Deletes an existing Source. When called, this endpoint may generate the `Source Deleted` [Audit Trail](/tag/Audit-Trail) event. - * @param sourceId (required) + * Delete Source (asynchronously) Deletes an existing Source. • When called, this endpoint may + * generate the `Source Deleted` event in the [audit trail](/tag/Audit-Trail). + * + * @param sourceId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteSourceAsync(String sourceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteSourceAsync( + String sourceId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = deleteSourceValidateBeforeCall(sourceId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getSource - * @param sourceId (required) + * + * @param sourceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getSourceCall(String sourceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSourceCall(String sourceId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -560,8 +816,11 @@ public okhttp3.Call getSourceCall(String sourceId, final ApiCallback _callback) Object localVarPostBody = null; // create path and map variables - String localVarPath = "/sources/{sourceId}" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -570,53 +829,65 @@ public okhttp3.Call getSourceCall(String sourceId, final ApiCallback _callback) Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSourceValidateBeforeCall(String sourceId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getSourceValidateBeforeCall(String sourceId, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling getSource(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling getSource(Async)"); } - - - okhttp3.Call localVarCall = getSourceCall(sourceId, _callback); - return localVarCall; + return getSourceCall(sourceId, _callback); } /** - * Get Source - * Returns a Source by its id. - * @param sourceId (required) + * Get Source Returns a Source by its id. + * + * @param sourceId (required) * @return GetSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public GetSource200Response getSource(String sourceId) throws ApiException { ApiResponse localVarResp = getSourceWithHttpInfo(sourceId); @@ -624,74 +895,84 @@ public GetSource200Response getSource(String sourceId) throws ApiException { } /** - * Get Source - * Returns a Source by its id. - * @param sourceId (required) + * Get Source Returns a Source by its id. + * + * @param sourceId (required) * @return ApiResponse<GetSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getSourceWithHttpInfo(String sourceId) throws ApiException { + public ApiResponse getSourceWithHttpInfo(String sourceId) + throws ApiException { okhttp3.Call localVarCall = getSourceValidateBeforeCall(sourceId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Source (asynchronously) - * Returns a Source by its id. - * @param sourceId (required) + * Get Source (asynchronously) Returns a Source by its id. + * + * @param sourceId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getSourceAsync(String sourceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSourceAsync( + String sourceId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = getSourceValidateBeforeCall(sourceId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listConnectedDestinationsFromSource - * @param sourceId (required) - * @param pagination Required pagination params for the request. This parameter exists in beta. (required) + * + * @param sourceId (required) + * @param pagination Required pagination params for the request. This parameter exists in alpha. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listConnectedDestinationsFromSourceCall(String sourceId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listConnectedDestinationsFromSourceCall( + String sourceId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -700,8 +981,11 @@ public okhttp3.Call listConnectedDestinationsFromSourceCall(String sourceId, Pag Object localVarPostBody = null; // create path and map variables - String localVarPath = "/sources/{sourceId}/connected-destinations" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}/connected-destinations" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -714,136 +998,169 @@ public okhttp3.Call listConnectedDestinationsFromSourceCall(String sourceId, Pag } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listConnectedDestinationsFromSourceValidateBeforeCall(String sourceId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listConnectedDestinationsFromSourceValidateBeforeCall( + String sourceId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling listConnectedDestinationsFromSource(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listConnectedDestinationsFromSource(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " listConnectedDestinationsFromSource(Async)"); } - - - okhttp3.Call localVarCall = listConnectedDestinationsFromSourceCall(sourceId, pagination, _callback); - return localVarCall; + return listConnectedDestinationsFromSourceCall(sourceId, pagination, _callback); } /** - * List Connected Destinations from Source - * Returns a list of Destinations connected to a Source. - * @param sourceId (required) - * @param pagination Required pagination params for the request. This parameter exists in beta. (required) + * List Connected Destinations from Source Returns a list of Destinations connected to a Source. + * + * @param sourceId (required) + * @param pagination Required pagination params for the request. This parameter exists in alpha. + * (optional) * @return ListConnectedDestinationsFromSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListConnectedDestinationsFromSource200Response listConnectedDestinationsFromSource(String sourceId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listConnectedDestinationsFromSourceWithHttpInfo(sourceId, pagination); + public ListConnectedDestinationsFromSource200Response listConnectedDestinationsFromSource( + String sourceId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listConnectedDestinationsFromSourceWithHttpInfo(sourceId, pagination); return localVarResp.getData(); } /** - * List Connected Destinations from Source - * Returns a list of Destinations connected to a Source. - * @param sourceId (required) - * @param pagination Required pagination params for the request. This parameter exists in beta. (required) + * List Connected Destinations from Source Returns a list of Destinations connected to a Source. + * + * @param sourceId (required) + * @param pagination Required pagination params for the request. This parameter exists in alpha. + * (optional) * @return ApiResponse<ListConnectedDestinationsFromSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listConnectedDestinationsFromSourceWithHttpInfo(String sourceId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listConnectedDestinationsFromSourceValidateBeforeCall(sourceId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + listConnectedDestinationsFromSourceWithHttpInfo( + String sourceId, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + listConnectedDestinationsFromSourceValidateBeforeCall(sourceId, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Connected Destinations from Source (asynchronously) - * Returns a list of Destinations connected to a Source. - * @param sourceId (required) - * @param pagination Required pagination params for the request. This parameter exists in beta. (required) + * List Connected Destinations from Source (asynchronously) Returns a list of Destinations + * connected to a Source. + * + * @param sourceId (required) + * @param pagination Required pagination params for the request. This parameter exists in alpha. + * (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listConnectedDestinationsFromSourceAsync(String sourceId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listConnectedDestinationsFromSourceValidateBeforeCall(sourceId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listConnectedDestinationsFromSourceAsync( + String sourceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listConnectedDestinationsFromSourceValidateBeforeCall( + sourceId, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listConnectedWarehousesFromSource - * @param sourceId (required) - * @param pagination Required pagination params for the request. This parameter exists in beta. (required) + * + * @param sourceId (required) + * @param pagination Required pagination params for the request. This parameter exists in alpha. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listConnectedWarehousesFromSourceCall(String sourceId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listConnectedWarehousesFromSourceCall( + String sourceId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -852,8 +1169,11 @@ public okhttp3.Call listConnectedWarehousesFromSourceCall(String sourceId, Pagin Object localVarPostBody = null; // create path and map variables - String localVarPath = "/sources/{sourceId}/connected-warehouses" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}/connected-warehouses" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -866,135 +1186,166 @@ public okhttp3.Call listConnectedWarehousesFromSourceCall(String sourceId, Pagin } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listConnectedWarehousesFromSourceValidateBeforeCall(String sourceId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listConnectedWarehousesFromSourceValidateBeforeCall( + String sourceId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling listConnectedWarehousesFromSource(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listConnectedWarehousesFromSource(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " listConnectedWarehousesFromSource(Async)"); } - - - okhttp3.Call localVarCall = listConnectedWarehousesFromSourceCall(sourceId, pagination, _callback); - return localVarCall; + return listConnectedWarehousesFromSourceCall(sourceId, pagination, _callback); } /** - * List Connected Warehouses from Source - * Returns a list of Warehouses connected to a Source. - * @param sourceId (required) - * @param pagination Required pagination params for the request. This parameter exists in beta. (required) + * List Connected Warehouses from Source Returns a list of Warehouses connected to a Source. + * + * @param sourceId (required) + * @param pagination Required pagination params for the request. This parameter exists in alpha. + * (optional) * @return ListConnectedWarehousesFromSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListConnectedWarehousesFromSource200Response listConnectedWarehousesFromSource(String sourceId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listConnectedWarehousesFromSourceWithHttpInfo(sourceId, pagination); + public ListConnectedWarehousesFromSource200Response listConnectedWarehousesFromSource( + String sourceId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listConnectedWarehousesFromSourceWithHttpInfo(sourceId, pagination); return localVarResp.getData(); } /** - * List Connected Warehouses from Source - * Returns a list of Warehouses connected to a Source. - * @param sourceId (required) - * @param pagination Required pagination params for the request. This parameter exists in beta. (required) + * List Connected Warehouses from Source Returns a list of Warehouses connected to a Source. + * + * @param sourceId (required) + * @param pagination Required pagination params for the request. This parameter exists in alpha. + * (optional) * @return ApiResponse<ListConnectedWarehousesFromSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listConnectedWarehousesFromSourceWithHttpInfo(String sourceId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listConnectedWarehousesFromSourceValidateBeforeCall(sourceId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + listConnectedWarehousesFromSourceWithHttpInfo( + String sourceId, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + listConnectedWarehousesFromSourceValidateBeforeCall(sourceId, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Connected Warehouses from Source (asynchronously) - * Returns a list of Warehouses connected to a Source. - * @param sourceId (required) - * @param pagination Required pagination params for the request. This parameter exists in beta. (required) + * List Connected Warehouses from Source (asynchronously) Returns a list of Warehouses connected + * to a Source. + * + * @param sourceId (required) + * @param pagination Required pagination params for the request. This parameter exists in alpha. + * (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listConnectedWarehousesFromSourceAsync(String sourceId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listConnectedWarehousesFromSourceValidateBeforeCall(sourceId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listConnectedWarehousesFromSourceAsync( + String sourceId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listConnectedWarehousesFromSourceValidateBeforeCall( + sourceId, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listSchemaSettingsInSource - * @param sourceId (required) + * + * @param sourceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSchemaSettingsInSourceCall(String sourceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listSchemaSettingsInSourceCall(String sourceId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1003,8 +1354,11 @@ public okhttp3.Call listSchemaSettingsInSourceCall(String sourceId, final ApiCal Object localVarPostBody = null; // create path and map variables - String localVarPath = "/sources/{sourceId}/settings" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}/settings" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1013,127 +1367,160 @@ public okhttp3.Call listSchemaSettingsInSourceCall(String sourceId, final ApiCal Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listSchemaSettingsInSourceValidateBeforeCall(String sourceId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listSchemaSettingsInSourceValidateBeforeCall( + String sourceId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling listSchemaSettingsInSource(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " listSchemaSettingsInSource(Async)"); } - - - okhttp3.Call localVarCall = listSchemaSettingsInSourceCall(sourceId, _callback); - return localVarCall; + return listSchemaSettingsInSourceCall(sourceId, _callback); } /** - * List Schema Settings in Source - * Retrieves the schema configuration settings for a Source. If Protocols is not enabled for the Source, the configurations specific to Protocols will have default values. - * @param sourceId (required) + * List Schema Settings in Source Retrieves the schema configuration settings for a Source. If + * Protocols is not enabled for the Source, the configurations specific to Protocols will have + * default values. + * + * @param sourceId (required) * @return ListSchemaSettingsInSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListSchemaSettingsInSource200Response listSchemaSettingsInSource(String sourceId) throws ApiException { - ApiResponse localVarResp = listSchemaSettingsInSourceWithHttpInfo(sourceId); + public ListSchemaSettingsInSource200Response listSchemaSettingsInSource(String sourceId) + throws ApiException { + ApiResponse localVarResp = + listSchemaSettingsInSourceWithHttpInfo(sourceId); return localVarResp.getData(); } /** - * List Schema Settings in Source - * Retrieves the schema configuration settings for a Source. If Protocols is not enabled for the Source, the configurations specific to Protocols will have default values. - * @param sourceId (required) + * List Schema Settings in Source Retrieves the schema configuration settings for a Source. If + * Protocols is not enabled for the Source, the configurations specific to Protocols will have + * default values. + * + * @param sourceId (required) * @return ApiResponse<ListSchemaSettingsInSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listSchemaSettingsInSourceWithHttpInfo(String sourceId) throws ApiException { + public ApiResponse + listSchemaSettingsInSourceWithHttpInfo(String sourceId) throws ApiException { okhttp3.Call localVarCall = listSchemaSettingsInSourceValidateBeforeCall(sourceId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Schema Settings in Source (asynchronously) - * Retrieves the schema configuration settings for a Source. If Protocols is not enabled for the Source, the configurations specific to Protocols will have default values. - * @param sourceId (required) + * List Schema Settings in Source (asynchronously) Retrieves the schema configuration settings + * for a Source. If Protocols is not enabled for the Source, the configurations specific to + * Protocols will have default values. + * + * @param sourceId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSchemaSettingsInSourceAsync(String sourceId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listSchemaSettingsInSourceValidateBeforeCall(sourceId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listSchemaSettingsInSourceAsync( + String sourceId, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSchemaSettingsInSourceValidateBeforeCall(sourceId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listSources - * @param pagination Defines the pagination parameters. This parameter exists in beta. (required) + * + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSourcesCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listSourcesCall(PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1155,53 +1542,60 @@ public okhttp3.Call listSourcesCall(PaginationInput pagination, final ApiCallbac } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listSourcesValidateBeforeCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listSources(Async)"); - } - - - okhttp3.Call localVarCall = listSourcesCall(pagination, _callback); - return localVarCall; - + private okhttp3.Call listSourcesValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return listSourcesCall(pagination, _callback); } /** - * List Sources - * Returns a list of Sources. - * @param pagination Defines the pagination parameters. This parameter exists in beta. (required) + * List Sources Returns a list of Sources. + * + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (optional) * @return ListSources200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public ListSources200Response listSources(PaginationInput pagination) throws ApiException { ApiResponse localVarResp = listSourcesWithHttpInfo(pagination); @@ -1209,84 +1603,284 @@ public ListSources200Response listSources(PaginationInput pagination) throws Api } /** - * List Sources - * Returns a list of Sources. - * @param pagination Defines the pagination parameters. This parameter exists in beta. (required) + * List Sources Returns a list of Sources. + * + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (optional) * @return ApiResponse<ListSources200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listSourcesWithHttpInfo(PaginationInput pagination) throws ApiException { + public ApiResponse listSourcesWithHttpInfo(PaginationInput pagination) + throws ApiException { okhttp3.Call localVarCall = listSourcesValidateBeforeCall(pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Sources (asynchronously) - * Returns a list of Sources. - * @param pagination Defines the pagination parameters. This parameter exists in beta. (required) + * List Sources (asynchronously) Returns a list of Sources. + * + * @param pagination Defines the pagination parameters. This parameter exists in alpha. + * (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSourcesAsync(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listSourcesAsync( + PaginationInput pagination, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = listSourcesValidateBeforeCall(pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for removeWriteKeyFromSource + * + * @param sourceId (required) + * @param writeKey (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call removeWriteKeyFromSourceCall( + String sourceId, String writeKey, 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 = + "/sources/{sourceId}/writekey/{writeKey}" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())) + .replace( + "{" + "writeKey" + "}", + localVarApiClient.escapeString(writeKey.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.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call removeWriteKeyFromSourceValidateBeforeCall( + String sourceId, String writeKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'sourceId' is set + if (sourceId == null) { + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " removeWriteKeyFromSource(Async)"); + } + + // verify the required parameter 'writeKey' is set + if (writeKey == null) { + throw new ApiException( + "Missing the required parameter 'writeKey' when calling" + + " removeWriteKeyFromSource(Async)"); + } + + return removeWriteKeyFromSourceCall(sourceId, writeKey, _callback); + } + + /** + * Remove Write Key from Source Removes a Write Key from a Source. • When called, this endpoint + * may generate the `Source Modified` event in the [audit trail](/tag/Audit-Trail). + * + * @param sourceId (required) + * @param writeKey (required) + * @return RemoveWriteKeyFromSource200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public RemoveWriteKeyFromSource200Response removeWriteKeyFromSource( + String sourceId, String writeKey) throws ApiException { + ApiResponse localVarResp = + removeWriteKeyFromSourceWithHttpInfo(sourceId, writeKey); + return localVarResp.getData(); + } + + /** + * Remove Write Key from Source Removes a Write Key from a Source. • When called, this endpoint + * may generate the `Source Modified` event in the [audit trail](/tag/Audit-Trail). + * + * @param sourceId (required) + * @param writeKey (required) + * @return ApiResponse<RemoveWriteKeyFromSource200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse removeWriteKeyFromSourceWithHttpInfo( + String sourceId, String writeKey) throws ApiException { + okhttp3.Call localVarCall = + removeWriteKeyFromSourceValidateBeforeCall(sourceId, writeKey, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Remove Write Key from Source (asynchronously) Removes a Write Key from a Source. • When + * called, this endpoint may generate the `Source Modified` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param sourceId (required) + * @param writeKey (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call removeWriteKeyFromSourceAsync( + String sourceId, + String writeKey, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeWriteKeyFromSourceValidateBeforeCall(sourceId, writeKey, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for replaceLabelsInSource - * @param sourceId (required) - * @param replaceLabelsInSourceAlphaInput (required) + * + * @param sourceId (required) + * @param replaceLabelsInSourceV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replaceLabelsInSourceCall(String sourceId, ReplaceLabelsInSourceAlphaInput replaceLabelsInSourceAlphaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call replaceLabelsInSourceCall( + String sourceId, + ReplaceLabelsInSourceV1Input replaceLabelsInSourceV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } - Object localVarPostBody = replaceLabelsInSourceAlphaInput; + Object localVarPostBody = replaceLabelsInSourceV1Input; // create path and map variables - String localVarPath = "/sources/{sourceId}/labels" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}/labels" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1295,7 +1889,10 @@ public okhttp3.Call replaceLabelsInSourceCall(String sourceId, ReplaceLabelsInSo Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -1303,128 +1900,169 @@ public okhttp3.Call replaceLabelsInSourceCall(String sourceId, ReplaceLabelsInSo } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replaceLabelsInSourceValidateBeforeCall(String sourceId, ReplaceLabelsInSourceAlphaInput replaceLabelsInSourceAlphaInput, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call replaceLabelsInSourceValidateBeforeCall( + String sourceId, + ReplaceLabelsInSourceV1Input replaceLabelsInSourceV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling replaceLabelsInSource(Async)"); - } - - // verify the required parameter 'replaceLabelsInSourceAlphaInput' is set - if (replaceLabelsInSourceAlphaInput == null) { - throw new ApiException("Missing the required parameter 'replaceLabelsInSourceAlphaInput' when calling replaceLabelsInSource(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " replaceLabelsInSource(Async)"); } - - okhttp3.Call localVarCall = replaceLabelsInSourceCall(sourceId, replaceLabelsInSourceAlphaInput, _callback); - return localVarCall; + // verify the required parameter 'replaceLabelsInSourceV1Input' is set + if (replaceLabelsInSourceV1Input == null) { + throw new ApiException( + "Missing the required parameter 'replaceLabelsInSourceV1Input' when calling" + + " replaceLabelsInSource(Async)"); + } + return replaceLabelsInSourceCall(sourceId, replaceLabelsInSourceV1Input, _callback); } /** - * Replace Labels in Source - * Replaces all labels in a Source. - * @param sourceId (required) - * @param replaceLabelsInSourceAlphaInput (required) + * Replace Labels in Source Replaces all labels in a Source. + * + * @param sourceId (required) + * @param replaceLabelsInSourceV1Input (required) * @return ReplaceLabelsInSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ReplaceLabelsInSource200Response replaceLabelsInSource(String sourceId, ReplaceLabelsInSourceAlphaInput replaceLabelsInSourceAlphaInput) throws ApiException { - ApiResponse localVarResp = replaceLabelsInSourceWithHttpInfo(sourceId, replaceLabelsInSourceAlphaInput); + public ReplaceLabelsInSource200Response replaceLabelsInSource( + String sourceId, ReplaceLabelsInSourceV1Input replaceLabelsInSourceV1Input) + throws ApiException { + ApiResponse localVarResp = + replaceLabelsInSourceWithHttpInfo(sourceId, replaceLabelsInSourceV1Input); return localVarResp.getData(); } /** - * Replace Labels in Source - * Replaces all labels in a Source. - * @param sourceId (required) - * @param replaceLabelsInSourceAlphaInput (required) + * Replace Labels in Source Replaces all labels in a Source. + * + * @param sourceId (required) + * @param replaceLabelsInSourceV1Input (required) * @return ApiResponse<ReplaceLabelsInSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse replaceLabelsInSourceWithHttpInfo(String sourceId, ReplaceLabelsInSourceAlphaInput replaceLabelsInSourceAlphaInput) throws ApiException { - okhttp3.Call localVarCall = replaceLabelsInSourceValidateBeforeCall(sourceId, replaceLabelsInSourceAlphaInput, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse replaceLabelsInSourceWithHttpInfo( + String sourceId, ReplaceLabelsInSourceV1Input replaceLabelsInSourceV1Input) + throws ApiException { + okhttp3.Call localVarCall = + replaceLabelsInSourceValidateBeforeCall( + sourceId, replaceLabelsInSourceV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace Labels in Source (asynchronously) - * Replaces all labels in a Source. - * @param sourceId (required) - * @param replaceLabelsInSourceAlphaInput (required) + * Replace Labels in Source (asynchronously) Replaces all labels in a Source. + * + * @param sourceId (required) + * @param replaceLabelsInSourceV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replaceLabelsInSourceAsync(String sourceId, ReplaceLabelsInSourceAlphaInput replaceLabelsInSourceAlphaInput, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = replaceLabelsInSourceValidateBeforeCall(sourceId, replaceLabelsInSourceAlphaInput, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call replaceLabelsInSourceAsync( + String sourceId, + ReplaceLabelsInSourceV1Input replaceLabelsInSourceV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + replaceLabelsInSourceValidateBeforeCall( + sourceId, replaceLabelsInSourceV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for updateSchemaSettingsInSource - * @param sourceId (required) - * @param updateSchemaSettingsInSourceV1Input (required) + * + * @param sourceId (required) + * @param updateSchemaSettingsInSourceV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateSchemaSettingsInSourceCall(String sourceId, UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call updateSchemaSettingsInSourceCall( + String sourceId, + UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1433,8 +2071,11 @@ public okhttp3.Call updateSchemaSettingsInSourceCall(String sourceId, UpdateSche Object localVarPostBody = updateSchemaSettingsInSourceV1Input; // create path and map variables - String localVarPath = "/sources/{sourceId}/settings" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}/settings" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1443,7 +2084,10 @@ public okhttp3.Call updateSchemaSettingsInSourceCall(String sourceId, UpdateSche Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -1451,138 +2095,193 @@ public okhttp3.Call updateSchemaSettingsInSourceCall(String sourceId, UpdateSche } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateSchemaSettingsInSourceValidateBeforeCall(String sourceId, UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call updateSchemaSettingsInSourceValidateBeforeCall( + String sourceId, + UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling updateSchemaSettingsInSource(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " updateSchemaSettingsInSource(Async)"); } - + // verify the required parameter 'updateSchemaSettingsInSourceV1Input' is set if (updateSchemaSettingsInSourceV1Input == null) { - throw new ApiException("Missing the required parameter 'updateSchemaSettingsInSourceV1Input' when calling updateSchemaSettingsInSource(Async)"); + throw new ApiException( + "Missing the required parameter 'updateSchemaSettingsInSourceV1Input' when" + + " calling updateSchemaSettingsInSource(Async)"); } - - - okhttp3.Call localVarCall = updateSchemaSettingsInSourceCall(sourceId, updateSchemaSettingsInSourceV1Input, _callback); - return localVarCall; + return updateSchemaSettingsInSourceCall( + sourceId, updateSchemaSettingsInSourceV1Input, _callback); } /** - * Update Schema Settings in Source - * Updates the schema configuration for a Source. If Protocols is not enabled for the Source, any updates to Protocols-specific configurations will not be applied. Config API omitted fields: - `updateMask` - * @param sourceId (required) - * @param updateSchemaSettingsInSourceV1Input (required) + * Update Schema Settings in Source Updates the schema configuration for a Source. If Protocols + * is not enabled for the Source, any updates to Protocols-specific configurations will not be + * applied. Config API omitted fields: - `updateMask` + * + * @param sourceId (required) + * @param updateSchemaSettingsInSourceV1Input (required) * @return UpdateSchemaSettingsInSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public UpdateSchemaSettingsInSource200Response updateSchemaSettingsInSource(String sourceId, UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input) throws ApiException { - ApiResponse localVarResp = updateSchemaSettingsInSourceWithHttpInfo(sourceId, updateSchemaSettingsInSourceV1Input); + public UpdateSchemaSettingsInSource200Response updateSchemaSettingsInSource( + String sourceId, + UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input) + throws ApiException { + ApiResponse localVarResp = + updateSchemaSettingsInSourceWithHttpInfo( + sourceId, updateSchemaSettingsInSourceV1Input); return localVarResp.getData(); } /** - * Update Schema Settings in Source - * Updates the schema configuration for a Source. If Protocols is not enabled for the Source, any updates to Protocols-specific configurations will not be applied. Config API omitted fields: - `updateMask` - * @param sourceId (required) - * @param updateSchemaSettingsInSourceV1Input (required) + * Update Schema Settings in Source Updates the schema configuration for a Source. If Protocols + * is not enabled for the Source, any updates to Protocols-specific configurations will not be + * applied. Config API omitted fields: - `updateMask` + * + * @param sourceId (required) + * @param updateSchemaSettingsInSourceV1Input (required) * @return ApiResponse<UpdateSchemaSettingsInSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse updateSchemaSettingsInSourceWithHttpInfo(String sourceId, UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input) throws ApiException { - okhttp3.Call localVarCall = updateSchemaSettingsInSourceValidateBeforeCall(sourceId, updateSchemaSettingsInSourceV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + updateSchemaSettingsInSourceWithHttpInfo( + String sourceId, + UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input) + throws ApiException { + okhttp3.Call localVarCall = + updateSchemaSettingsInSourceValidateBeforeCall( + sourceId, updateSchemaSettingsInSourceV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Schema Settings in Source (asynchronously) - * Updates the schema configuration for a Source. If Protocols is not enabled for the Source, any updates to Protocols-specific configurations will not be applied. Config API omitted fields: - `updateMask` - * @param sourceId (required) - * @param updateSchemaSettingsInSourceV1Input (required) + * Update Schema Settings in Source (asynchronously) Updates the schema configuration for a + * Source. If Protocols is not enabled for the Source, any updates to Protocols-specific + * configurations will not be applied. Config API omitted fields: - `updateMask` + * + * @param sourceId (required) + * @param updateSchemaSettingsInSourceV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateSchemaSettingsInSourceAsync(String sourceId, UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateSchemaSettingsInSourceValidateBeforeCall(sourceId, updateSchemaSettingsInSourceV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call updateSchemaSettingsInSourceAsync( + String sourceId, + UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateSchemaSettingsInSourceValidateBeforeCall( + sourceId, updateSchemaSettingsInSourceV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for updateSource - * @param sourceId (required) - * @param updateSourceAlphaInput (required) + * + * @param sourceId (required) + * @param updateSourceV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateSourceCall(String sourceId, UpdateSourceAlphaInput updateSourceAlphaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call updateSourceCall( + String sourceId, UpdateSourceV1Input updateSourceV1Input, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } - Object localVarPostBody = updateSourceAlphaInput; + Object localVarPostBody = updateSourceV1Input; // create path and map variables - String localVarPath = "/sources/{sourceId}" - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/sources/{sourceId}" + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1591,7 +2290,10 @@ public okhttp3.Call updateSourceCall(String sourceId, UpdateSourceAlphaInput upd Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -1599,100 +2301,137 @@ public okhttp3.Call updateSourceCall(String sourceId, UpdateSourceAlphaInput upd } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateSourceValidateBeforeCall(String sourceId, UpdateSourceAlphaInput updateSourceAlphaInput, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call updateSourceValidateBeforeCall( + String sourceId, UpdateSourceV1Input updateSourceV1Input, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling updateSource(Async)"); - } - - // verify the required parameter 'updateSourceAlphaInput' is set - if (updateSourceAlphaInput == null) { - throw new ApiException("Missing the required parameter 'updateSourceAlphaInput' when calling updateSource(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling updateSource(Async)"); } - - okhttp3.Call localVarCall = updateSourceCall(sourceId, updateSourceAlphaInput, _callback); - return localVarCall; + // verify the required parameter 'updateSourceV1Input' is set + if (updateSourceV1Input == null) { + throw new ApiException( + "Missing the required parameter 'updateSourceV1Input' when calling" + + " updateSource(Async)"); + } + return updateSourceCall(sourceId, updateSourceV1Input, _callback); } /** - * Update Source - * Updates an existing Source. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Source Modified * Source Enabled * Source Settings Modified * Source Disabled Config API omitted fields: - `updateMask` - * @param sourceId (required) - * @param updateSourceAlphaInput (required) + * Update Source Updates an existing Source. • When called, this endpoint may generate one or + * more of the following [audit trail](/tag/Audit-Trail) events:* Source Modified * Source + * Enabled * Source Settings Modified * Source Disabled Config API omitted fields: - + * `updateMask` + * + * @param sourceId (required) + * @param updateSourceV1Input (required) * @return UpdateSource200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public UpdateSource200Response updateSource(String sourceId, UpdateSourceAlphaInput updateSourceAlphaInput) throws ApiException { - ApiResponse localVarResp = updateSourceWithHttpInfo(sourceId, updateSourceAlphaInput); + public UpdateSource200Response updateSource( + String sourceId, UpdateSourceV1Input updateSourceV1Input) throws ApiException { + ApiResponse localVarResp = + updateSourceWithHttpInfo(sourceId, updateSourceV1Input); return localVarResp.getData(); } /** - * Update Source - * Updates an existing Source. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Source Modified * Source Enabled * Source Settings Modified * Source Disabled Config API omitted fields: - `updateMask` - * @param sourceId (required) - * @param updateSourceAlphaInput (required) + * Update Source Updates an existing Source. • When called, this endpoint may generate one or + * more of the following [audit trail](/tag/Audit-Trail) events:* Source Modified * Source + * Enabled * Source Settings Modified * Source Disabled Config API omitted fields: - + * `updateMask` + * + * @param sourceId (required) + * @param updateSourceV1Input (required) * @return ApiResponse<UpdateSource200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse updateSourceWithHttpInfo(String sourceId, UpdateSourceAlphaInput updateSourceAlphaInput) throws ApiException { - okhttp3.Call localVarCall = updateSourceValidateBeforeCall(sourceId, updateSourceAlphaInput, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse updateSourceWithHttpInfo( + String sourceId, UpdateSourceV1Input updateSourceV1Input) throws ApiException { + okhttp3.Call localVarCall = + updateSourceValidateBeforeCall(sourceId, updateSourceV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Source (asynchronously) - * Updates an existing Source. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Source Modified * Source Enabled * Source Settings Modified * Source Disabled Config API omitted fields: - `updateMask` - * @param sourceId (required) - * @param updateSourceAlphaInput (required) + * Update Source (asynchronously) Updates an existing Source. • When called, this endpoint may + * generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Source + * Modified * Source Enabled * Source Settings Modified * Source Disabled Config API omitted + * fields: - `updateMask` + * + * @param sourceId (required) + * @param updateSourceV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateSourceAsync(String sourceId, UpdateSourceAlphaInput updateSourceAlphaInput, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateSourceValidateBeforeCall(sourceId, updateSourceAlphaInput, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call updateSourceAsync( + String sourceId, + UpdateSourceV1Input updateSourceV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateSourceValidateBeforeCall(sourceId, updateSourceV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/SpaceFiltersApi.java b/src/main/java/com/segment/publicapi/api/SpaceFiltersApi.java new file mode 100644 index 00000000..c1180690 --- /dev/null +++ b/src/main/java/com/segment/publicapi/api/SpaceFiltersApi.java @@ -0,0 +1,987 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.api; + +import com.google.gson.reflect.TypeToken; +import com.segment.publicapi.ApiCallback; +import com.segment.publicapi.ApiClient; +import com.segment.publicapi.ApiException; +import com.segment.publicapi.ApiResponse; +import com.segment.publicapi.Configuration; +import com.segment.publicapi.Pair; +import com.segment.publicapi.models.CreateFilterForSpace200Response; +import com.segment.publicapi.models.CreateFilterForSpaceInput; +import com.segment.publicapi.models.DeleteFilterById200Response; +import com.segment.publicapi.models.GetFilterById200Response; +import com.segment.publicapi.models.ListFiltersForSpace200Response; +import com.segment.publicapi.models.ListFiltersPaginationInput; +import com.segment.publicapi.models.UpdateFilterById200Response; +import com.segment.publicapi.models.UpdateFilterByIdInput; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SpaceFiltersApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public SpaceFiltersApi() { + this(Configuration.getDefaultApiClient()); + } + + public SpaceFiltersApi(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 createFilterForSpace + * + * @param createFilterForSpaceInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createFilterForSpaceCall( + CreateFilterForSpaceInput createFilterForSpaceInput, 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 = createFilterForSpaceInput; + + // create path and map variables + String localVarPath = "/filters"; + + 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.segment.v1beta+json", + "application/vnd.segment.v1alpha+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.segment.v1beta+json", "application/vnd.segment.v1alpha+json" + }; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createFilterForSpaceValidateBeforeCall( + CreateFilterForSpaceInput createFilterForSpaceInput, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'createFilterForSpaceInput' is set + if (createFilterForSpaceInput == null) { + throw new ApiException( + "Missing the required parameter 'createFilterForSpaceInput' when calling" + + " createFilterForSpace(Async)"); + } + + return createFilterForSpaceCall(createFilterForSpaceInput, _callback); + } + + /** + * Create Filter for Space Creates a filter for a space. A space filter applies to events coming + * from all Sources connected to a space. • This endpoint is in **Beta** testing. Please submit + * any feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Space Filters feature enabled. Please + * reach out to your customer success manager for more information. • When called, this endpoint + * may generate the `Filter Created` event in the [audit trail](/tag/Audit-Trail). + * + * @param createFilterForSpaceInput (required) + * @return CreateFilterForSpace200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public CreateFilterForSpace200Response createFilterForSpace( + CreateFilterForSpaceInput createFilterForSpaceInput) throws ApiException { + ApiResponse localVarResp = + createFilterForSpaceWithHttpInfo(createFilterForSpaceInput); + return localVarResp.getData(); + } + + /** + * Create Filter for Space Creates a filter for a space. A space filter applies to events coming + * from all Sources connected to a space. • This endpoint is in **Beta** testing. Please submit + * any feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Space Filters feature enabled. Please + * reach out to your customer success manager for more information. • When called, this endpoint + * may generate the `Filter Created` event in the [audit trail](/tag/Audit-Trail). + * + * @param createFilterForSpaceInput (required) + * @return ApiResponse<CreateFilterForSpace200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse createFilterForSpaceWithHttpInfo( + CreateFilterForSpaceInput createFilterForSpaceInput) throws ApiException { + okhttp3.Call localVarCall = + createFilterForSpaceValidateBeforeCall(createFilterForSpaceInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Filter for Space (asynchronously) Creates a filter for a space. A space filter applies + * to events coming from all Sources connected to a space. • This endpoint is in **Beta** + * testing. Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Space Filters + * feature enabled. Please reach out to your customer success manager for more information. • + * When called, this endpoint may generate the `Filter Created` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param createFilterForSpaceInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call createFilterForSpaceAsync( + CreateFilterForSpaceInput createFilterForSpaceInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createFilterForSpaceValidateBeforeCall(createFilterForSpaceInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for deleteFilterById + * + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call deleteFilterByIdCall(String id, 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 = + "/filters/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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.segment.v1beta+json", + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteFilterByIdValidateBeforeCall(String id, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling deleteFilterById(Async)"); + } + + return deleteFilterByIdCall(id, _callback); + } + + /** + * Delete Filter By Id Deletes a filter by id. • This endpoint is in **Beta** testing. Please + * submit any feedback by sending an email to friends@segment.com. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Space Filters feature enabled. + * Please reach out to your customer success manager for more information. • When called, this + * endpoint may generate the `Filter Deleted` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param id (required) + * @return DeleteFilterById200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public DeleteFilterById200Response deleteFilterById(String id) throws ApiException { + ApiResponse localVarResp = deleteFilterByIdWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Delete Filter By Id Deletes a filter by id. • This endpoint is in **Beta** testing. Please + * submit any feedback by sending an email to friends@segment.com. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Space Filters feature enabled. + * Please reach out to your customer success manager for more information. • When called, this + * endpoint may generate the `Filter Deleted` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param id (required) + * @return ApiResponse<DeleteFilterById200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse deleteFilterByIdWithHttpInfo(String id) + throws ApiException { + okhttp3.Call localVarCall = deleteFilterByIdValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete Filter By Id (asynchronously) Deletes a filter by id. • This endpoint is in **Beta** + * testing. Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Space Filters + * feature enabled. Please reach out to your customer success manager for more information. • + * When called, this endpoint may generate the `Filter Deleted` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call deleteFilterByIdAsync( + String id, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = deleteFilterByIdValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getFilterById + * + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getFilterByIdCall(String id, 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 = + "/filters/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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.segment.v1beta+json", + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFilterByIdValidateBeforeCall(String id, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling getFilterById(Async)"); + } + + return getFilterByIdCall(id, _callback); + } + + /** + * Get Filter By Id Gets a filter by id. • This endpoint is in **Beta** testing. Please submit + * any feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Space Filters feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param id (required) + * @return GetFilterById200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public GetFilterById200Response getFilterById(String id) throws ApiException { + ApiResponse localVarResp = getFilterByIdWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get Filter By Id Gets a filter by id. • This endpoint is in **Beta** testing. Please submit + * any feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Space Filters feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param id (required) + * @return ApiResponse<GetFilterById200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse getFilterByIdWithHttpInfo(String id) + throws ApiException { + okhttp3.Call localVarCall = getFilterByIdValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Filter By Id (asynchronously) Gets a filter by id. • This endpoint is in **Beta** + * testing. Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Space Filters + * feature enabled. Please reach out to your customer success manager for more information. + * + * @param id (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call getFilterByIdAsync( + String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getFilterByIdValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listFiltersForSpace + * + * @param integrationId The Space Id for which to fetch filters This parameter exists in beta. + * (required) + * @param pagination Pagination parameters. This parameter exists in beta. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listFiltersForSpaceCall( + String integrationId, + ListFiltersPaginationInput pagination, + 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 = "/filters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (integrationId != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("integrationId", integrationId)); + } + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listFiltersForSpaceValidateBeforeCall( + String integrationId, + ListFiltersPaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException( + "Missing the required parameter 'integrationId' when calling" + + " listFiltersForSpace(Async)"); + } + + return listFiltersForSpaceCall(integrationId, pagination, _callback); + } + + /** + * List Filters for Space Lists filters for a space. • This endpoint is in **Beta** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Space Filters + * feature enabled. Please reach out to your customer success manager for more information. + * + * @param integrationId The Space Id for which to fetch filters This parameter exists in beta. + * (required) + * @param pagination Pagination parameters. This parameter exists in beta. (optional) + * @return ListFiltersForSpace200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListFiltersForSpace200Response listFiltersForSpace( + String integrationId, ListFiltersPaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listFiltersForSpaceWithHttpInfo(integrationId, pagination); + return localVarResp.getData(); + } + + /** + * List Filters for Space Lists filters for a space. • This endpoint is in **Beta** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Space Filters + * feature enabled. Please reach out to your customer success manager for more information. + * + * @param integrationId The Space Id for which to fetch filters This parameter exists in beta. + * (required) + * @param pagination Pagination parameters. This parameter exists in beta. (optional) + * @return ApiResponse<ListFiltersForSpace200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse listFiltersForSpaceWithHttpInfo( + String integrationId, ListFiltersPaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + listFiltersForSpaceValidateBeforeCall(integrationId, pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Filters for Space (asynchronously) Lists filters for a space. • This endpoint is in + * **Beta** testing. Please submit any feedback by sending an email to friends@segment.com. • In + * order to successfully call this endpoint, the specified Workspace needs to have the Space + * Filters feature enabled. Please reach out to your customer success manager for more + * information. + * + * @param integrationId The Space Id for which to fetch filters This parameter exists in beta. + * (required) + * @param pagination Pagination parameters. This parameter exists in beta. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listFiltersForSpaceAsync( + String integrationId, + ListFiltersPaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listFiltersForSpaceValidateBeforeCall(integrationId, pagination, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateFilterById + * + * @param id (required) + * @param updateFilterByIdInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateFilterByIdCall( + String id, UpdateFilterByIdInput updateFilterByIdInput, 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 = updateFilterByIdInput; + + // create path and map variables + String localVarPath = + "/filters/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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.segment.v1beta+json", + "application/vnd.segment.v1alpha+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.segment.v1beta+json", "application/vnd.segment.v1alpha+json" + }; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateFilterByIdValidateBeforeCall( + String id, UpdateFilterByIdInput updateFilterByIdInput, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling updateFilterById(Async)"); + } + + // verify the required parameter 'updateFilterByIdInput' is set + if (updateFilterByIdInput == null) { + throw new ApiException( + "Missing the required parameter 'updateFilterByIdInput' when calling" + + " updateFilterById(Async)"); + } + + return updateFilterByIdCall(id, updateFilterByIdInput, _callback); + } + + /** + * Update Filter By Id Updates a filter by id and replaces the existing filter. • This endpoint + * is in **Beta** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Space Filters feature enabled. Please reach out to your customer success + * manager for more information. • When called, this endpoint may generate the `Filter + * Updated` event in the [audit trail](/tag/Audit-Trail). + * + * @param id (required) + * @param updateFilterByIdInput (required) + * @return UpdateFilterById200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public UpdateFilterById200Response updateFilterById( + String id, UpdateFilterByIdInput updateFilterByIdInput) throws ApiException { + ApiResponse localVarResp = + updateFilterByIdWithHttpInfo(id, updateFilterByIdInput); + return localVarResp.getData(); + } + + /** + * Update Filter By Id Updates a filter by id and replaces the existing filter. • This endpoint + * is in **Beta** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Space Filters feature enabled. Please reach out to your customer success + * manager for more information. • When called, this endpoint may generate the `Filter + * Updated` event in the [audit trail](/tag/Audit-Trail). + * + * @param id (required) + * @param updateFilterByIdInput (required) + * @return ApiResponse<UpdateFilterById200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse updateFilterByIdWithHttpInfo( + String id, UpdateFilterByIdInput updateFilterByIdInput) throws ApiException { + okhttp3.Call localVarCall = + updateFilterByIdValidateBeforeCall(id, updateFilterByIdInput, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Filter By Id (asynchronously) Updates a filter by id and replaces the existing filter. + * • This endpoint is in **Beta** testing. Please submit any feedback by sending an email to + * friends@segment.com. • In order to successfully call this endpoint, the specified Workspace + * needs to have the Space Filters feature enabled. Please reach out to your customer success + * manager for more information. • When called, this endpoint may generate the `Filter + * Updated` event in the [audit trail](/tag/Audit-Trail). + * + * @param id (required) + * @param updateFilterByIdInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call updateFilterByIdAsync( + String id, + UpdateFilterByIdInput updateFilterByIdInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateFilterByIdValidateBeforeCall(id, updateFilterByIdInput, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/segment/publicapi/api/SpacesApi.java b/src/main/java/com/segment/publicapi/api/SpacesApi.java index 7d8da271..8e489fb9 100644 --- a/src/main/java/com/segment/publicapi/api/SpacesApi.java +++ b/src/main/java/com/segment/publicapi/api/SpacesApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,36 +9,27 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.BatchQueryMessagingSubscriptionsForSpace200Response; import com.segment.publicapi.models.BatchQueryMessagingSubscriptionsForSpaceAlphaInput; import com.segment.publicapi.models.GetSpace200Response; +import com.segment.publicapi.models.ListSpaces200Response; +import com.segment.publicapi.models.PaginationInput; import com.segment.publicapi.models.ReplaceMessagingSubscriptionsInSpaces200Response; import com.segment.publicapi.models.ReplaceMessagingSubscriptionsInSpacesAlphaInput; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class SpacesApi { private ApiClient localVarApiClient; @@ -80,29 +70,35 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for batchQueryMessagingSubscriptionsForSpace - * @param spaceId (required) - * @param batchQueryMessagingSubscriptionsForSpaceAlphaInput (required) + * + * @param spaceId (required) + * @param batchQueryMessagingSubscriptionsForSpaceAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call batchQueryMessagingSubscriptionsForSpaceCall(String spaceId, BatchQueryMessagingSubscriptionsForSpaceAlphaInput batchQueryMessagingSubscriptionsForSpaceAlphaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call batchQueryMessagingSubscriptionsForSpaceCall( + String spaceId, + BatchQueryMessagingSubscriptionsForSpaceAlphaInput + batchQueryMessagingSubscriptionsForSpaceAlphaInput, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -111,8 +107,11 @@ public okhttp3.Call batchQueryMessagingSubscriptionsForSpaceCall(String spaceId, Object localVarPostBody = batchQueryMessagingSubscriptionsForSpaceAlphaInput; // create path and map variables - String localVarPath = "/spaces/{spaceId}/messaging-subscriptions/batch" - .replaceAll("\\{" + "spaceId" + "\\}", localVarApiClient.escapeString(spaceId.toString())); + String localVarPath = + "/spaces/{spaceId}/messaging-subscriptions/batch" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -128,128 +127,208 @@ public okhttp3.Call batchQueryMessagingSubscriptionsForSpaceCall(String spaceId, localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call batchQueryMessagingSubscriptionsForSpaceValidateBeforeCall(String spaceId, BatchQueryMessagingSubscriptionsForSpaceAlphaInput batchQueryMessagingSubscriptionsForSpaceAlphaInput, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call batchQueryMessagingSubscriptionsForSpaceValidateBeforeCall( + String spaceId, + BatchQueryMessagingSubscriptionsForSpaceAlphaInput + batchQueryMessagingSubscriptionsForSpaceAlphaInput, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'spaceId' is set if (spaceId == null) { - throw new ApiException("Missing the required parameter 'spaceId' when calling batchQueryMessagingSubscriptionsForSpace(Async)"); + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " batchQueryMessagingSubscriptionsForSpace(Async)"); } - + // verify the required parameter 'batchQueryMessagingSubscriptionsForSpaceAlphaInput' is set if (batchQueryMessagingSubscriptionsForSpaceAlphaInput == null) { - throw new ApiException("Missing the required parameter 'batchQueryMessagingSubscriptionsForSpaceAlphaInput' when calling batchQueryMessagingSubscriptionsForSpace(Async)"); + throw new ApiException( + "Missing the required parameter" + + " 'batchQueryMessagingSubscriptionsForSpaceAlphaInput' when calling" + + " batchQueryMessagingSubscriptionsForSpace(Async)"); } - - - okhttp3.Call localVarCall = batchQueryMessagingSubscriptionsForSpaceCall(spaceId, batchQueryMessagingSubscriptionsForSpaceAlphaInput, _callback); - return localVarCall; + return batchQueryMessagingSubscriptionsForSpaceCall( + spaceId, batchQueryMessagingSubscriptionsForSpaceAlphaInput, _callback); } /** - * Batch Query Messaging Subscriptions for Space - * Get Messaging Subscriptions for space. - * @param spaceId (required) - * @param batchQueryMessagingSubscriptionsForSpaceAlphaInput (required) + * Batch Query Messaging Subscriptions for Space <div style=\"background-color: + * #fff3cd; border: 1px solid #ffc107; border-radius: 6px; padding: 16px; margin: 16px 0; color: + * #856404; display: flex; align-items: center; gap: 12px; line-height: 1.5;\"> <span + * style=\"color: #ff9800; font-size: 16px; flex-shrink: 0;\">⚠️</span> + * <div style=\"line-height: 1.5;\"> <div style=\"font-weight: + * 600; font-size: 14px; margin-bottom: 6px;\"> Engage Premier features will no longer + * be available after December 15, 2025. </div> <div style=\"font-size: + * 13px;\"> This API will be deactivated after this date. </div> </div> + * </div> Get Messaging Subscriptions for space. • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Spaces feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param spaceId (required) + * @param batchQueryMessagingSubscriptionsForSpaceAlphaInput (required) * @return BatchQueryMessagingSubscriptionsForSpace200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public BatchQueryMessagingSubscriptionsForSpace200Response batchQueryMessagingSubscriptionsForSpace(String spaceId, BatchQueryMessagingSubscriptionsForSpaceAlphaInput batchQueryMessagingSubscriptionsForSpaceAlphaInput) throws ApiException { - ApiResponse localVarResp = batchQueryMessagingSubscriptionsForSpaceWithHttpInfo(spaceId, batchQueryMessagingSubscriptionsForSpaceAlphaInput); + public BatchQueryMessagingSubscriptionsForSpace200Response + batchQueryMessagingSubscriptionsForSpace( + String spaceId, + BatchQueryMessagingSubscriptionsForSpaceAlphaInput + batchQueryMessagingSubscriptionsForSpaceAlphaInput) + throws ApiException { + ApiResponse localVarResp = + batchQueryMessagingSubscriptionsForSpaceWithHttpInfo( + spaceId, batchQueryMessagingSubscriptionsForSpaceAlphaInput); return localVarResp.getData(); } /** - * Batch Query Messaging Subscriptions for Space - * Get Messaging Subscriptions for space. - * @param spaceId (required) - * @param batchQueryMessagingSubscriptionsForSpaceAlphaInput (required) + * Batch Query Messaging Subscriptions for Space <div style=\"background-color: + * #fff3cd; border: 1px solid #ffc107; border-radius: 6px; padding: 16px; margin: 16px 0; color: + * #856404; display: flex; align-items: center; gap: 12px; line-height: 1.5;\"> <span + * style=\"color: #ff9800; font-size: 16px; flex-shrink: 0;\">⚠️</span> + * <div style=\"line-height: 1.5;\"> <div style=\"font-weight: + * 600; font-size: 14px; margin-bottom: 6px;\"> Engage Premier features will no longer + * be available after December 15, 2025. </div> <div style=\"font-size: + * 13px;\"> This API will be deactivated after this date. </div> </div> + * </div> Get Messaging Subscriptions for space. • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Spaces feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param spaceId (required) + * @param batchQueryMessagingSubscriptionsForSpaceAlphaInput (required) * @return ApiResponse<BatchQueryMessagingSubscriptionsForSpace200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse batchQueryMessagingSubscriptionsForSpaceWithHttpInfo(String spaceId, BatchQueryMessagingSubscriptionsForSpaceAlphaInput batchQueryMessagingSubscriptionsForSpaceAlphaInput) throws ApiException { - okhttp3.Call localVarCall = batchQueryMessagingSubscriptionsForSpaceValidateBeforeCall(spaceId, batchQueryMessagingSubscriptionsForSpaceAlphaInput, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + batchQueryMessagingSubscriptionsForSpaceWithHttpInfo( + String spaceId, + BatchQueryMessagingSubscriptionsForSpaceAlphaInput + batchQueryMessagingSubscriptionsForSpaceAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + batchQueryMessagingSubscriptionsForSpaceValidateBeforeCall( + spaceId, batchQueryMessagingSubscriptionsForSpaceAlphaInput, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Batch Query Messaging Subscriptions for Space (asynchronously) - * Get Messaging Subscriptions for space. - * @param spaceId (required) - * @param batchQueryMessagingSubscriptionsForSpaceAlphaInput (required) + * Batch Query Messaging Subscriptions for Space (asynchronously) <div + * style=\"background-color: #fff3cd; border: 1px solid #ffc107; border-radius: 6px; + * padding: 16px; margin: 16px 0; color: #856404; display: flex; align-items: center; gap: 12px; + * line-height: 1.5;\"> <span style=\"color: #ff9800; font-size: 16px; + * flex-shrink: 0;\">⚠️</span> <div style=\"line-height: + * 1.5;\"> <div style=\"font-weight: 600; font-size: 14px; margin-bottom: + * 6px;\"> Engage Premier features will no longer be available after December 15, 2025. + * </div> <div style=\"font-size: 13px;\"> This API will be + * deactivated after this date. </div> </div> </div> Get Messaging + * Subscriptions for space. • This endpoint is in **Alpha** testing. Please submit any feedback + * by sending an email to friends@segment.com. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Spaces feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param spaceId (required) + * @param batchQueryMessagingSubscriptionsForSpaceAlphaInput (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call batchQueryMessagingSubscriptionsForSpaceAsync(String spaceId, BatchQueryMessagingSubscriptionsForSpaceAlphaInput batchQueryMessagingSubscriptionsForSpaceAlphaInput, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = batchQueryMessagingSubscriptionsForSpaceValidateBeforeCall(spaceId, batchQueryMessagingSubscriptionsForSpaceAlphaInput, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call batchQueryMessagingSubscriptionsForSpaceAsync( + String spaceId, + BatchQueryMessagingSubscriptionsForSpaceAlphaInput + batchQueryMessagingSubscriptionsForSpaceAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + batchQueryMessagingSubscriptionsForSpaceValidateBeforeCall( + spaceId, batchQueryMessagingSubscriptionsForSpaceAlphaInput, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getSpace - * @param spaceId (required) + * + * @param spaceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getSpaceCall(String spaceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSpaceCall(String spaceId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -258,8 +337,11 @@ public okhttp3.Call getSpaceCall(String spaceId, final ApiCallback _callback) th Object localVarPostBody = null; // create path and map variables - String localVarPath = "/spaces/{spaceId}" - .replaceAll("\\{" + "spaceId" + "\\}", localVarApiClient.escapeString(spaceId.toString())); + String localVarPath = + "/spaces/{spaceId}" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -275,46 +357,58 @@ public okhttp3.Call getSpaceCall(String spaceId, final ApiCallback _callback) th localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSpaceValidateBeforeCall(String spaceId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getSpaceValidateBeforeCall(String spaceId, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'spaceId' is set if (spaceId == null) { - throw new ApiException("Missing the required parameter 'spaceId' when calling getSpace(Async)"); + throw new ApiException( + "Missing the required parameter 'spaceId' when calling getSpace(Async)"); } - - - okhttp3.Call localVarCall = getSpaceCall(spaceId, _callback); - return localVarCall; + return getSpaceCall(spaceId, _callback); } /** - * Get Space - * Returns the Space by id. - * @param spaceId (required) + * Get Space Returns the Space by id. • This endpoint is in **Alpha** testing. Please submit any + * feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Spaces feature enabled. Please reach out + * to your customer success manager for more information. + * + * @param spaceId (required) * @return GetSpace200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public GetSpace200Response getSpace(String spaceId) throws ApiException { ApiResponse localVarResp = getSpaceWithHttpInfo(spaceId); @@ -322,74 +416,253 @@ public GetSpace200Response getSpace(String spaceId) throws ApiException { } /** - * Get Space - * Returns the Space by id. - * @param spaceId (required) + * Get Space Returns the Space by id. • This endpoint is in **Alpha** testing. Please submit any + * feedback by sending an email to friends@segment.com. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Spaces feature enabled. Please reach out + * to your customer success manager for more information. + * + * @param spaceId (required) * @return ApiResponse<GetSpace200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getSpaceWithHttpInfo(String spaceId) throws ApiException { + public ApiResponse getSpaceWithHttpInfo(String spaceId) + throws ApiException { okhttp3.Call localVarCall = getSpaceValidateBeforeCall(spaceId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Space (asynchronously) - * Returns the Space by id. - * @param spaceId (required) + * Get Space (asynchronously) Returns the Space by id. • This endpoint is in **Alpha** testing. + * Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Spaces feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param spaceId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getSpaceAsync(String spaceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSpaceAsync( + String spaceId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getSpaceValidateBeforeCall(spaceId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listSpaces + * + * @param pagination Pagination params This parameter exists in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listSpacesCall(PaginationInput pagination, 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 = "/spaces"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pagination != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination", pagination)); + } + + final String[] localVarAccepts = { + "application/vnd.segment.v1alpha+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[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listSpacesValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return listSpacesCall(pagination, _callback); + } + + /** + * List Spaces List Spaces. • This endpoint is in **Alpha** testing. Please submit any feedback + * by sending an email to friends@segment.com. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Spaces feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param pagination Pagination params This parameter exists in alpha. (optional) + * @return ListSpaces200Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ListSpaces200Response listSpaces(PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = listSpacesWithHttpInfo(pagination); + return localVarResp.getData(); + } + + /** + * List Spaces List Spaces. • This endpoint is in **Alpha** testing. Please submit any feedback + * by sending an email to friends@segment.com. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Spaces feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param pagination Pagination params This parameter exists in alpha. (optional) + * @return ApiResponse<ListSpaces200Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public ApiResponse listSpacesWithHttpInfo(PaginationInput pagination) + throws ApiException { + okhttp3.Call localVarCall = listSpacesValidateBeforeCall(pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Spaces (asynchronously) List Spaces. • This endpoint is in **Alpha** testing. Please + * submit any feedback by sending an email to friends@segment.com. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Spaces feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param pagination Pagination params This parameter exists in alpha. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ */ + public okhttp3.Call listSpacesAsync( + PaginationInput pagination, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = listSpacesValidateBeforeCall(pagination, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for replaceMessagingSubscriptionsInSpaces - * @param spaceId (required) - * @param replaceMessagingSubscriptionsInSpacesAlphaInput (required) + * + * @param spaceId (required) + * @param replaceMessagingSubscriptionsInSpacesAlphaInput (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replaceMessagingSubscriptionsInSpacesCall(String spaceId, ReplaceMessagingSubscriptionsInSpacesAlphaInput replaceMessagingSubscriptionsInSpacesAlphaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call replaceMessagingSubscriptionsInSpacesCall( + String spaceId, + ReplaceMessagingSubscriptionsInSpacesAlphaInput + replaceMessagingSubscriptionsInSpacesAlphaInput, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -398,8 +671,11 @@ public okhttp3.Call replaceMessagingSubscriptionsInSpacesCall(String spaceId, Re Object localVarPostBody = replaceMessagingSubscriptionsInSpacesAlphaInput; // create path and map variables - String localVarPath = "/spaces/{spaceId}/messaging-subscriptions" - .replaceAll("\\{" + "spaceId" + "\\}", localVarApiClient.escapeString(spaceId.toString())); + String localVarPath = + "/spaces/{spaceId}/messaging-subscriptions" + .replace( + "{" + "spaceId" + "}", + localVarApiClient.escapeString(spaceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -415,101 +691,188 @@ public okhttp3.Call replaceMessagingSubscriptionsInSpacesCall(String spaceId, Re localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {"application/vnd.segment.v1alpha+json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replaceMessagingSubscriptionsInSpacesValidateBeforeCall(String spaceId, ReplaceMessagingSubscriptionsInSpacesAlphaInput replaceMessagingSubscriptionsInSpacesAlphaInput, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call replaceMessagingSubscriptionsInSpacesValidateBeforeCall( + String spaceId, + ReplaceMessagingSubscriptionsInSpacesAlphaInput + replaceMessagingSubscriptionsInSpacesAlphaInput, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'spaceId' is set if (spaceId == null) { - throw new ApiException("Missing the required parameter 'spaceId' when calling replaceMessagingSubscriptionsInSpaces(Async)"); + throw new ApiException( + "Missing the required parameter 'spaceId' when calling" + + " replaceMessagingSubscriptionsInSpaces(Async)"); } - + // verify the required parameter 'replaceMessagingSubscriptionsInSpacesAlphaInput' is set if (replaceMessagingSubscriptionsInSpacesAlphaInput == null) { - throw new ApiException("Missing the required parameter 'replaceMessagingSubscriptionsInSpacesAlphaInput' when calling replaceMessagingSubscriptionsInSpaces(Async)"); + throw new ApiException( + "Missing the required parameter" + + " 'replaceMessagingSubscriptionsInSpacesAlphaInput' when calling" + + " replaceMessagingSubscriptionsInSpaces(Async)"); } - - - okhttp3.Call localVarCall = replaceMessagingSubscriptionsInSpacesCall(spaceId, replaceMessagingSubscriptionsInSpacesAlphaInput, _callback); - return localVarCall; + return replaceMessagingSubscriptionsInSpacesCall( + spaceId, replaceMessagingSubscriptionsInSpacesAlphaInput, _callback); } /** - * Replace Messaging Subscriptions in Spaces - * Replace Messaging Subscriptions in Spaces. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param spaceId (required) - * @param replaceMessagingSubscriptionsInSpacesAlphaInput (required) + * Replace Messaging Subscriptions in Spaces <div style=\"background-color: + * #fff3cd; border: 1px solid #ffc107; border-radius: 6px; padding: 16px; margin: 16px 0; color: + * #856404; display: flex; align-items: center; gap: 12px; line-height: 1.5;\"> <span + * style=\"color: #ff9800; font-size: 16px; flex-shrink: 0;\">⚠️</span> + * <div style=\"line-height: 1.5;\"> <div style=\"font-weight: + * 600; font-size: 14px; margin-bottom: 6px;\"> Engage Premier features will no longer + * be available after December 15, 2025. </div> <div style=\"font-size: + * 13px;\"> This API will be deactivated after this date. </div> </div> + * </div> Replace Messaging Subscriptions in Spaces. • This endpoint is in **Alpha** + * testing. Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Spaces feature + * enabled. Please reach out to your customer success manager for more information. The rate + * limit for this endpoint is 60 requests per minute, which is lower than the default due to + * access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param replaceMessagingSubscriptionsInSpacesAlphaInput (required) * @return ReplaceMessagingSubscriptionsInSpaces200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ReplaceMessagingSubscriptionsInSpaces200Response replaceMessagingSubscriptionsInSpaces(String spaceId, ReplaceMessagingSubscriptionsInSpacesAlphaInput replaceMessagingSubscriptionsInSpacesAlphaInput) throws ApiException { - ApiResponse localVarResp = replaceMessagingSubscriptionsInSpacesWithHttpInfo(spaceId, replaceMessagingSubscriptionsInSpacesAlphaInput); + public ReplaceMessagingSubscriptionsInSpaces200Response replaceMessagingSubscriptionsInSpaces( + String spaceId, + ReplaceMessagingSubscriptionsInSpacesAlphaInput + replaceMessagingSubscriptionsInSpacesAlphaInput) + throws ApiException { + ApiResponse localVarResp = + replaceMessagingSubscriptionsInSpacesWithHttpInfo( + spaceId, replaceMessagingSubscriptionsInSpacesAlphaInput); return localVarResp.getData(); } /** - * Replace Messaging Subscriptions in Spaces - * Replace Messaging Subscriptions in Spaces. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param spaceId (required) - * @param replaceMessagingSubscriptionsInSpacesAlphaInput (required) + * Replace Messaging Subscriptions in Spaces <div style=\"background-color: + * #fff3cd; border: 1px solid #ffc107; border-radius: 6px; padding: 16px; margin: 16px 0; color: + * #856404; display: flex; align-items: center; gap: 12px; line-height: 1.5;\"> <span + * style=\"color: #ff9800; font-size: 16px; flex-shrink: 0;\">⚠️</span> + * <div style=\"line-height: 1.5;\"> <div style=\"font-weight: + * 600; font-size: 14px; margin-bottom: 6px;\"> Engage Premier features will no longer + * be available after December 15, 2025. </div> <div style=\"font-size: + * 13px;\"> This API will be deactivated after this date. </div> </div> + * </div> Replace Messaging Subscriptions in Spaces. • This endpoint is in **Alpha** + * testing. Please submit any feedback by sending an email to friends@segment.com. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Spaces feature + * enabled. Please reach out to your customer success manager for more information. The rate + * limit for this endpoint is 60 requests per minute, which is lower than the default due to + * access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param replaceMessagingSubscriptionsInSpacesAlphaInput (required) * @return ApiResponse<ReplaceMessagingSubscriptionsInSpaces200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse replaceMessagingSubscriptionsInSpacesWithHttpInfo(String spaceId, ReplaceMessagingSubscriptionsInSpacesAlphaInput replaceMessagingSubscriptionsInSpacesAlphaInput) throws ApiException { - okhttp3.Call localVarCall = replaceMessagingSubscriptionsInSpacesValidateBeforeCall(spaceId, replaceMessagingSubscriptionsInSpacesAlphaInput, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + replaceMessagingSubscriptionsInSpacesWithHttpInfo( + String spaceId, + ReplaceMessagingSubscriptionsInSpacesAlphaInput + replaceMessagingSubscriptionsInSpacesAlphaInput) + throws ApiException { + okhttp3.Call localVarCall = + replaceMessagingSubscriptionsInSpacesValidateBeforeCall( + spaceId, replaceMessagingSubscriptionsInSpacesAlphaInput, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace Messaging Subscriptions in Spaces (asynchronously) - * Replace Messaging Subscriptions in Spaces. The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param spaceId (required) - * @param replaceMessagingSubscriptionsInSpacesAlphaInput (required) + * Replace Messaging Subscriptions in Spaces (asynchronously) <div + * style=\"background-color: #fff3cd; border: 1px solid #ffc107; border-radius: 6px; + * padding: 16px; margin: 16px 0; color: #856404; display: flex; align-items: center; gap: 12px; + * line-height: 1.5;\"> <span style=\"color: #ff9800; font-size: 16px; + * flex-shrink: 0;\">⚠️</span> <div style=\"line-height: + * 1.5;\"> <div style=\"font-weight: 600; font-size: 14px; margin-bottom: + * 6px;\"> Engage Premier features will no longer be available after December 15, 2025. + * </div> <div style=\"font-size: 13px;\"> This API will be + * deactivated after this date. </div> </div> </div> Replace Messaging + * Subscriptions in Spaces. • This endpoint is in **Alpha** testing. Please submit any feedback + * by sending an email to friends@segment.com. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Spaces feature enabled. Please reach out to your + * customer success manager for more information. The rate limit for this endpoint is 60 + * requests per minute, which is lower than the default due to access pattern restrictions. Once + * reached, this endpoint will respond with the 429 HTTP status code with headers indicating the + * limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. + * + * @param spaceId (required) + * @param replaceMessagingSubscriptionsInSpacesAlphaInput (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replaceMessagingSubscriptionsInSpacesAsync(String spaceId, ReplaceMessagingSubscriptionsInSpacesAlphaInput replaceMessagingSubscriptionsInSpacesAlphaInput, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = replaceMessagingSubscriptionsInSpacesValidateBeforeCall(spaceId, replaceMessagingSubscriptionsInSpacesAlphaInput, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call replaceMessagingSubscriptionsInSpacesAsync( + String spaceId, + ReplaceMessagingSubscriptionsInSpacesAlphaInput + replaceMessagingSubscriptionsInSpacesAlphaInput, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + replaceMessagingSubscriptionsInSpacesValidateBeforeCall( + spaceId, replaceMessagingSubscriptionsInSpacesAlphaInput, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/TestingApi.java b/src/main/java/com/segment/publicapi/api/TestingApi.java index d8c5f709..d2deb0ec 100644 --- a/src/main/java/com/segment/publicapi/api/TestingApi.java +++ b/src/main/java/com/segment/publicapi/api/TestingApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,34 +9,22 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import java.math.BigDecimal; import com.segment.publicapi.models.Echo200Response; -import com.segment.publicapi.models.Echo200Response1; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class TestingApi { private ApiClient localVarApiClient; @@ -78,33 +65,51 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for echo - * @param message Sets the response `message` field. The response contains this field's entry. This parameter exists in v1. (required) - * @param delay The desired response delay, in milliseconds. This parameter exists in v1. (optional) - * @param triggerError If `true`, returns an HTTP `4xx` error that contains the string in `message`. This parameter exists in v1. (optional) - * @param triggerMultipleErrors If `true`, returns an HTTP `4xx` error that contains the value of the `message` field in the error message array. This has no effect if the request sets `triggerError`. This parameter exists in v1. (optional) - * @param triggerUnexpectedError If `true`, triggers a `500` error. This has no effect if the request sets either `triggerError` or `triggerMultipleErrors`. This parameter exists in v1. (optional) - * @param statusCode Sets the HTTP status code to return. This parameter exists in v1. (optional) + * + * @param message Sets the response `message` field. The response contains this + * field's entry. This parameter exists in alpha. (required) + * @param delay The desired response delay, in milliseconds. This parameter exists in alpha. + * (optional) + * @param triggerError If `true`, returns an HTTP `4xx` error that contains + * the string in `message`. This parameter exists in alpha. (optional) + * @param triggerMultipleErrors If `true`, returns an HTTP `4xx` error that + * contains the value of the `message` field in the error message array. This has + * no effect if the request sets `triggerError`. This parameter exists in alpha. + * (optional) + * @param triggerUnexpectedError If `true`, triggers a `500` error. This has + * no effect if the request sets either `triggerError` or + * `triggerMultipleErrors`. This parameter exists in alpha. (optional) + * @param statusCode Sets the HTTP status code to return. This parameter exists in alpha. + * (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call echoCall(String message, BigDecimal delay, Boolean triggerError, Boolean triggerMultipleErrors, Boolean triggerUnexpectedError, BigDecimal statusCode, final ApiCallback _callback) throws ApiException { + public okhttp3.Call echoCall( + String message, + BigDecimal delay, + Boolean triggerError, + Boolean triggerMultipleErrors, + Boolean triggerUnexpectedError, + BigDecimal statusCode, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -130,15 +135,20 @@ public okhttp3.Call echoCall(String message, BigDecimal delay, Boolean triggerEr } if (triggerError != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("triggerError", triggerError)); + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("triggerError", triggerError)); } if (triggerMultipleErrors != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("triggerMultipleErrors", triggerMultipleErrors)); + localVarQueryParams.addAll( + localVarApiClient.parameterToPair( + "triggerMultipleErrors", triggerMultipleErrors)); } if (triggerUnexpectedError != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("triggerUnexpectedError", triggerUnexpectedError)); + localVarQueryParams.addAll( + localVarApiClient.parameterToPair( + "triggerUnexpectedError", triggerUnexpectedError)); } if (statusCode != null) { @@ -146,115 +156,214 @@ public okhttp3.Call echoCall(String message, BigDecimal delay, Boolean triggerEr } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call echoValidateBeforeCall(String message, BigDecimal delay, Boolean triggerError, Boolean triggerMultipleErrors, Boolean triggerUnexpectedError, BigDecimal statusCode, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call echoValidateBeforeCall( + String message, + BigDecimal delay, + Boolean triggerError, + Boolean triggerMultipleErrors, + Boolean triggerUnexpectedError, + BigDecimal statusCode, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'message' is set if (message == null) { - throw new ApiException("Missing the required parameter 'message' when calling echo(Async)"); + throw new ApiException( + "Missing the required parameter 'message' when calling echo(Async)"); } - - - okhttp3.Call localVarCall = echoCall(message, delay, triggerError, triggerMultipleErrors, triggerUnexpectedError, statusCode, _callback); - return localVarCall; + return echoCall( + message, + delay, + triggerError, + triggerMultipleErrors, + triggerUnexpectedError, + statusCode, + _callback); } /** - * Echo - * Public Echo endpoint. - * @param message Sets the response `message` field. The response contains this field's entry. This parameter exists in v1. (required) - * @param delay The desired response delay, in milliseconds. This parameter exists in v1. (optional) - * @param triggerError If `true`, returns an HTTP `4xx` error that contains the string in `message`. This parameter exists in v1. (optional) - * @param triggerMultipleErrors If `true`, returns an HTTP `4xx` error that contains the value of the `message` field in the error message array. This has no effect if the request sets `triggerError`. This parameter exists in v1. (optional) - * @param triggerUnexpectedError If `true`, triggers a `500` error. This has no effect if the request sets either `triggerError` or `triggerMultipleErrors`. This parameter exists in v1. (optional) - * @param statusCode Sets the HTTP status code to return. This parameter exists in v1. (optional) + * Echo Public Echo endpoint. + * + * @param message Sets the response `message` field. The response contains this + * field's entry. This parameter exists in alpha. (required) + * @param delay The desired response delay, in milliseconds. This parameter exists in alpha. + * (optional) + * @param triggerError If `true`, returns an HTTP `4xx` error that contains + * the string in `message`. This parameter exists in alpha. (optional) + * @param triggerMultipleErrors If `true`, returns an HTTP `4xx` error that + * contains the value of the `message` field in the error message array. This has + * no effect if the request sets `triggerError`. This parameter exists in alpha. + * (optional) + * @param triggerUnexpectedError If `true`, triggers a `500` error. This has + * no effect if the request sets either `triggerError` or + * `triggerMultipleErrors`. This parameter exists in alpha. (optional) + * @param statusCode Sets the HTTP status code to return. This parameter exists in alpha. + * (optional) * @return Echo200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public Echo200Response echo(String message, BigDecimal delay, Boolean triggerError, Boolean triggerMultipleErrors, Boolean triggerUnexpectedError, BigDecimal statusCode) throws ApiException { - ApiResponse localVarResp = echoWithHttpInfo(message, delay, triggerError, triggerMultipleErrors, triggerUnexpectedError, statusCode); + public Echo200Response echo( + String message, + BigDecimal delay, + Boolean triggerError, + Boolean triggerMultipleErrors, + Boolean triggerUnexpectedError, + BigDecimal statusCode) + throws ApiException { + ApiResponse localVarResp = + echoWithHttpInfo( + message, + delay, + triggerError, + triggerMultipleErrors, + triggerUnexpectedError, + statusCode); return localVarResp.getData(); } /** - * Echo - * Public Echo endpoint. - * @param message Sets the response `message` field. The response contains this field's entry. This parameter exists in v1. (required) - * @param delay The desired response delay, in milliseconds. This parameter exists in v1. (optional) - * @param triggerError If `true`, returns an HTTP `4xx` error that contains the string in `message`. This parameter exists in v1. (optional) - * @param triggerMultipleErrors If `true`, returns an HTTP `4xx` error that contains the value of the `message` field in the error message array. This has no effect if the request sets `triggerError`. This parameter exists in v1. (optional) - * @param triggerUnexpectedError If `true`, triggers a `500` error. This has no effect if the request sets either `triggerError` or `triggerMultipleErrors`. This parameter exists in v1. (optional) - * @param statusCode Sets the HTTP status code to return. This parameter exists in v1. (optional) + * Echo Public Echo endpoint. + * + * @param message Sets the response `message` field. The response contains this + * field's entry. This parameter exists in alpha. (required) + * @param delay The desired response delay, in milliseconds. This parameter exists in alpha. + * (optional) + * @param triggerError If `true`, returns an HTTP `4xx` error that contains + * the string in `message`. This parameter exists in alpha. (optional) + * @param triggerMultipleErrors If `true`, returns an HTTP `4xx` error that + * contains the value of the `message` field in the error message array. This has + * no effect if the request sets `triggerError`. This parameter exists in alpha. + * (optional) + * @param triggerUnexpectedError If `true`, triggers a `500` error. This has + * no effect if the request sets either `triggerError` or + * `triggerMultipleErrors`. This parameter exists in alpha. (optional) + * @param statusCode Sets the HTTP status code to return. This parameter exists in alpha. + * (optional) * @return ApiResponse<Echo200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse echoWithHttpInfo(String message, BigDecimal delay, Boolean triggerError, Boolean triggerMultipleErrors, Boolean triggerUnexpectedError, BigDecimal statusCode) throws ApiException { - okhttp3.Call localVarCall = echoValidateBeforeCall(message, delay, triggerError, triggerMultipleErrors, triggerUnexpectedError, statusCode, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse echoWithHttpInfo( + String message, + BigDecimal delay, + Boolean triggerError, + Boolean triggerMultipleErrors, + Boolean triggerUnexpectedError, + BigDecimal statusCode) + throws ApiException { + okhttp3.Call localVarCall = + echoValidateBeforeCall( + message, + delay, + triggerError, + triggerMultipleErrors, + triggerUnexpectedError, + statusCode, + null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Echo (asynchronously) - * Public Echo endpoint. - * @param message Sets the response `message` field. The response contains this field's entry. This parameter exists in v1. (required) - * @param delay The desired response delay, in milliseconds. This parameter exists in v1. (optional) - * @param triggerError If `true`, returns an HTTP `4xx` error that contains the string in `message`. This parameter exists in v1. (optional) - * @param triggerMultipleErrors If `true`, returns an HTTP `4xx` error that contains the value of the `message` field in the error message array. This has no effect if the request sets `triggerError`. This parameter exists in v1. (optional) - * @param triggerUnexpectedError If `true`, triggers a `500` error. This has no effect if the request sets either `triggerError` or `triggerMultipleErrors`. This parameter exists in v1. (optional) - * @param statusCode Sets the HTTP status code to return. This parameter exists in v1. (optional) + * Echo (asynchronously) Public Echo endpoint. + * + * @param message Sets the response `message` field. The response contains this + * field's entry. This parameter exists in alpha. (required) + * @param delay The desired response delay, in milliseconds. This parameter exists in alpha. + * (optional) + * @param triggerError If `true`, returns an HTTP `4xx` error that contains + * the string in `message`. This parameter exists in alpha. (optional) + * @param triggerMultipleErrors If `true`, returns an HTTP `4xx` error that + * contains the value of the `message` field in the error message array. This has + * no effect if the request sets `triggerError`. This parameter exists in alpha. + * (optional) + * @param triggerUnexpectedError If `true`, triggers a `500` error. This has + * no effect if the request sets either `triggerError` or + * `triggerMultipleErrors`. This parameter exists in alpha. (optional) + * @param statusCode Sets the HTTP status code to return. This parameter exists in alpha. + * (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call echoAsync(String message, BigDecimal delay, Boolean triggerError, Boolean triggerMultipleErrors, Boolean triggerUnexpectedError, BigDecimal statusCode, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = echoValidateBeforeCall(message, delay, triggerError, triggerMultipleErrors, triggerUnexpectedError, statusCode, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call echoAsync( + String message, + BigDecimal delay, + Boolean triggerError, + Boolean triggerMultipleErrors, + Boolean triggerUnexpectedError, + BigDecimal statusCode, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + echoValidateBeforeCall( + message, + delay, + triggerError, + triggerMultipleErrors, + triggerUnexpectedError, + statusCode, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/TrackingPlansApi.java b/src/main/java/com/segment/publicapi/api/TrackingPlansApi.java index 67e8fd2f..e8e8afcf 100644 --- a/src/main/java/com/segment/publicapi/api/TrackingPlansApi.java +++ b/src/main/java/com/segment/publicapi/api/TrackingPlansApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,23 +9,15 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.AddSourceToTrackingPlan200Response; import com.segment.publicapi.models.AddSourceToTrackingPlanV1Input; import com.segment.publicapi.models.CreateTrackingPlan200Response; @@ -42,18 +33,15 @@ import com.segment.publicapi.models.RemoveSourceFromTrackingPlan200Response; import com.segment.publicapi.models.ReplaceRulesInTrackingPlan200Response; import com.segment.publicapi.models.ReplaceRulesInTrackingPlanV1Input; -import com.segment.publicapi.models.RequestErrorEnvelope; import com.segment.publicapi.models.UpdateRulesInTrackingPlan200Response; import com.segment.publicapi.models.UpdateRulesInTrackingPlanV1Input; import com.segment.publicapi.models.UpdateTrackingPlan200Response; import com.segment.publicapi.models.UpdateTrackingPlanV1Input; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class TrackingPlansApi { private ApiClient localVarApiClient; @@ -94,29 +82,34 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for addSourceToTrackingPlan - * @param trackingPlanId (required) - * @param addSourceToTrackingPlanV1Input (required) + * + * @param trackingPlanId (required) + * @param addSourceToTrackingPlanV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call addSourceToTrackingPlanCall(String trackingPlanId, AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call addSourceToTrackingPlanCall( + String trackingPlanId, + AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -125,8 +118,11 @@ public okhttp3.Call addSourceToTrackingPlanCall(String trackingPlanId, AddSource Object localVarPostBody = addSourceToTrackingPlanV1Input; // create path and map variables - String localVarPath = "/tracking-plans/{trackingPlanId}/sources" - .replaceAll("\\{" + "trackingPlanId" + "\\}", localVarApiClient.escapeString(trackingPlanId.toString())); + String localVarPath = + "/tracking-plans/{trackingPlanId}/sources" + .replace( + "{" + "trackingPlanId" + "}", + localVarApiClient.escapeString(trackingPlanId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -135,7 +131,10 @@ public okhttp3.Call addSourceToTrackingPlanCall(String trackingPlanId, AddSource Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -143,127 +142,179 @@ public okhttp3.Call addSourceToTrackingPlanCall(String trackingPlanId, AddSource } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call addSourceToTrackingPlanValidateBeforeCall(String trackingPlanId, AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call addSourceToTrackingPlanValidateBeforeCall( + String trackingPlanId, + AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'trackingPlanId' is set if (trackingPlanId == null) { - throw new ApiException("Missing the required parameter 'trackingPlanId' when calling addSourceToTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'trackingPlanId' when calling" + + " addSourceToTrackingPlan(Async)"); } - + // verify the required parameter 'addSourceToTrackingPlanV1Input' is set if (addSourceToTrackingPlanV1Input == null) { - throw new ApiException("Missing the required parameter 'addSourceToTrackingPlanV1Input' when calling addSourceToTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'addSourceToTrackingPlanV1Input' when calling" + + " addSourceToTrackingPlan(Async)"); } - - - okhttp3.Call localVarCall = addSourceToTrackingPlanCall(trackingPlanId, addSourceToTrackingPlanV1Input, _callback); - return localVarCall; + return addSourceToTrackingPlanCall( + trackingPlanId, addSourceToTrackingPlanV1Input, _callback); } /** - * Add Source to Tracking Plan - * Connects a Source to a Tracking Plan. When called, this endpoint may generate the `Source Modified` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param addSourceToTrackingPlanV1Input (required) + * Add Source to Tracking Plan Connects a Source to a Tracking Plan. • When called, this + * endpoint may generate the `Source Modified` event in the [audit + * trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified + * Workspace needs to have the Protocols feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param trackingPlanId (required) + * @param addSourceToTrackingPlanV1Input (required) * @return AddSourceToTrackingPlan200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public AddSourceToTrackingPlan200Response addSourceToTrackingPlan(String trackingPlanId, AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input) throws ApiException { - ApiResponse localVarResp = addSourceToTrackingPlanWithHttpInfo(trackingPlanId, addSourceToTrackingPlanV1Input); + public AddSourceToTrackingPlan200Response addSourceToTrackingPlan( + String trackingPlanId, AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input) + throws ApiException { + ApiResponse localVarResp = + addSourceToTrackingPlanWithHttpInfo(trackingPlanId, addSourceToTrackingPlanV1Input); return localVarResp.getData(); } /** - * Add Source to Tracking Plan - * Connects a Source to a Tracking Plan. When called, this endpoint may generate the `Source Modified` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param addSourceToTrackingPlanV1Input (required) + * Add Source to Tracking Plan Connects a Source to a Tracking Plan. • When called, this + * endpoint may generate the `Source Modified` event in the [audit + * trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified + * Workspace needs to have the Protocols feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param trackingPlanId (required) + * @param addSourceToTrackingPlanV1Input (required) * @return ApiResponse<AddSourceToTrackingPlan200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse addSourceToTrackingPlanWithHttpInfo(String trackingPlanId, AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input) throws ApiException { - okhttp3.Call localVarCall = addSourceToTrackingPlanValidateBeforeCall(trackingPlanId, addSourceToTrackingPlanV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse addSourceToTrackingPlanWithHttpInfo( + String trackingPlanId, AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input) + throws ApiException { + okhttp3.Call localVarCall = + addSourceToTrackingPlanValidateBeforeCall( + trackingPlanId, addSourceToTrackingPlanV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Add Source to Tracking Plan (asynchronously) - * Connects a Source to a Tracking Plan. When called, this endpoint may generate the `Source Modified` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param addSourceToTrackingPlanV1Input (required) + * Add Source to Tracking Plan (asynchronously) Connects a Source to a Tracking Plan. • When + * called, this endpoint may generate the `Source Modified` event in the [audit + * trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified + * Workspace needs to have the Protocols feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param trackingPlanId (required) + * @param addSourceToTrackingPlanV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call addSourceToTrackingPlanAsync(String trackingPlanId, AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = addSourceToTrackingPlanValidateBeforeCall(trackingPlanId, addSourceToTrackingPlanV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call addSourceToTrackingPlanAsync( + String trackingPlanId, + AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addSourceToTrackingPlanValidateBeforeCall( + trackingPlanId, addSourceToTrackingPlanV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for createTrackingPlan - * @param createTrackingPlanV1Input (required) + * + * @param createTrackingPlanV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createTrackingPlanCall(CreateTrackingPlanV1Input createTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createTrackingPlanCall( + CreateTrackingPlanV1Input createTrackingPlanV1Input, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -281,7 +332,10 @@ public okhttp3.Call createTrackingPlanCall(CreateTrackingPlanV1Input createTrack Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -289,119 +343,154 @@ public okhttp3.Call createTrackingPlanCall(CreateTrackingPlanV1Input createTrack } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createTrackingPlanValidateBeforeCall(CreateTrackingPlanV1Input createTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createTrackingPlanValidateBeforeCall( + CreateTrackingPlanV1Input createTrackingPlanV1Input, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'createTrackingPlanV1Input' is set if (createTrackingPlanV1Input == null) { - throw new ApiException("Missing the required parameter 'createTrackingPlanV1Input' when calling createTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'createTrackingPlanV1Input' when calling" + + " createTrackingPlan(Async)"); } - - - okhttp3.Call localVarCall = createTrackingPlanCall(createTrackingPlanV1Input, _callback); - return localVarCall; + return createTrackingPlanCall(createTrackingPlanV1Input, _callback); } /** - * Create Tracking Plan - * Creates a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param createTrackingPlanV1Input (required) + * Create Tracking Plan Creates a Tracking Plan. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Protocols feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param createTrackingPlanV1Input (required) * @return CreateTrackingPlan200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateTrackingPlan200Response createTrackingPlan(CreateTrackingPlanV1Input createTrackingPlanV1Input) throws ApiException { - ApiResponse localVarResp = createTrackingPlanWithHttpInfo(createTrackingPlanV1Input); + public CreateTrackingPlan200Response createTrackingPlan( + CreateTrackingPlanV1Input createTrackingPlanV1Input) throws ApiException { + ApiResponse localVarResp = + createTrackingPlanWithHttpInfo(createTrackingPlanV1Input); return localVarResp.getData(); } /** - * Create Tracking Plan - * Creates a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param createTrackingPlanV1Input (required) + * Create Tracking Plan Creates a Tracking Plan. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Protocols feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param createTrackingPlanV1Input (required) * @return ApiResponse<CreateTrackingPlan200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createTrackingPlanWithHttpInfo(CreateTrackingPlanV1Input createTrackingPlanV1Input) throws ApiException { - okhttp3.Call localVarCall = createTrackingPlanValidateBeforeCall(createTrackingPlanV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse createTrackingPlanWithHttpInfo( + CreateTrackingPlanV1Input createTrackingPlanV1Input) throws ApiException { + okhttp3.Call localVarCall = + createTrackingPlanValidateBeforeCall(createTrackingPlanV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Tracking Plan (asynchronously) - * Creates a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param createTrackingPlanV1Input (required) + * Create Tracking Plan (asynchronously) Creates a Tracking Plan. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Protocols feature enabled. + * Please reach out to your customer success manager for more information. + * + * @param createTrackingPlanV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createTrackingPlanAsync(CreateTrackingPlanV1Input createTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createTrackingPlanValidateBeforeCall(createTrackingPlanV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createTrackingPlanAsync( + CreateTrackingPlanV1Input createTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createTrackingPlanValidateBeforeCall(createTrackingPlanV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for deleteTrackingPlan - * @param trackingPlanId (required) + * + * @param trackingPlanId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteTrackingPlanCall(String trackingPlanId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteTrackingPlanCall(String trackingPlanId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -410,8 +499,11 @@ public okhttp3.Call deleteTrackingPlanCall(String trackingPlanId, final ApiCallb Object localVarPostBody = null; // create path and map variables - String localVarPath = "/tracking-plans/{trackingPlanId}" - .replaceAll("\\{" + "trackingPlanId" + "\\}", localVarApiClient.escapeString(trackingPlanId.toString())); + String localVarPath = + "/tracking-plans/{trackingPlanId}" + .replace( + "{" + "trackingPlanId" + "}", + localVarApiClient.escapeString(trackingPlanId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -420,127 +512,156 @@ public okhttp3.Call deleteTrackingPlanCall(String trackingPlanId, final ApiCallb Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteTrackingPlanValidateBeforeCall(String trackingPlanId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call deleteTrackingPlanValidateBeforeCall( + String trackingPlanId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'trackingPlanId' is set if (trackingPlanId == null) { - throw new ApiException("Missing the required parameter 'trackingPlanId' when calling deleteTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'trackingPlanId' when calling" + + " deleteTrackingPlan(Async)"); } - - - okhttp3.Call localVarCall = deleteTrackingPlanCall(trackingPlanId, _callback); - return localVarCall; + return deleteTrackingPlanCall(trackingPlanId, _callback); } /** - * Delete Tracking Plan - * Deletes a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) + * Delete Tracking Plan Deletes a Tracking Plan. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Protocols feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param trackingPlanId (required) * @return DeleteTrackingPlan200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public DeleteTrackingPlan200Response deleteTrackingPlan(String trackingPlanId) throws ApiException { - ApiResponse localVarResp = deleteTrackingPlanWithHttpInfo(trackingPlanId); + public DeleteTrackingPlan200Response deleteTrackingPlan(String trackingPlanId) + throws ApiException { + ApiResponse localVarResp = + deleteTrackingPlanWithHttpInfo(trackingPlanId); return localVarResp.getData(); } /** - * Delete Tracking Plan - * Deletes a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) + * Delete Tracking Plan Deletes a Tracking Plan. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Protocols feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param trackingPlanId (required) * @return ApiResponse<DeleteTrackingPlan200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse deleteTrackingPlanWithHttpInfo(String trackingPlanId) throws ApiException { + public ApiResponse deleteTrackingPlanWithHttpInfo( + String trackingPlanId) throws ApiException { okhttp3.Call localVarCall = deleteTrackingPlanValidateBeforeCall(trackingPlanId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Delete Tracking Plan (asynchronously) - * Deletes a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) + * Delete Tracking Plan (asynchronously) Deletes a Tracking Plan. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Protocols feature enabled. + * Please reach out to your customer success manager for more information. + * + * @param trackingPlanId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteTrackingPlanAsync(String trackingPlanId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteTrackingPlanAsync( + String trackingPlanId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = deleteTrackingPlanValidateBeforeCall(trackingPlanId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getTrackingPlan - * @param trackingPlanId (required) + * + * @param trackingPlanId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getTrackingPlanCall(String trackingPlanId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getTrackingPlanCall(String trackingPlanId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -549,8 +670,11 @@ public okhttp3.Call getTrackingPlanCall(String trackingPlanId, final ApiCallback Object localVarPostBody = null; // create path and map variables - String localVarPath = "/tracking-plans/{trackingPlanId}" - .replaceAll("\\{" + "trackingPlanId" + "\\}", localVarApiClient.escapeString(trackingPlanId.toString())); + String localVarPath = + "/tracking-plans/{trackingPlanId}" + .replace( + "{" + "trackingPlanId" + "}", + localVarApiClient.escapeString(trackingPlanId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -559,128 +683,157 @@ public okhttp3.Call getTrackingPlanCall(String trackingPlanId, final ApiCallback Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getTrackingPlanValidateBeforeCall(String trackingPlanId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getTrackingPlanValidateBeforeCall( + String trackingPlanId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'trackingPlanId' is set if (trackingPlanId == null) { - throw new ApiException("Missing the required parameter 'trackingPlanId' when calling getTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'trackingPlanId' when calling" + + " getTrackingPlan(Async)"); } - - - okhttp3.Call localVarCall = getTrackingPlanCall(trackingPlanId, _callback); - return localVarCall; + return getTrackingPlanCall(trackingPlanId, _callback); } /** - * Get Tracking Plan - * Returns a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) + * Get Tracking Plan Returns a Tracking Plan. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Protocols feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param trackingPlanId (required) * @return GetTrackingPlan200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public GetTrackingPlan200Response getTrackingPlan(String trackingPlanId) throws ApiException { - ApiResponse localVarResp = getTrackingPlanWithHttpInfo(trackingPlanId); + ApiResponse localVarResp = + getTrackingPlanWithHttpInfo(trackingPlanId); return localVarResp.getData(); } /** - * Get Tracking Plan - * Returns a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) + * Get Tracking Plan Returns a Tracking Plan. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Protocols feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param trackingPlanId (required) * @return ApiResponse<GetTrackingPlan200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getTrackingPlanWithHttpInfo(String trackingPlanId) throws ApiException { + public ApiResponse getTrackingPlanWithHttpInfo( + String trackingPlanId) throws ApiException { okhttp3.Call localVarCall = getTrackingPlanValidateBeforeCall(trackingPlanId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Tracking Plan (asynchronously) - * Returns a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) + * Get Tracking Plan (asynchronously) Returns a Tracking Plan. • In order to successfully call + * this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param trackingPlanId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getTrackingPlanAsync(String trackingPlanId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getTrackingPlanAsync( + String trackingPlanId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = getTrackingPlanValidateBeforeCall(trackingPlanId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listRulesFromTrackingPlan - * @param trackingPlanId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * + * @param trackingPlanId (required) + * @param pagination Pagination options. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listRulesFromTrackingPlanCall(String trackingPlanId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listRulesFromTrackingPlanCall( + String trackingPlanId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -689,8 +842,11 @@ public okhttp3.Call listRulesFromTrackingPlanCall(String trackingPlanId, Paginat Object localVarPostBody = null; // create path and map variables - String localVarPath = "/tracking-plans/{trackingPlanId}/rules" - .replaceAll("\\{" + "trackingPlanId" + "\\}", localVarApiClient.escapeString(trackingPlanId.toString())); + String localVarPath = + "/tracking-plans/{trackingPlanId}/rules" + .replace( + "{" + "trackingPlanId" + "}", + localVarApiClient.escapeString(trackingPlanId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -703,136 +859,180 @@ public okhttp3.Call listRulesFromTrackingPlanCall(String trackingPlanId, Paginat } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listRulesFromTrackingPlanValidateBeforeCall(String trackingPlanId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listRulesFromTrackingPlanValidateBeforeCall( + String trackingPlanId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'trackingPlanId' is set if (trackingPlanId == null) { - throw new ApiException("Missing the required parameter 'trackingPlanId' when calling listRulesFromTrackingPlan(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listRulesFromTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'trackingPlanId' when calling" + + " listRulesFromTrackingPlan(Async)"); } - - - okhttp3.Call localVarCall = listRulesFromTrackingPlanCall(trackingPlanId, pagination, _callback); - return localVarCall; + return listRulesFromTrackingPlanCall(trackingPlanId, pagination, _callback); } /** - * List Rules from Tracking Plan - * Lists Tracking Plan rules. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 20 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param trackingPlanId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Rules from Tracking Plan Lists Tracking Plan rules. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach + * out to your customer success manager for more information. The rate limit for this endpoint + * is 200 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param trackingPlanId (required) + * @param pagination Pagination options. This parameter exists in v1. (optional) * @return ListRulesFromTrackingPlan200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListRulesFromTrackingPlan200Response listRulesFromTrackingPlan(String trackingPlanId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listRulesFromTrackingPlanWithHttpInfo(trackingPlanId, pagination); + public ListRulesFromTrackingPlan200Response listRulesFromTrackingPlan( + String trackingPlanId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listRulesFromTrackingPlanWithHttpInfo(trackingPlanId, pagination); return localVarResp.getData(); } /** - * List Rules from Tracking Plan - * Lists Tracking Plan rules. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 20 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param trackingPlanId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Rules from Tracking Plan Lists Tracking Plan rules. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach + * out to your customer success manager for more information. The rate limit for this endpoint + * is 200 requests per minute, which is lower than the default due to access pattern + * restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with + * headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more + * information. + * + * @param trackingPlanId (required) + * @param pagination Pagination options. This parameter exists in v1. (optional) * @return ApiResponse<ListRulesFromTrackingPlan200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listRulesFromTrackingPlanWithHttpInfo(String trackingPlanId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listRulesFromTrackingPlanValidateBeforeCall(trackingPlanId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse listRulesFromTrackingPlanWithHttpInfo( + String trackingPlanId, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + listRulesFromTrackingPlanValidateBeforeCall(trackingPlanId, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Rules from Tracking Plan (asynchronously) - * Lists Tracking Plan rules. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. The rate limit for this endpoint is 20 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param trackingPlanId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Rules from Tracking Plan (asynchronously) Lists Tracking Plan rules. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Protocols feature + * enabled. Please reach out to your customer success manager for more information. The rate + * limit for this endpoint is 200 requests per minute, which is lower than the default due to + * access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param trackingPlanId (required) + * @param pagination Pagination options. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listRulesFromTrackingPlanAsync(String trackingPlanId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listRulesFromTrackingPlanValidateBeforeCall(trackingPlanId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listRulesFromTrackingPlanAsync( + String trackingPlanId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listRulesFromTrackingPlanValidateBeforeCall(trackingPlanId, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listSourcesFromTrackingPlan - * @param trackingPlanId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * + * @param trackingPlanId (required) + * @param pagination Pagination options. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSourcesFromTrackingPlanCall(String trackingPlanId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listSourcesFromTrackingPlanCall( + String trackingPlanId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -841,8 +1041,11 @@ public okhttp3.Call listSourcesFromTrackingPlanCall(String trackingPlanId, Pagin Object localVarPostBody = null; // create path and map variables - String localVarPath = "/tracking-plans/{trackingPlanId}/sources" - .replaceAll("\\{" + "trackingPlanId" + "\\}", localVarApiClient.escapeString(trackingPlanId.toString())); + String localVarPath = + "/tracking-plans/{trackingPlanId}/sources" + .replace( + "{" + "trackingPlanId" + "}", + localVarApiClient.escapeString(trackingPlanId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -855,136 +1058,177 @@ public okhttp3.Call listSourcesFromTrackingPlanCall(String trackingPlanId, Pagin } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listSourcesFromTrackingPlanValidateBeforeCall(String trackingPlanId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listSourcesFromTrackingPlanValidateBeforeCall( + String trackingPlanId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'trackingPlanId' is set if (trackingPlanId == null) { - throw new ApiException("Missing the required parameter 'trackingPlanId' when calling listSourcesFromTrackingPlan(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listSourcesFromTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'trackingPlanId' when calling" + + " listSourcesFromTrackingPlan(Async)"); } - - - okhttp3.Call localVarCall = listSourcesFromTrackingPlanCall(trackingPlanId, pagination, _callback); - return localVarCall; + return listSourcesFromTrackingPlanCall(trackingPlanId, pagination, _callback); } /** - * List Sources from Tracking Plan - * Lists Sources connected to a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. This endpoint requires the user to have at least the following permission(s): * Source Read-only * Tracking Plan Read-only - * @param trackingPlanId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Sources from Tracking Plan Lists Sources connected to a Tracking Plan. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Protocols feature + * enabled. Please reach out to your customer success manager for more information. This + * endpoint requires the user to have at least the following permission(s): * Source Read-only * + * Tracking Plan Read-only + * + * @param trackingPlanId (required) + * @param pagination Pagination options. This parameter exists in v1. (optional) * @return ListSourcesFromTrackingPlan200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListSourcesFromTrackingPlan200Response listSourcesFromTrackingPlan(String trackingPlanId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listSourcesFromTrackingPlanWithHttpInfo(trackingPlanId, pagination); + public ListSourcesFromTrackingPlan200Response listSourcesFromTrackingPlan( + String trackingPlanId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listSourcesFromTrackingPlanWithHttpInfo(trackingPlanId, pagination); return localVarResp.getData(); } /** - * List Sources from Tracking Plan - * Lists Sources connected to a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. This endpoint requires the user to have at least the following permission(s): * Source Read-only * Tracking Plan Read-only - * @param trackingPlanId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Sources from Tracking Plan Lists Sources connected to a Tracking Plan. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Protocols feature + * enabled. Please reach out to your customer success manager for more information. This + * endpoint requires the user to have at least the following permission(s): * Source Read-only * + * Tracking Plan Read-only + * + * @param trackingPlanId (required) + * @param pagination Pagination options. This parameter exists in v1. (optional) * @return ApiResponse<ListSourcesFromTrackingPlan200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listSourcesFromTrackingPlanWithHttpInfo(String trackingPlanId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listSourcesFromTrackingPlanValidateBeforeCall(trackingPlanId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + listSourcesFromTrackingPlanWithHttpInfo( + String trackingPlanId, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + listSourcesFromTrackingPlanValidateBeforeCall(trackingPlanId, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Sources from Tracking Plan (asynchronously) - * Lists Sources connected to a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. This endpoint requires the user to have at least the following permission(s): * Source Read-only * Tracking Plan Read-only - * @param trackingPlanId (required) - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Sources from Tracking Plan (asynchronously) Lists Sources connected to a Tracking Plan. + * • In order to successfully call this endpoint, the specified Workspace needs to have the + * Protocols feature enabled. Please reach out to your customer success manager for more + * information. This endpoint requires the user to have at least the following permission(s): * + * Source Read-only * Tracking Plan Read-only + * + * @param trackingPlanId (required) + * @param pagination Pagination options. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listSourcesFromTrackingPlanAsync(String trackingPlanId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listSourcesFromTrackingPlanValidateBeforeCall(trackingPlanId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listSourcesFromTrackingPlanAsync( + String trackingPlanId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSourcesFromTrackingPlanValidateBeforeCall( + trackingPlanId, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listTrackingPlans - * @param pagination Pagination options. This parameter exists in alpha. (required) - * @param type Requests Tracking Plans of a certain type. If omitted, lists all types. This parameter exists in alpha. (optional) + * + * @param type Requests Tracking Plans of a certain type. If omitted, lists all types. This + * parameter exists in v1. (optional) + * @param pagination Pagination options. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listTrackingPlansCall(PaginationInput pagination, String type, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listTrackingPlansCall( + String type, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1010,131 +1254,161 @@ public okhttp3.Call listTrackingPlansCall(PaginationInput pagination, String typ } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listTrackingPlansValidateBeforeCall(PaginationInput pagination, String type, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listTrackingPlans(Async)"); - } - - - okhttp3.Call localVarCall = listTrackingPlansCall(pagination, type, _callback); - return localVarCall; - + private okhttp3.Call listTrackingPlansValidateBeforeCall( + String type, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { + return listTrackingPlansCall(type, pagination, _callback); } /** - * List Tracking Plans - * Returns a list of Tracking Plans. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param pagination Pagination options. This parameter exists in alpha. (required) - * @param type Requests Tracking Plans of a certain type. If omitted, lists all types. This parameter exists in alpha. (optional) + * List Tracking Plans Returns a list of Tracking Plans. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach + * out to your customer success manager for more information. + * + * @param type Requests Tracking Plans of a certain type. If omitted, lists all types. This + * parameter exists in v1. (optional) + * @param pagination Pagination options. This parameter exists in v1. (optional) * @return ListTrackingPlans200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListTrackingPlans200Response listTrackingPlans(PaginationInput pagination, String type) throws ApiException { - ApiResponse localVarResp = listTrackingPlansWithHttpInfo(pagination, type); + public ListTrackingPlans200Response listTrackingPlans(String type, PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listTrackingPlansWithHttpInfo(type, pagination); return localVarResp.getData(); } /** - * List Tracking Plans - * Returns a list of Tracking Plans. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param pagination Pagination options. This parameter exists in alpha. (required) - * @param type Requests Tracking Plans of a certain type. If omitted, lists all types. This parameter exists in alpha. (optional) + * List Tracking Plans Returns a list of Tracking Plans. • In order to successfully call this + * endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach + * out to your customer success manager for more information. + * + * @param type Requests Tracking Plans of a certain type. If omitted, lists all types. This + * parameter exists in v1. (optional) + * @param pagination Pagination options. This parameter exists in v1. (optional) * @return ApiResponse<ListTrackingPlans200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listTrackingPlansWithHttpInfo(PaginationInput pagination, String type) throws ApiException { - okhttp3.Call localVarCall = listTrackingPlansValidateBeforeCall(pagination, type, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse listTrackingPlansWithHttpInfo( + String type, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = listTrackingPlansValidateBeforeCall(type, pagination, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Tracking Plans (asynchronously) - * Returns a list of Tracking Plans. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param pagination Pagination options. This parameter exists in alpha. (required) - * @param type Requests Tracking Plans of a certain type. If omitted, lists all types. This parameter exists in alpha. (optional) + * List Tracking Plans (asynchronously) Returns a list of Tracking Plans. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Protocols feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param type Requests Tracking Plans of a certain type. If omitted, lists all types. This + * parameter exists in v1. (optional) + * @param pagination Pagination options. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listTrackingPlansAsync(PaginationInput pagination, String type, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listTrackingPlansValidateBeforeCall(pagination, type, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listTrackingPlansAsync( + String type, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listTrackingPlansValidateBeforeCall(type, pagination, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for removeRulesFromTrackingPlan - * @param trackingPlanId (required) - * @param rules Rules to delete. This parameter exists in alpha. (required) + * + * @param trackingPlanId (required) + * @param rules Rules to delete. This parameter exists in v1. (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call removeRulesFromTrackingPlanCall(String trackingPlanId, List rules, final ApiCallback _callback) throws ApiException { + public okhttp3.Call removeRulesFromTrackingPlanCall( + String trackingPlanId, List rules, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1143,8 +1417,11 @@ public okhttp3.Call removeRulesFromTrackingPlanCall(String trackingPlanId, List< Object localVarPostBody = null; // create path and map variables - String localVarPath = "/tracking-plans/{trackingPlanId}/rules" - .replaceAll("\\{" + "trackingPlanId" + "\\}", localVarApiClient.escapeString(trackingPlanId.toString())); + String localVarPath = + "/tracking-plans/{trackingPlanId}/rules" + .replace( + "{" + "trackingPlanId" + "}", + localVarApiClient.escapeString(trackingPlanId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1153,140 +1430,182 @@ public okhttp3.Call removeRulesFromTrackingPlanCall(String trackingPlanId, List< Map localVarFormParams = new HashMap(); if (rules != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "rules", rules)); + localVarCollectionQueryParams.addAll( + localVarApiClient.parameterToPairs("multi", "rules", rules)); } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call removeRulesFromTrackingPlanValidateBeforeCall(String trackingPlanId, List rules, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call removeRulesFromTrackingPlanValidateBeforeCall( + String trackingPlanId, List rules, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'trackingPlanId' is set if (trackingPlanId == null) { - throw new ApiException("Missing the required parameter 'trackingPlanId' when calling removeRulesFromTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'trackingPlanId' when calling" + + " removeRulesFromTrackingPlan(Async)"); } - + // verify the required parameter 'rules' is set if (rules == null) { - throw new ApiException("Missing the required parameter 'rules' when calling removeRulesFromTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'rules' when calling" + + " removeRulesFromTrackingPlan(Async)"); } - - - okhttp3.Call localVarCall = removeRulesFromTrackingPlanCall(trackingPlanId, rules, _callback); - return localVarCall; + return removeRulesFromTrackingPlanCall(trackingPlanId, rules, _callback); } /** - * Remove Rules from Tracking Plan - * Deletes Tracking Plan rules. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param rules Rules to delete. This parameter exists in alpha. (required) + * Remove Rules from Tracking Plan Deletes Tracking Plan rules. • In order to successfully call + * this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param trackingPlanId (required) + * @param rules Rules to delete. This parameter exists in v1. (required) * @return RemoveRulesFromTrackingPlan200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public RemoveRulesFromTrackingPlan200Response removeRulesFromTrackingPlan(String trackingPlanId, List rules) throws ApiException { - ApiResponse localVarResp = removeRulesFromTrackingPlanWithHttpInfo(trackingPlanId, rules); + public RemoveRulesFromTrackingPlan200Response removeRulesFromTrackingPlan( + String trackingPlanId, List rules) throws ApiException { + ApiResponse localVarResp = + removeRulesFromTrackingPlanWithHttpInfo(trackingPlanId, rules); return localVarResp.getData(); } /** - * Remove Rules from Tracking Plan - * Deletes Tracking Plan rules. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param rules Rules to delete. This parameter exists in alpha. (required) + * Remove Rules from Tracking Plan Deletes Tracking Plan rules. • In order to successfully call + * this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param trackingPlanId (required) + * @param rules Rules to delete. This parameter exists in v1. (required) * @return ApiResponse<RemoveRulesFromTrackingPlan200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse removeRulesFromTrackingPlanWithHttpInfo(String trackingPlanId, List rules) throws ApiException { - okhttp3.Call localVarCall = removeRulesFromTrackingPlanValidateBeforeCall(trackingPlanId, rules, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + removeRulesFromTrackingPlanWithHttpInfo(String trackingPlanId, List rules) + throws ApiException { + okhttp3.Call localVarCall = + removeRulesFromTrackingPlanValidateBeforeCall(trackingPlanId, rules, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Remove Rules from Tracking Plan (asynchronously) - * Deletes Tracking Plan rules. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param rules Rules to delete. This parameter exists in alpha. (required) + * Remove Rules from Tracking Plan (asynchronously) Deletes Tracking Plan rules. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Protocols feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param trackingPlanId (required) + * @param rules Rules to delete. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call removeRulesFromTrackingPlanAsync(String trackingPlanId, List rules, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = removeRulesFromTrackingPlanValidateBeforeCall(trackingPlanId, rules, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call removeRulesFromTrackingPlanAsync( + String trackingPlanId, + List rules, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeRulesFromTrackingPlanValidateBeforeCall(trackingPlanId, rules, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for removeSourceFromTrackingPlan - * @param trackingPlanId (required) - * @param sourceId The id of the Source associated with the Tracking Plan. Config API note: analogous to `sourceName`. This parameter exists in alpha. (required) + * + * @param trackingPlanId (required) + * @param sourceId The id of the Source associated with the Tracking Plan. Config API note: + * analogous to `sourceName`. This parameter exists in v1. (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call removeSourceFromTrackingPlanCall(String trackingPlanId, String sourceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call removeSourceFromTrackingPlanCall( + String trackingPlanId, String sourceId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1295,8 +1614,11 @@ public okhttp3.Call removeSourceFromTrackingPlanCall(String trackingPlanId, Stri Object localVarPostBody = null; // create path and map variables - String localVarPath = "/tracking-plans/{trackingPlanId}/sources" - .replaceAll("\\{" + "trackingPlanId" + "\\}", localVarApiClient.escapeString(trackingPlanId.toString())); + String localVarPath = + "/tracking-plans/{trackingPlanId}/sources" + .replace( + "{" + "trackingPlanId" + "}", + localVarApiClient.escapeString(trackingPlanId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1309,136 +1631,187 @@ public okhttp3.Call removeSourceFromTrackingPlanCall(String trackingPlanId, Stri } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call removeSourceFromTrackingPlanValidateBeforeCall(String trackingPlanId, String sourceId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call removeSourceFromTrackingPlanValidateBeforeCall( + String trackingPlanId, String sourceId, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'trackingPlanId' is set if (trackingPlanId == null) { - throw new ApiException("Missing the required parameter 'trackingPlanId' when calling removeSourceFromTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'trackingPlanId' when calling" + + " removeSourceFromTrackingPlan(Async)"); } - + // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling removeSourceFromTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " removeSourceFromTrackingPlan(Async)"); } - - - okhttp3.Call localVarCall = removeSourceFromTrackingPlanCall(trackingPlanId, sourceId, _callback); - return localVarCall; + return removeSourceFromTrackingPlanCall(trackingPlanId, sourceId, _callback); } /** - * Remove Source from Tracking Plan - * Disconnects a Source from a Tracking Plan. When called, this endpoint may generate the `Source Modified` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param sourceId The id of the Source associated with the Tracking Plan. Config API note: analogous to `sourceName`. This parameter exists in alpha. (required) + * Remove Source from Tracking Plan Disconnects a Source from a Tracking Plan. • When called, + * this endpoint may generate the `Source Modified` event in the [audit + * trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified + * Workspace needs to have the Protocols feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param trackingPlanId (required) + * @param sourceId The id of the Source associated with the Tracking Plan. Config API note: + * analogous to `sourceName`. This parameter exists in v1. (required) * @return RemoveSourceFromTrackingPlan200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public RemoveSourceFromTrackingPlan200Response removeSourceFromTrackingPlan(String trackingPlanId, String sourceId) throws ApiException { - ApiResponse localVarResp = removeSourceFromTrackingPlanWithHttpInfo(trackingPlanId, sourceId); + public RemoveSourceFromTrackingPlan200Response removeSourceFromTrackingPlan( + String trackingPlanId, String sourceId) throws ApiException { + ApiResponse localVarResp = + removeSourceFromTrackingPlanWithHttpInfo(trackingPlanId, sourceId); return localVarResp.getData(); } /** - * Remove Source from Tracking Plan - * Disconnects a Source from a Tracking Plan. When called, this endpoint may generate the `Source Modified` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param sourceId The id of the Source associated with the Tracking Plan. Config API note: analogous to `sourceName`. This parameter exists in alpha. (required) + * Remove Source from Tracking Plan Disconnects a Source from a Tracking Plan. • When called, + * this endpoint may generate the `Source Modified` event in the [audit + * trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified + * Workspace needs to have the Protocols feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param trackingPlanId (required) + * @param sourceId The id of the Source associated with the Tracking Plan. Config API note: + * analogous to `sourceName`. This parameter exists in v1. (required) * @return ApiResponse<RemoveSourceFromTrackingPlan200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse removeSourceFromTrackingPlanWithHttpInfo(String trackingPlanId, String sourceId) throws ApiException { - okhttp3.Call localVarCall = removeSourceFromTrackingPlanValidateBeforeCall(trackingPlanId, sourceId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + removeSourceFromTrackingPlanWithHttpInfo(String trackingPlanId, String sourceId) + throws ApiException { + okhttp3.Call localVarCall = + removeSourceFromTrackingPlanValidateBeforeCall(trackingPlanId, sourceId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Remove Source from Tracking Plan (asynchronously) - * Disconnects a Source from a Tracking Plan. When called, this endpoint may generate the `Source Modified` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param sourceId The id of the Source associated with the Tracking Plan. Config API note: analogous to `sourceName`. This parameter exists in alpha. (required) + * Remove Source from Tracking Plan (asynchronously) Disconnects a Source from a Tracking Plan. + * • When called, this endpoint may generate the `Source Modified` event in the [audit + * trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified + * Workspace needs to have the Protocols feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param trackingPlanId (required) + * @param sourceId The id of the Source associated with the Tracking Plan. Config API note: + * analogous to `sourceName`. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call removeSourceFromTrackingPlanAsync(String trackingPlanId, String sourceId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = removeSourceFromTrackingPlanValidateBeforeCall(trackingPlanId, sourceId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call removeSourceFromTrackingPlanAsync( + String trackingPlanId, + String sourceId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeSourceFromTrackingPlanValidateBeforeCall(trackingPlanId, sourceId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for replaceRulesInTrackingPlan - * @param trackingPlanId (required) - * @param replaceRulesInTrackingPlanV1Input (required) + * + * @param trackingPlanId (required) + * @param replaceRulesInTrackingPlanV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replaceRulesInTrackingPlanCall(String trackingPlanId, ReplaceRulesInTrackingPlanV1Input replaceRulesInTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call replaceRulesInTrackingPlanCall( + String trackingPlanId, + ReplaceRulesInTrackingPlanV1Input replaceRulesInTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1447,8 +1820,11 @@ public okhttp3.Call replaceRulesInTrackingPlanCall(String trackingPlanId, Replac Object localVarPostBody = replaceRulesInTrackingPlanV1Input; // create path and map variables - String localVarPath = "/tracking-plans/{trackingPlanId}/rules" - .replaceAll("\\{" + "trackingPlanId" + "\\}", localVarApiClient.escapeString(trackingPlanId.toString())); + String localVarPath = + "/tracking-plans/{trackingPlanId}/rules" + .replace( + "{" + "trackingPlanId" + "}", + localVarApiClient.escapeString(trackingPlanId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1457,7 +1833,10 @@ public okhttp3.Call replaceRulesInTrackingPlanCall(String trackingPlanId, Replac Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -1465,128 +1844,182 @@ public okhttp3.Call replaceRulesInTrackingPlanCall(String trackingPlanId, Replac } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replaceRulesInTrackingPlanValidateBeforeCall(String trackingPlanId, ReplaceRulesInTrackingPlanV1Input replaceRulesInTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call replaceRulesInTrackingPlanValidateBeforeCall( + String trackingPlanId, + ReplaceRulesInTrackingPlanV1Input replaceRulesInTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'trackingPlanId' is set if (trackingPlanId == null) { - throw new ApiException("Missing the required parameter 'trackingPlanId' when calling replaceRulesInTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'trackingPlanId' when calling" + + " replaceRulesInTrackingPlan(Async)"); } - + // verify the required parameter 'replaceRulesInTrackingPlanV1Input' is set if (replaceRulesInTrackingPlanV1Input == null) { - throw new ApiException("Missing the required parameter 'replaceRulesInTrackingPlanV1Input' when calling replaceRulesInTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'replaceRulesInTrackingPlanV1Input' when" + + " calling replaceRulesInTrackingPlan(Async)"); } - - - okhttp3.Call localVarCall = replaceRulesInTrackingPlanCall(trackingPlanId, replaceRulesInTrackingPlanV1Input, _callback); - return localVarCall; + return replaceRulesInTrackingPlanCall( + trackingPlanId, replaceRulesInTrackingPlanV1Input, _callback); } /** - * Replace Rules in Tracking Plan - * Replaces Tracking Plan rules. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param replaceRulesInTrackingPlanV1Input (required) + * Replace Rules in Tracking Plan Replaces Tracking Plan rules. • In order to successfully call + * this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param trackingPlanId (required) + * @param replaceRulesInTrackingPlanV1Input (required) * @return ReplaceRulesInTrackingPlan200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ReplaceRulesInTrackingPlan200Response replaceRulesInTrackingPlan(String trackingPlanId, ReplaceRulesInTrackingPlanV1Input replaceRulesInTrackingPlanV1Input) throws ApiException { - ApiResponse localVarResp = replaceRulesInTrackingPlanWithHttpInfo(trackingPlanId, replaceRulesInTrackingPlanV1Input); + public ReplaceRulesInTrackingPlan200Response replaceRulesInTrackingPlan( + String trackingPlanId, + ReplaceRulesInTrackingPlanV1Input replaceRulesInTrackingPlanV1Input) + throws ApiException { + ApiResponse localVarResp = + replaceRulesInTrackingPlanWithHttpInfo( + trackingPlanId, replaceRulesInTrackingPlanV1Input); return localVarResp.getData(); } /** - * Replace Rules in Tracking Plan - * Replaces Tracking Plan rules. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param replaceRulesInTrackingPlanV1Input (required) + * Replace Rules in Tracking Plan Replaces Tracking Plan rules. • In order to successfully call + * this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param trackingPlanId (required) + * @param replaceRulesInTrackingPlanV1Input (required) * @return ApiResponse<ReplaceRulesInTrackingPlan200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse replaceRulesInTrackingPlanWithHttpInfo(String trackingPlanId, ReplaceRulesInTrackingPlanV1Input replaceRulesInTrackingPlanV1Input) throws ApiException { - okhttp3.Call localVarCall = replaceRulesInTrackingPlanValidateBeforeCall(trackingPlanId, replaceRulesInTrackingPlanV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + replaceRulesInTrackingPlanWithHttpInfo( + String trackingPlanId, + ReplaceRulesInTrackingPlanV1Input replaceRulesInTrackingPlanV1Input) + throws ApiException { + okhttp3.Call localVarCall = + replaceRulesInTrackingPlanValidateBeforeCall( + trackingPlanId, replaceRulesInTrackingPlanV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace Rules in Tracking Plan (asynchronously) - * Replaces Tracking Plan rules. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param replaceRulesInTrackingPlanV1Input (required) + * Replace Rules in Tracking Plan (asynchronously) Replaces Tracking Plan rules. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Protocols feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param trackingPlanId (required) + * @param replaceRulesInTrackingPlanV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call replaceRulesInTrackingPlanAsync(String trackingPlanId, ReplaceRulesInTrackingPlanV1Input replaceRulesInTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = replaceRulesInTrackingPlanValidateBeforeCall(trackingPlanId, replaceRulesInTrackingPlanV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call replaceRulesInTrackingPlanAsync( + String trackingPlanId, + ReplaceRulesInTrackingPlanV1Input replaceRulesInTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + replaceRulesInTrackingPlanValidateBeforeCall( + trackingPlanId, replaceRulesInTrackingPlanV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for updateRulesInTrackingPlan - * @param trackingPlanId (required) - * @param updateRulesInTrackingPlanV1Input (required) + * + * @param trackingPlanId (required) + * @param updateRulesInTrackingPlanV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateRulesInTrackingPlanCall(String trackingPlanId, UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call updateRulesInTrackingPlanCall( + String trackingPlanId, + UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1595,8 +2028,11 @@ public okhttp3.Call updateRulesInTrackingPlanCall(String trackingPlanId, UpdateR Object localVarPostBody = updateRulesInTrackingPlanV1Input; // create path and map variables - String localVarPath = "/tracking-plans/{trackingPlanId}/rules" - .replaceAll("\\{" + "trackingPlanId" + "\\}", localVarApiClient.escapeString(trackingPlanId.toString())); + String localVarPath = + "/tracking-plans/{trackingPlanId}/rules" + .replace( + "{" + "trackingPlanId" + "}", + localVarApiClient.escapeString(trackingPlanId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1605,7 +2041,10 @@ public okhttp3.Call updateRulesInTrackingPlanCall(String trackingPlanId, UpdateR Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -1613,128 +2052,181 @@ public okhttp3.Call updateRulesInTrackingPlanCall(String trackingPlanId, UpdateR } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateRulesInTrackingPlanValidateBeforeCall(String trackingPlanId, UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call updateRulesInTrackingPlanValidateBeforeCall( + String trackingPlanId, + UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'trackingPlanId' is set if (trackingPlanId == null) { - throw new ApiException("Missing the required parameter 'trackingPlanId' when calling updateRulesInTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'trackingPlanId' when calling" + + " updateRulesInTrackingPlan(Async)"); } - + // verify the required parameter 'updateRulesInTrackingPlanV1Input' is set if (updateRulesInTrackingPlanV1Input == null) { - throw new ApiException("Missing the required parameter 'updateRulesInTrackingPlanV1Input' when calling updateRulesInTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'updateRulesInTrackingPlanV1Input' when calling" + + " updateRulesInTrackingPlan(Async)"); } - - - okhttp3.Call localVarCall = updateRulesInTrackingPlanCall(trackingPlanId, updateRulesInTrackingPlanV1Input, _callback); - return localVarCall; + return updateRulesInTrackingPlanCall( + trackingPlanId, updateRulesInTrackingPlanV1Input, _callback); } /** - * Update Rules in Tracking Plan - * Updates Tracking Plan rules. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param updateRulesInTrackingPlanV1Input (required) + * Update Rules in Tracking Plan Updates Tracking Plan rules. • In order to successfully call + * this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param trackingPlanId (required) + * @param updateRulesInTrackingPlanV1Input (required) * @return UpdateRulesInTrackingPlan200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public UpdateRulesInTrackingPlan200Response updateRulesInTrackingPlan(String trackingPlanId, UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input) throws ApiException { - ApiResponse localVarResp = updateRulesInTrackingPlanWithHttpInfo(trackingPlanId, updateRulesInTrackingPlanV1Input); + public UpdateRulesInTrackingPlan200Response updateRulesInTrackingPlan( + String trackingPlanId, + UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input) + throws ApiException { + ApiResponse localVarResp = + updateRulesInTrackingPlanWithHttpInfo( + trackingPlanId, updateRulesInTrackingPlanV1Input); return localVarResp.getData(); } /** - * Update Rules in Tracking Plan - * Updates Tracking Plan rules. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param updateRulesInTrackingPlanV1Input (required) + * Update Rules in Tracking Plan Updates Tracking Plan rules. • In order to successfully call + * this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param trackingPlanId (required) + * @param updateRulesInTrackingPlanV1Input (required) * @return ApiResponse<UpdateRulesInTrackingPlan200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse updateRulesInTrackingPlanWithHttpInfo(String trackingPlanId, UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input) throws ApiException { - okhttp3.Call localVarCall = updateRulesInTrackingPlanValidateBeforeCall(trackingPlanId, updateRulesInTrackingPlanV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse updateRulesInTrackingPlanWithHttpInfo( + String trackingPlanId, + UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input) + throws ApiException { + okhttp3.Call localVarCall = + updateRulesInTrackingPlanValidateBeforeCall( + trackingPlanId, updateRulesInTrackingPlanV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Rules in Tracking Plan (asynchronously) - * Updates Tracking Plan rules. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param trackingPlanId (required) - * @param updateRulesInTrackingPlanV1Input (required) + * Update Rules in Tracking Plan (asynchronously) Updates Tracking Plan rules. • In order to + * successfully call this endpoint, the specified Workspace needs to have the Protocols feature + * enabled. Please reach out to your customer success manager for more information. + * + * @param trackingPlanId (required) + * @param updateRulesInTrackingPlanV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateRulesInTrackingPlanAsync(String trackingPlanId, UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateRulesInTrackingPlanValidateBeforeCall(trackingPlanId, updateRulesInTrackingPlanV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call updateRulesInTrackingPlanAsync( + String trackingPlanId, + UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateRulesInTrackingPlanValidateBeforeCall( + trackingPlanId, updateRulesInTrackingPlanV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for updateTrackingPlan - * @param trackingPlanId (required) - * @param updateTrackingPlanV1Input (required) + * + * @param trackingPlanId (required) + * @param updateTrackingPlanV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateTrackingPlanCall(String trackingPlanId, UpdateTrackingPlanV1Input updateTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call updateTrackingPlanCall( + String trackingPlanId, + UpdateTrackingPlanV1Input updateTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1743,8 +2235,11 @@ public okhttp3.Call updateTrackingPlanCall(String trackingPlanId, UpdateTracking Object localVarPostBody = updateTrackingPlanV1Input; // create path and map variables - String localVarPath = "/tracking-plans/{trackingPlanId}" - .replaceAll("\\{" + "trackingPlanId" + "\\}", localVarApiClient.escapeString(trackingPlanId.toString())); + String localVarPath = + "/tracking-plans/{trackingPlanId}" + .replace( + "{" + "trackingPlanId" + "}", + localVarApiClient.escapeString(trackingPlanId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1753,7 +2248,10 @@ public okhttp3.Call updateTrackingPlanCall(String trackingPlanId, UpdateTracking Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -1761,100 +2259,144 @@ public okhttp3.Call updateTrackingPlanCall(String trackingPlanId, UpdateTracking } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateTrackingPlanValidateBeforeCall(String trackingPlanId, UpdateTrackingPlanV1Input updateTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call updateTrackingPlanValidateBeforeCall( + String trackingPlanId, + UpdateTrackingPlanV1Input updateTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'trackingPlanId' is set if (trackingPlanId == null) { - throw new ApiException("Missing the required parameter 'trackingPlanId' when calling updateTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'trackingPlanId' when calling" + + " updateTrackingPlan(Async)"); } - + // verify the required parameter 'updateTrackingPlanV1Input' is set if (updateTrackingPlanV1Input == null) { - throw new ApiException("Missing the required parameter 'updateTrackingPlanV1Input' when calling updateTrackingPlan(Async)"); + throw new ApiException( + "Missing the required parameter 'updateTrackingPlanV1Input' when calling" + + " updateTrackingPlan(Async)"); } - - - okhttp3.Call localVarCall = updateTrackingPlanCall(trackingPlanId, updateTrackingPlanV1Input, _callback); - return localVarCall; + return updateTrackingPlanCall(trackingPlanId, updateTrackingPlanV1Input, _callback); } /** - * Update Tracking Plan - * Updates a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. Config API omitted fields: - `updateMask` - * @param trackingPlanId (required) - * @param updateTrackingPlanV1Input (required) + * Update Tracking Plan Updates a Tracking Plan. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Protocols feature enabled. Please reach out to your + * customer success manager for more information. Config API omitted fields: - + * `updateMask` + * + * @param trackingPlanId (required) + * @param updateTrackingPlanV1Input (required) * @return UpdateTrackingPlan200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public UpdateTrackingPlan200Response updateTrackingPlan(String trackingPlanId, UpdateTrackingPlanV1Input updateTrackingPlanV1Input) throws ApiException { - ApiResponse localVarResp = updateTrackingPlanWithHttpInfo(trackingPlanId, updateTrackingPlanV1Input); + public UpdateTrackingPlan200Response updateTrackingPlan( + String trackingPlanId, UpdateTrackingPlanV1Input updateTrackingPlanV1Input) + throws ApiException { + ApiResponse localVarResp = + updateTrackingPlanWithHttpInfo(trackingPlanId, updateTrackingPlanV1Input); return localVarResp.getData(); } /** - * Update Tracking Plan - * Updates a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. Config API omitted fields: - `updateMask` - * @param trackingPlanId (required) - * @param updateTrackingPlanV1Input (required) + * Update Tracking Plan Updates a Tracking Plan. • In order to successfully call this endpoint, + * the specified Workspace needs to have the Protocols feature enabled. Please reach out to your + * customer success manager for more information. Config API omitted fields: - + * `updateMask` + * + * @param trackingPlanId (required) + * @param updateTrackingPlanV1Input (required) * @return ApiResponse<UpdateTrackingPlan200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse updateTrackingPlanWithHttpInfo(String trackingPlanId, UpdateTrackingPlanV1Input updateTrackingPlanV1Input) throws ApiException { - okhttp3.Call localVarCall = updateTrackingPlanValidateBeforeCall(trackingPlanId, updateTrackingPlanV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse updateTrackingPlanWithHttpInfo( + String trackingPlanId, UpdateTrackingPlanV1Input updateTrackingPlanV1Input) + throws ApiException { + okhttp3.Call localVarCall = + updateTrackingPlanValidateBeforeCall( + trackingPlanId, updateTrackingPlanV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Tracking Plan (asynchronously) - * Updates a Tracking Plan. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. Config API omitted fields: - `updateMask` - * @param trackingPlanId (required) - * @param updateTrackingPlanV1Input (required) + * Update Tracking Plan (asynchronously) Updates a Tracking Plan. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Protocols feature enabled. + * Please reach out to your customer success manager for more information. Config API omitted + * fields: - `updateMask` + * + * @param trackingPlanId (required) + * @param updateTrackingPlanV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateTrackingPlanAsync(String trackingPlanId, UpdateTrackingPlanV1Input updateTrackingPlanV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateTrackingPlanValidateBeforeCall(trackingPlanId, updateTrackingPlanV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call updateTrackingPlanAsync( + String trackingPlanId, + UpdateTrackingPlanV1Input updateTrackingPlanV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateTrackingPlanValidateBeforeCall( + trackingPlanId, updateTrackingPlanV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/TransformationsApi.java b/src/main/java/com/segment/publicapi/api/TransformationsApi.java index f8dc9af2..0052f972 100644 --- a/src/main/java/com/segment/publicapi/api/TransformationsApi.java +++ b/src/main/java/com/segment/publicapi/api/TransformationsApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,39 +9,28 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.CreateTransformation200Response; -import com.segment.publicapi.models.CreateTransformationBetaInput; +import com.segment.publicapi.models.CreateTransformationV1Input; import com.segment.publicapi.models.DeleteTransformation200Response; import com.segment.publicapi.models.GetTransformation200Response; import com.segment.publicapi.models.ListTransformations200Response; import com.segment.publicapi.models.PaginationInput; -import com.segment.publicapi.models.RequestErrorEnvelope; import com.segment.publicapi.models.UpdateTransformation200Response; -import com.segment.publicapi.models.UpdateTransformationBetaInput; - +import com.segment.publicapi.models.UpdateTransformationV1Input; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class TransformationsApi { private ApiClient localVarApiClient; @@ -83,34 +71,37 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createTransformation - * @param createTransformationBetaInput (required) + * + * @param createTransformationV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createTransformationCall(CreateTransformationBetaInput createTransformationBetaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createTransformationCall( + CreateTransformationV1Input createTransformationV1Input, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } - Object localVarPostBody = createTransformationBetaInput; + Object localVarPostBody = createTransformationV1Input; // create path and map variables String localVarPath = "/transformations"; @@ -122,7 +113,10 @@ public okhttp3.Call createTransformationCall(CreateTransformationBetaInput creat Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -130,119 +124,158 @@ public okhttp3.Call createTransformationCall(CreateTransformationBetaInput creat } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createTransformationValidateBeforeCall(CreateTransformationBetaInput createTransformationBetaInput, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'createTransformationBetaInput' is set - if (createTransformationBetaInput == null) { - throw new ApiException("Missing the required parameter 'createTransformationBetaInput' when calling createTransformation(Async)"); + private okhttp3.Call createTransformationValidateBeforeCall( + CreateTransformationV1Input createTransformationV1Input, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'createTransformationV1Input' is set + if (createTransformationV1Input == null) { + throw new ApiException( + "Missing the required parameter 'createTransformationV1Input' when calling" + + " createTransformation(Async)"); } - - - okhttp3.Call localVarCall = createTransformationCall(createTransformationBetaInput, _callback); - return localVarCall; + return createTransformationCall(createTransformationV1Input, _callback); } /** - * Create Transformation - * Creates a new Transformation. When called, this endpoint may generate the `Transformation Created` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param createTransformationBetaInput (required) + * Create Transformation Creates a new Transformation. • When called, this endpoint may generate + * the `Transformation Created` event in the [audit trail](/tag/Audit-Trail). • In + * order to successfully call this endpoint, the specified Workspace needs to have the Protocols + * feature enabled. Please reach out to your customer success manager for more information. + * + * @param createTransformationV1Input (required) * @return CreateTransformation200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateTransformation200Response createTransformation(CreateTransformationBetaInput createTransformationBetaInput) throws ApiException { - ApiResponse localVarResp = createTransformationWithHttpInfo(createTransformationBetaInput); + public CreateTransformation200Response createTransformation( + CreateTransformationV1Input createTransformationV1Input) throws ApiException { + ApiResponse localVarResp = + createTransformationWithHttpInfo(createTransformationV1Input); return localVarResp.getData(); } /** - * Create Transformation - * Creates a new Transformation. When called, this endpoint may generate the `Transformation Created` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param createTransformationBetaInput (required) + * Create Transformation Creates a new Transformation. • When called, this endpoint may generate + * the `Transformation Created` event in the [audit trail](/tag/Audit-Trail). • In + * order to successfully call this endpoint, the specified Workspace needs to have the Protocols + * feature enabled. Please reach out to your customer success manager for more information. + * + * @param createTransformationV1Input (required) * @return ApiResponse<CreateTransformation200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createTransformationWithHttpInfo(CreateTransformationBetaInput createTransformationBetaInput) throws ApiException { - okhttp3.Call localVarCall = createTransformationValidateBeforeCall(createTransformationBetaInput, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse createTransformationWithHttpInfo( + CreateTransformationV1Input createTransformationV1Input) throws ApiException { + okhttp3.Call localVarCall = + createTransformationValidateBeforeCall(createTransformationV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Transformation (asynchronously) - * Creates a new Transformation. When called, this endpoint may generate the `Transformation Created` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param createTransformationBetaInput (required) + * Create Transformation (asynchronously) Creates a new Transformation. • When called, this + * endpoint may generate the `Transformation Created` event in the [audit + * trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified + * Workspace needs to have the Protocols feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param createTransformationV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createTransformationAsync(CreateTransformationBetaInput createTransformationBetaInput, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createTransformationValidateBeforeCall(createTransformationBetaInput, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createTransformationAsync( + CreateTransformationV1Input createTransformationV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createTransformationValidateBeforeCall(createTransformationV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for deleteTransformation - * @param transformationId (required) + * + * @param transformationId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteTransformationCall(String transformationId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteTransformationCall( + String transformationId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -251,8 +284,11 @@ public okhttp3.Call deleteTransformationCall(String transformationId, final ApiC Object localVarPostBody = null; // create path and map variables - String localVarPath = "/transformations/{transformationId}" - .replaceAll("\\{" + "transformationId" + "\\}", localVarApiClient.escapeString(transformationId.toString())); + String localVarPath = + "/transformations/{transformationId}" + .replace( + "{" + "transformationId" + "}", + localVarApiClient.escapeString(transformationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -261,127 +297,161 @@ public okhttp3.Call deleteTransformationCall(String transformationId, final ApiC Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteTransformationValidateBeforeCall(String transformationId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call deleteTransformationValidateBeforeCall( + String transformationId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'transformationId' is set if (transformationId == null) { - throw new ApiException("Missing the required parameter 'transformationId' when calling deleteTransformation(Async)"); + throw new ApiException( + "Missing the required parameter 'transformationId' when calling" + + " deleteTransformation(Async)"); } - - - okhttp3.Call localVarCall = deleteTransformationCall(transformationId, _callback); - return localVarCall; + return deleteTransformationCall(transformationId, _callback); } /** - * Delete Transformation - * Deletes a Transformation. When called, this endpoint may generate the `Transformation Deleted` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param transformationId (required) + * Delete Transformation Deletes a Transformation. • When called, this endpoint may generate the + * `Transformation Deleted` event in the [audit trail](/tag/Audit-Trail). • In order + * to successfully call this endpoint, the specified Workspace needs to have the Protocols + * feature enabled. Please reach out to your customer success manager for more information. + * + * @param transformationId (required) * @return DeleteTransformation200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public DeleteTransformation200Response deleteTransformation(String transformationId) throws ApiException { - ApiResponse localVarResp = deleteTransformationWithHttpInfo(transformationId); + public DeleteTransformation200Response deleteTransformation(String transformationId) + throws ApiException { + ApiResponse localVarResp = + deleteTransformationWithHttpInfo(transformationId); return localVarResp.getData(); } /** - * Delete Transformation - * Deletes a Transformation. When called, this endpoint may generate the `Transformation Deleted` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param transformationId (required) + * Delete Transformation Deletes a Transformation. • When called, this endpoint may generate the + * `Transformation Deleted` event in the [audit trail](/tag/Audit-Trail). • In order + * to successfully call this endpoint, the specified Workspace needs to have the Protocols + * feature enabled. Please reach out to your customer success manager for more information. + * + * @param transformationId (required) * @return ApiResponse<DeleteTransformation200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse deleteTransformationWithHttpInfo(String transformationId) throws ApiException { + public ApiResponse deleteTransformationWithHttpInfo( + String transformationId) throws ApiException { okhttp3.Call localVarCall = deleteTransformationValidateBeforeCall(transformationId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Delete Transformation (asynchronously) - * Deletes a Transformation. When called, this endpoint may generate the `Transformation Deleted` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param transformationId (required) + * Delete Transformation (asynchronously) Deletes a Transformation. • When called, this endpoint + * may generate the `Transformation Deleted` event in the [audit + * trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified + * Workspace needs to have the Protocols feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param transformationId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteTransformationAsync(String transformationId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteTransformationAsync( + String transformationId, final ApiCallback _callback) + throws ApiException { - okhttp3.Call localVarCall = deleteTransformationValidateBeforeCall(transformationId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + okhttp3.Call localVarCall = + deleteTransformationValidateBeforeCall(transformationId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getTransformation - * @param transformationId (required) + * + * @param transformationId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getTransformationCall(String transformationId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getTransformationCall(String transformationId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -390,8 +460,11 @@ public okhttp3.Call getTransformationCall(String transformationId, final ApiCall Object localVarPostBody = null; // create path and map variables - String localVarPath = "/transformations/{transformationId}" - .replaceAll("\\{" + "transformationId" + "\\}", localVarApiClient.escapeString(transformationId.toString())); + String localVarPath = + "/transformations/{transformationId}" + .replace( + "{" + "transformationId" + "}", + localVarApiClient.escapeString(transformationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -400,127 +473,157 @@ public okhttp3.Call getTransformationCall(String transformationId, final ApiCall Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getTransformationValidateBeforeCall(String transformationId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getTransformationValidateBeforeCall( + String transformationId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'transformationId' is set if (transformationId == null) { - throw new ApiException("Missing the required parameter 'transformationId' when calling getTransformation(Async)"); + throw new ApiException( + "Missing the required parameter 'transformationId' when calling" + + " getTransformation(Async)"); } - - - okhttp3.Call localVarCall = getTransformationCall(transformationId, _callback); - return localVarCall; + return getTransformationCall(transformationId, _callback); } /** - * Get Transformation - * Gets a Transformation. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param transformationId (required) + * Get Transformation Gets a Transformation. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Protocols feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param transformationId (required) * @return GetTransformation200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetTransformation200Response getTransformation(String transformationId) throws ApiException { - ApiResponse localVarResp = getTransformationWithHttpInfo(transformationId); + public GetTransformation200Response getTransformation(String transformationId) + throws ApiException { + ApiResponse localVarResp = + getTransformationWithHttpInfo(transformationId); return localVarResp.getData(); } /** - * Get Transformation - * Gets a Transformation. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param transformationId (required) + * Get Transformation Gets a Transformation. • In order to successfully call this endpoint, the + * specified Workspace needs to have the Protocols feature enabled. Please reach out to your + * customer success manager for more information. + * + * @param transformationId (required) * @return ApiResponse<GetTransformation200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getTransformationWithHttpInfo(String transformationId) throws ApiException { + public ApiResponse getTransformationWithHttpInfo( + String transformationId) throws ApiException { okhttp3.Call localVarCall = getTransformationValidateBeforeCall(transformationId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Transformation (asynchronously) - * Gets a Transformation. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param transformationId (required) + * Get Transformation (asynchronously) Gets a Transformation. • In order to successfully call + * this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please + * reach out to your customer success manager for more information. + * + * @param transformationId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getTransformationAsync(String transformationId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getTransformationAsync( + String transformationId, final ApiCallback _callback) + throws ApiException { - okhttp3.Call localVarCall = getTransformationValidateBeforeCall(transformationId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + okhttp3.Call localVarCall = + getTransformationValidateBeforeCall(transformationId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listTransformations - * @param pagination Pagination options. This parameter exists in alpha. (required) + * + * @param pagination Pagination options. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listTransformationsCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listTransformationsCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -542,138 +645,166 @@ public okhttp3.Call listTransformationsCall(PaginationInput pagination, final Ap } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listTransformationsValidateBeforeCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listTransformations(Async)"); - } - - - okhttp3.Call localVarCall = listTransformationsCall(pagination, _callback); - return localVarCall; - + private okhttp3.Call listTransformationsValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return listTransformationsCall(pagination, _callback); } /** - * List Transformations - * Lists all Transformations in the Workspace. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Transformations Lists all Transformations in the Workspace. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Protocols feature enabled. + * Please reach out to your customer success manager for more information. + * + * @param pagination Pagination options. This parameter exists in v1. (optional) * @return ListTransformations200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListTransformations200Response listTransformations(PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listTransformationsWithHttpInfo(pagination); + public ListTransformations200Response listTransformations(PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listTransformationsWithHttpInfo(pagination); return localVarResp.getData(); } /** - * List Transformations - * Lists all Transformations in the Workspace. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Transformations Lists all Transformations in the Workspace. • In order to successfully + * call this endpoint, the specified Workspace needs to have the Protocols feature enabled. + * Please reach out to your customer success manager for more information. + * + * @param pagination Pagination options. This parameter exists in v1. (optional) * @return ApiResponse<ListTransformations200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listTransformationsWithHttpInfo(PaginationInput pagination) throws ApiException { + public ApiResponse listTransformationsWithHttpInfo( + PaginationInput pagination) throws ApiException { okhttp3.Call localVarCall = listTransformationsValidateBeforeCall(pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Transformations (asynchronously) - * Lists all Transformations in the Workspace. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param pagination Pagination options. This parameter exists in alpha. (required) + * List Transformations (asynchronously) Lists all Transformations in the Workspace. • In order + * to successfully call this endpoint, the specified Workspace needs to have the Protocols + * feature enabled. Please reach out to your customer success manager for more information. + * + * @param pagination Pagination options. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listTransformationsAsync(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listTransformationsAsync( + PaginationInput pagination, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = listTransformationsValidateBeforeCall(pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for updateTransformation - * @param transformationId (required) - * @param updateTransformationBetaInput (required) + * + * @param transformationId (required) + * @param updateTransformationV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateTransformationCall(String transformationId, UpdateTransformationBetaInput updateTransformationBetaInput, final ApiCallback _callback) throws ApiException { + public okhttp3.Call updateTransformationCall( + String transformationId, + UpdateTransformationV1Input updateTransformationV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } - Object localVarPostBody = updateTransformationBetaInput; + Object localVarPostBody = updateTransformationV1Input; // create path and map variables - String localVarPath = "/transformations/{transformationId}" - .replaceAll("\\{" + "transformationId" + "\\}", localVarApiClient.escapeString(transformationId.toString())); + String localVarPath = + "/transformations/{transformationId}" + .replace( + "{" + "transformationId" + "}", + localVarApiClient.escapeString(transformationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -682,7 +813,10 @@ public okhttp3.Call updateTransformationCall(String transformationId, UpdateTran Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -690,100 +824,147 @@ public okhttp3.Call updateTransformationCall(String transformationId, UpdateTran } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateTransformationValidateBeforeCall(String transformationId, UpdateTransformationBetaInput updateTransformationBetaInput, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call updateTransformationValidateBeforeCall( + String transformationId, + UpdateTransformationV1Input updateTransformationV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'transformationId' is set if (transformationId == null) { - throw new ApiException("Missing the required parameter 'transformationId' when calling updateTransformation(Async)"); + throw new ApiException( + "Missing the required parameter 'transformationId' when calling" + + " updateTransformation(Async)"); } - - // verify the required parameter 'updateTransformationBetaInput' is set - if (updateTransformationBetaInput == null) { - throw new ApiException("Missing the required parameter 'updateTransformationBetaInput' when calling updateTransformation(Async)"); - } - - okhttp3.Call localVarCall = updateTransformationCall(transformationId, updateTransformationBetaInput, _callback); - return localVarCall; + // verify the required parameter 'updateTransformationV1Input' is set + if (updateTransformationV1Input == null) { + throw new ApiException( + "Missing the required parameter 'updateTransformationV1Input' when calling" + + " updateTransformation(Async)"); + } + return updateTransformationCall(transformationId, updateTransformationV1Input, _callback); } /** - * Update Transformation - * Updates an existing Transformation. When called, this endpoint may generate the `Transformation Updated` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param transformationId (required) - * @param updateTransformationBetaInput (required) + * Update Transformation Updates an existing Transformation. • When called, this endpoint may + * generate the `Transformation Updated` event in the [audit trail](/tag/Audit-Trail). + * • In order to successfully call this endpoint, the specified Workspace needs to have the + * Protocols feature enabled. Please reach out to your customer success manager for more + * information. + * + * @param transformationId (required) + * @param updateTransformationV1Input (required) * @return UpdateTransformation200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public UpdateTransformation200Response updateTransformation(String transformationId, UpdateTransformationBetaInput updateTransformationBetaInput) throws ApiException { - ApiResponse localVarResp = updateTransformationWithHttpInfo(transformationId, updateTransformationBetaInput); + public UpdateTransformation200Response updateTransformation( + String transformationId, UpdateTransformationV1Input updateTransformationV1Input) + throws ApiException { + ApiResponse localVarResp = + updateTransformationWithHttpInfo(transformationId, updateTransformationV1Input); return localVarResp.getData(); } /** - * Update Transformation - * Updates an existing Transformation. When called, this endpoint may generate the `Transformation Updated` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param transformationId (required) - * @param updateTransformationBetaInput (required) + * Update Transformation Updates an existing Transformation. • When called, this endpoint may + * generate the `Transformation Updated` event in the [audit trail](/tag/Audit-Trail). + * • In order to successfully call this endpoint, the specified Workspace needs to have the + * Protocols feature enabled. Please reach out to your customer success manager for more + * information. + * + * @param transformationId (required) + * @param updateTransformationV1Input (required) * @return ApiResponse<UpdateTransformation200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse updateTransformationWithHttpInfo(String transformationId, UpdateTransformationBetaInput updateTransformationBetaInput) throws ApiException { - okhttp3.Call localVarCall = updateTransformationValidateBeforeCall(transformationId, updateTransformationBetaInput, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse updateTransformationWithHttpInfo( + String transformationId, UpdateTransformationV1Input updateTransformationV1Input) + throws ApiException { + okhttp3.Call localVarCall = + updateTransformationValidateBeforeCall( + transformationId, updateTransformationV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Transformation (asynchronously) - * Updates an existing Transformation. When called, this endpoint may generate the `Transformation Updated` [Audit Trail](/tag/Audit-Trail) event. **Note**: In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information. - * @param transformationId (required) - * @param updateTransformationBetaInput (required) + * Update Transformation (asynchronously) Updates an existing Transformation. • When called, + * this endpoint may generate the `Transformation Updated` event in the [audit + * trail](/tag/Audit-Trail). • In order to successfully call this endpoint, the specified + * Workspace needs to have the Protocols feature enabled. Please reach out to your customer + * success manager for more information. + * + * @param transformationId (required) + * @param updateTransformationV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateTransformationAsync(String transformationId, UpdateTransformationBetaInput updateTransformationBetaInput, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateTransformationValidateBeforeCall(transformationId, updateTransformationBetaInput, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call updateTransformationAsync( + String transformationId, + UpdateTransformationV1Input updateTransformationV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateTransformationValidateBeforeCall( + transformationId, updateTransformationV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/WarehousesApi.java b/src/main/java/com/segment/publicapi/api/WarehousesApi.java index 4a272108..70f1ac7d 100644 --- a/src/main/java/com/segment/publicapi/api/WarehousesApi.java +++ b/src/main/java/com/segment/publicapi/api/WarehousesApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,27 +9,19 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import com.segment.publicapi.models.AddConnectionFromSourceToWarehouse200Response; +import com.segment.publicapi.models.AddConnectionFromSourceToWarehouse201Response; import com.segment.publicapi.models.CreateValidationInWarehouse200Response; import com.segment.publicapi.models.CreateValidationInWarehouseV1Input; -import com.segment.publicapi.models.CreateWarehouse200Response; +import com.segment.publicapi.models.CreateWarehouse201Response; import com.segment.publicapi.models.CreateWarehouseV1Input; import com.segment.publicapi.models.DeleteWarehouse200Response; import com.segment.publicapi.models.GetConnectionStateFromWarehouse200Response; @@ -39,16 +30,13 @@ import com.segment.publicapi.models.ListWarehouses200Response; import com.segment.publicapi.models.PaginationInput; import com.segment.publicapi.models.RemoveSourceConnectionFromWarehouse200Response; -import com.segment.publicapi.models.RequestErrorEnvelope; import com.segment.publicapi.models.UpdateWarehouse200Response; import com.segment.publicapi.models.UpdateWarehouseV1Input; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class WarehousesApi { private ApiClient localVarApiClient; @@ -89,29 +77,31 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for addConnectionFromSourceToWarehouse - * @param warehouseId (required) - * @param sourceId (required) + * + * @param warehouseId (required) + * @param sourceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call addConnectionFromSourceToWarehouseCall(String warehouseId, String sourceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call addConnectionFromSourceToWarehouseCall( + String warehouseId, String sourceId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -120,9 +110,14 @@ public okhttp3.Call addConnectionFromSourceToWarehouseCall(String warehouseId, S Object localVarPostBody = null; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}/connected-sources/{sourceId}" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())) - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/warehouses/{warehouseId}/connected-sources/{sourceId}" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())) + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -131,135 +126,176 @@ public okhttp3.Call addConnectionFromSourceToWarehouseCall(String warehouseId, S Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call addConnectionFromSourceToWarehouseValidateBeforeCall(String warehouseId, String sourceId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call addConnectionFromSourceToWarehouseValidateBeforeCall( + String warehouseId, String sourceId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling addConnectionFromSourceToWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " addConnectionFromSourceToWarehouse(Async)"); } - + // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling addConnectionFromSourceToWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " addConnectionFromSourceToWarehouse(Async)"); } - - - okhttp3.Call localVarCall = addConnectionFromSourceToWarehouseCall(warehouseId, sourceId, _callback); - return localVarCall; + return addConnectionFromSourceToWarehouseCall(warehouseId, sourceId, _callback); } /** - * Add Connection from Source to Warehouse - * Connects a Source to a Warehouse. When called, this endpoint may generate the `Storage Destination Modified` [Audit Trail](/tag/Audit-Trail) event. - * @param warehouseId (required) - * @param sourceId (required) - * @return AddConnectionFromSourceToWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * Add Connection from Source to Warehouse Connects a Source to a Warehouse. • When called, this + * endpoint may generate the `Storage Destination Modified` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param warehouseId (required) + * @param sourceId (required) + * @return AddConnectionFromSourceToWarehouse201Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public AddConnectionFromSourceToWarehouse200Response addConnectionFromSourceToWarehouse(String warehouseId, String sourceId) throws ApiException { - ApiResponse localVarResp = addConnectionFromSourceToWarehouseWithHttpInfo(warehouseId, sourceId); + public AddConnectionFromSourceToWarehouse201Response addConnectionFromSourceToWarehouse( + String warehouseId, String sourceId) throws ApiException { + ApiResponse localVarResp = + addConnectionFromSourceToWarehouseWithHttpInfo(warehouseId, sourceId); return localVarResp.getData(); } /** - * Add Connection from Source to Warehouse - * Connects a Source to a Warehouse. When called, this endpoint may generate the `Storage Destination Modified` [Audit Trail](/tag/Audit-Trail) event. - * @param warehouseId (required) - * @param sourceId (required) - * @return ApiResponse<AddConnectionFromSourceToWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * Add Connection from Source to Warehouse Connects a Source to a Warehouse. • When called, this + * endpoint may generate the `Storage Destination Modified` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param warehouseId (required) + * @param sourceId (required) + * @return ApiResponse<AddConnectionFromSourceToWarehouse201Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse addConnectionFromSourceToWarehouseWithHttpInfo(String warehouseId, String sourceId) throws ApiException { - okhttp3.Call localVarCall = addConnectionFromSourceToWarehouseValidateBeforeCall(warehouseId, sourceId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + addConnectionFromSourceToWarehouseWithHttpInfo(String warehouseId, String sourceId) + throws ApiException { + okhttp3.Call localVarCall = + addConnectionFromSourceToWarehouseValidateBeforeCall(warehouseId, sourceId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Add Connection from Source to Warehouse (asynchronously) - * Connects a Source to a Warehouse. When called, this endpoint may generate the `Storage Destination Modified` [Audit Trail](/tag/Audit-Trail) event. - * @param warehouseId (required) - * @param sourceId (required) + * Add Connection from Source to Warehouse (asynchronously) Connects a Source to a Warehouse. • + * When called, this endpoint may generate the `Storage Destination Modified` event in + * the [audit trail](/tag/Audit-Trail). + * + * @param warehouseId (required) + * @param sourceId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call addConnectionFromSourceToWarehouseAsync(String warehouseId, String sourceId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = addConnectionFromSourceToWarehouseValidateBeforeCall(warehouseId, sourceId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call addConnectionFromSourceToWarehouseAsync( + String warehouseId, + String sourceId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addConnectionFromSourceToWarehouseValidateBeforeCall( + warehouseId, sourceId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for createValidationInWarehouse - * @param createValidationInWarehouseV1Input (required) + * + * @param createValidationInWarehouseV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createValidationInWarehouseCall(CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createValidationInWarehouseCall( + CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -277,7 +313,10 @@ public okhttp3.Call createValidationInWarehouseCall(CreateValidationInWarehouseV Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -285,119 +324,163 @@ public okhttp3.Call createValidationInWarehouseCall(CreateValidationInWarehouseV } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createValidationInWarehouseValidateBeforeCall(CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createValidationInWarehouseValidateBeforeCall( + CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'createValidationInWarehouseV1Input' is set if (createValidationInWarehouseV1Input == null) { - throw new ApiException("Missing the required parameter 'createValidationInWarehouseV1Input' when calling createValidationInWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'createValidationInWarehouseV1Input' when" + + " calling createValidationInWarehouse(Async)"); } - - - okhttp3.Call localVarCall = createValidationInWarehouseCall(createValidationInWarehouseV1Input, _callback); - return localVarCall; + return createValidationInWarehouseCall(createValidationInWarehouseV1Input, _callback); } /** - * Create Validation in Warehouse - * Validates input settings against a Warehouse. When called, this endpoint may generate the `Storage Destination Settings Validation` [Audit Trail](/tag/Audit-Trail) event. - * @param createValidationInWarehouseV1Input (required) + * Create Validation in Warehouse Validates input settings against a Warehouse. • When called, + * this endpoint may generate the `Storage Destination Settings Validation` event in + * the [audit trail](/tag/Audit-Trail). + * + * @param createValidationInWarehouseV1Input (required) * @return CreateValidationInWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateValidationInWarehouse200Response createValidationInWarehouse(CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input) throws ApiException { - ApiResponse localVarResp = createValidationInWarehouseWithHttpInfo(createValidationInWarehouseV1Input); + public CreateValidationInWarehouse200Response createValidationInWarehouse( + CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input) + throws ApiException { + ApiResponse localVarResp = + createValidationInWarehouseWithHttpInfo(createValidationInWarehouseV1Input); return localVarResp.getData(); } /** - * Create Validation in Warehouse - * Validates input settings against a Warehouse. When called, this endpoint may generate the `Storage Destination Settings Validation` [Audit Trail](/tag/Audit-Trail) event. - * @param createValidationInWarehouseV1Input (required) + * Create Validation in Warehouse Validates input settings against a Warehouse. • When called, + * this endpoint may generate the `Storage Destination Settings Validation` event in + * the [audit trail](/tag/Audit-Trail). + * + * @param createValidationInWarehouseV1Input (required) * @return ApiResponse<CreateValidationInWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createValidationInWarehouseWithHttpInfo(CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input) throws ApiException { - okhttp3.Call localVarCall = createValidationInWarehouseValidateBeforeCall(createValidationInWarehouseV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + createValidationInWarehouseWithHttpInfo( + CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input) + throws ApiException { + okhttp3.Call localVarCall = + createValidationInWarehouseValidateBeforeCall( + createValidationInWarehouseV1Input, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Validation in Warehouse (asynchronously) - * Validates input settings against a Warehouse. When called, this endpoint may generate the `Storage Destination Settings Validation` [Audit Trail](/tag/Audit-Trail) event. - * @param createValidationInWarehouseV1Input (required) + * Create Validation in Warehouse (asynchronously) Validates input settings against a Warehouse. + * • When called, this endpoint may generate the `Storage Destination Settings + * Validation` event in the [audit trail](/tag/Audit-Trail). + * + * @param createValidationInWarehouseV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createValidationInWarehouseAsync(CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createValidationInWarehouseValidateBeforeCall(createValidationInWarehouseV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createValidationInWarehouseAsync( + CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createValidationInWarehouseValidateBeforeCall( + createValidationInWarehouseV1Input, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for createWarehouse - * @param createWarehouseV1Input (required) + * + * @param createWarehouseV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createWarehouseCall(CreateWarehouseV1Input createWarehouseV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createWarehouseCall( + CreateWarehouseV1Input createWarehouseV1Input, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -415,7 +498,10 @@ public okhttp3.Call createWarehouseCall(CreateWarehouseV1Input createWarehouseV1 Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -423,119 +509,151 @@ public okhttp3.Call createWarehouseCall(CreateWarehouseV1Input createWarehouseV1 } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createWarehouseValidateBeforeCall(CreateWarehouseV1Input createWarehouseV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call createWarehouseValidateBeforeCall( + CreateWarehouseV1Input createWarehouseV1Input, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'createWarehouseV1Input' is set if (createWarehouseV1Input == null) { - throw new ApiException("Missing the required parameter 'createWarehouseV1Input' when calling createWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'createWarehouseV1Input' when calling" + + " createWarehouse(Async)"); } - - - okhttp3.Call localVarCall = createWarehouseCall(createWarehouseV1Input, _callback); - return localVarCall; + return createWarehouseCall(createWarehouseV1Input, _callback); } /** - * Create Warehouse - * Creates a new Warehouse. When called, this endpoint may generate the `Storage Destination Created` [Audit Trail](/tag/Audit-Trail) event. - * @param createWarehouseV1Input (required) - * @return CreateWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * Create Warehouse Creates a new Warehouse. • When called, this endpoint may generate the + * `Storage Destination Created` event in the [audit trail](/tag/Audit-Trail). + * + * @param createWarehouseV1Input (required) + * @return CreateWarehouse201Response + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public CreateWarehouse200Response createWarehouse(CreateWarehouseV1Input createWarehouseV1Input) throws ApiException { - ApiResponse localVarResp = createWarehouseWithHttpInfo(createWarehouseV1Input); + public CreateWarehouse201Response createWarehouse(CreateWarehouseV1Input createWarehouseV1Input) + throws ApiException { + ApiResponse localVarResp = + createWarehouseWithHttpInfo(createWarehouseV1Input); return localVarResp.getData(); } /** - * Create Warehouse - * Creates a new Warehouse. When called, this endpoint may generate the `Storage Destination Created` [Audit Trail](/tag/Audit-Trail) event. - * @param createWarehouseV1Input (required) - * @return ApiResponse<CreateWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * Create Warehouse Creates a new Warehouse. • When called, this endpoint may generate the + * `Storage Destination Created` event in the [audit trail](/tag/Audit-Trail). + * + * @param createWarehouseV1Input (required) + * @return ApiResponse<CreateWarehouse201Response> + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse createWarehouseWithHttpInfo(CreateWarehouseV1Input createWarehouseV1Input) throws ApiException { + public ApiResponse createWarehouseWithHttpInfo( + CreateWarehouseV1Input createWarehouseV1Input) throws ApiException { okhttp3.Call localVarCall = createWarehouseValidateBeforeCall(createWarehouseV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Warehouse (asynchronously) - * Creates a new Warehouse. When called, this endpoint may generate the `Storage Destination Created` [Audit Trail](/tag/Audit-Trail) event. - * @param createWarehouseV1Input (required) + * Create Warehouse (asynchronously) Creates a new Warehouse. • When called, this endpoint may + * generate the `Storage Destination Created` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param createWarehouseV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
201 Created -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call createWarehouseAsync(CreateWarehouseV1Input createWarehouseV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createWarehouseValidateBeforeCall(createWarehouseV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call createWarehouseAsync( + CreateWarehouseV1Input createWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createWarehouseValidateBeforeCall(createWarehouseV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for deleteWarehouse - * @param warehouseId (required) + * + * @param warehouseId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteWarehouseCall(String warehouseId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteWarehouseCall(String warehouseId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -544,8 +662,11 @@ public okhttp3.Call deleteWarehouseCall(String warehouseId, final ApiCallback _c Object localVarPostBody = null; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())); + String localVarPath = + "/warehouses/{warehouseId}" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -554,127 +675,153 @@ public okhttp3.Call deleteWarehouseCall(String warehouseId, final ApiCallback _c Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteWarehouseValidateBeforeCall(String warehouseId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call deleteWarehouseValidateBeforeCall( + String warehouseId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling deleteWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " deleteWarehouse(Async)"); } - - - okhttp3.Call localVarCall = deleteWarehouseCall(warehouseId, _callback); - return localVarCall; + return deleteWarehouseCall(warehouseId, _callback); } /** - * Delete Warehouse - * Deletes an existing Warehouse. When called, this endpoint may generate the `Storage Destination Deleted` [Audit Trail](/tag/Audit-Trail) event. - * @param warehouseId (required) + * Delete Warehouse Deletes an existing Warehouse. • When called, this endpoint may generate the + * `Storage Destination Deleted` event in the [audit trail](/tag/Audit-Trail). + * + * @param warehouseId (required) * @return DeleteWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public DeleteWarehouse200Response deleteWarehouse(String warehouseId) throws ApiException { - ApiResponse localVarResp = deleteWarehouseWithHttpInfo(warehouseId); + ApiResponse localVarResp = + deleteWarehouseWithHttpInfo(warehouseId); return localVarResp.getData(); } /** - * Delete Warehouse - * Deletes an existing Warehouse. When called, this endpoint may generate the `Storage Destination Deleted` [Audit Trail](/tag/Audit-Trail) event. - * @param warehouseId (required) + * Delete Warehouse Deletes an existing Warehouse. • When called, this endpoint may generate the + * `Storage Destination Deleted` event in the [audit trail](/tag/Audit-Trail). + * + * @param warehouseId (required) * @return ApiResponse<DeleteWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse deleteWarehouseWithHttpInfo(String warehouseId) throws ApiException { + public ApiResponse deleteWarehouseWithHttpInfo(String warehouseId) + throws ApiException { okhttp3.Call localVarCall = deleteWarehouseValidateBeforeCall(warehouseId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Delete Warehouse (asynchronously) - * Deletes an existing Warehouse. When called, this endpoint may generate the `Storage Destination Deleted` [Audit Trail](/tag/Audit-Trail) event. - * @param warehouseId (required) + * Delete Warehouse (asynchronously) Deletes an existing Warehouse. • When called, this endpoint + * may generate the `Storage Destination Deleted` event in the [audit + * trail](/tag/Audit-Trail). + * + * @param warehouseId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call deleteWarehouseAsync(String warehouseId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteWarehouseAsync( + String warehouseId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = deleteWarehouseValidateBeforeCall(warehouseId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getConnectionStateFromWarehouse - * @param warehouseId (required) + * + * @param warehouseId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getConnectionStateFromWarehouseCall(String warehouseId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getConnectionStateFromWarehouseCall( + String warehouseId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -683,8 +830,11 @@ public okhttp3.Call getConnectionStateFromWarehouseCall(String warehouseId, fina Object localVarPostBody = null; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}/connection-state" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())); + String localVarPath = + "/warehouses/{warehouseId}/connection-state" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -693,127 +843,167 @@ public okhttp3.Call getConnectionStateFromWarehouseCall(String warehouseId, fina Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getConnectionStateFromWarehouseValidateBeforeCall(String warehouseId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getConnectionStateFromWarehouseValidateBeforeCall( + String warehouseId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling getConnectionStateFromWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " getConnectionStateFromWarehouse(Async)"); } - - - okhttp3.Call localVarCall = getConnectionStateFromWarehouseCall(warehouseId, _callback); - return localVarCall; + return getConnectionStateFromWarehouseCall(warehouseId, _callback); } /** - * Get Connection State from Warehouse - * Verifies the state of Warehouse connection settings. The rate limit for this endpoint is 20 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) + * Get Connection State from Warehouse Verifies the state of Warehouse connection settings. The + * rate limit for this endpoint is 200 requests per minute, which is lower than the default due + * to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) * @return GetConnectionStateFromWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public GetConnectionStateFromWarehouse200Response getConnectionStateFromWarehouse(String warehouseId) throws ApiException { - ApiResponse localVarResp = getConnectionStateFromWarehouseWithHttpInfo(warehouseId); + public GetConnectionStateFromWarehouse200Response getConnectionStateFromWarehouse( + String warehouseId) throws ApiException { + ApiResponse localVarResp = + getConnectionStateFromWarehouseWithHttpInfo(warehouseId); return localVarResp.getData(); } /** - * Get Connection State from Warehouse - * Verifies the state of Warehouse connection settings. The rate limit for this endpoint is 20 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) + * Get Connection State from Warehouse Verifies the state of Warehouse connection settings. The + * rate limit for this endpoint is 200 requests per minute, which is lower than the default due + * to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP + * status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (required) * @return ApiResponse<GetConnectionStateFromWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getConnectionStateFromWarehouseWithHttpInfo(String warehouseId) throws ApiException { - okhttp3.Call localVarCall = getConnectionStateFromWarehouseValidateBeforeCall(warehouseId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + getConnectionStateFromWarehouseWithHttpInfo(String warehouseId) throws ApiException { + okhttp3.Call localVarCall = + getConnectionStateFromWarehouseValidateBeforeCall(warehouseId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Connection State from Warehouse (asynchronously) - * Verifies the state of Warehouse connection settings. The rate limit for this endpoint is 20 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate Limiting](/#tag/Rate-Limits) for more information. - * @param warehouseId (required) + * Get Connection State from Warehouse (asynchronously) Verifies the state of Warehouse + * connection settings. The rate limit for this endpoint is 200 requests per minute, which is + * lower than the default due to access pattern restrictions. Once reached, this endpoint will + * respond with the 429 HTTP status code with headers indicating the limit parameters. See [Rate + * Limiting](/#tag/Rate-Limits) for more information. + * + * @param warehouseId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getConnectionStateFromWarehouseAsync(String warehouseId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getConnectionStateFromWarehouseValidateBeforeCall(warehouseId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call getConnectionStateFromWarehouseAsync( + String warehouseId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getConnectionStateFromWarehouseValidateBeforeCall(warehouseId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for getWarehouse - * @param warehouseId (required) + * + * @param warehouseId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getWarehouseCall(String warehouseId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getWarehouseCall(String warehouseId, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -822,8 +1012,11 @@ public okhttp3.Call getWarehouseCall(String warehouseId, final ApiCallback _call Object localVarPostBody = null; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())); + String localVarPath = + "/warehouses/{warehouseId}" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -832,53 +1025,66 @@ public okhttp3.Call getWarehouseCall(String warehouseId, final ApiCallback _call Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getWarehouseValidateBeforeCall(String warehouseId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call getWarehouseValidateBeforeCall( + String warehouseId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling getWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " getWarehouse(Async)"); } - - - okhttp3.Call localVarCall = getWarehouseCall(warehouseId, _callback); - return localVarCall; + return getWarehouseCall(warehouseId, _callback); } /** - * Get Warehouse - * Returns a Warehouse by its id. - * @param warehouseId (required) + * Get Warehouse Returns a Warehouse by its id. + * + * @param warehouseId (required) * @return GetWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public GetWarehouse200Response getWarehouse(String warehouseId) throws ApiException { ApiResponse localVarResp = getWarehouseWithHttpInfo(warehouseId); @@ -886,74 +1092,83 @@ public GetWarehouse200Response getWarehouse(String warehouseId) throws ApiExcept } /** - * Get Warehouse - * Returns a Warehouse by its id. - * @param warehouseId (required) + * Get Warehouse Returns a Warehouse by its id. + * + * @param warehouseId (required) * @return ApiResponse<GetWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse getWarehouseWithHttpInfo(String warehouseId) throws ApiException { + public ApiResponse getWarehouseWithHttpInfo(String warehouseId) + throws ApiException { okhttp3.Call localVarCall = getWarehouseValidateBeforeCall(warehouseId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Warehouse (asynchronously) - * Returns a Warehouse by its id. - * @param warehouseId (required) + * Get Warehouse (asynchronously) Returns a Warehouse by its id. + * + * @param warehouseId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getWarehouseAsync(String warehouseId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getWarehouseAsync( + String warehouseId, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = getWarehouseValidateBeforeCall(warehouseId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listConnectedSourcesFromWarehouse - * @param warehouseId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * + * @param warehouseId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listConnectedSourcesFromWarehouseCall(String warehouseId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listConnectedSourcesFromWarehouseCall( + String warehouseId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -962,8 +1177,11 @@ public okhttp3.Call listConnectedSourcesFromWarehouseCall(String warehouseId, Pa Object localVarPostBody = null; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}/connected-sources" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())); + String localVarPath = + "/warehouses/{warehouseId}/connected-sources" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -976,135 +1194,165 @@ public okhttp3.Call listConnectedSourcesFromWarehouseCall(String warehouseId, Pa } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listConnectedSourcesFromWarehouseValidateBeforeCall(String warehouseId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call listConnectedSourcesFromWarehouseValidateBeforeCall( + String warehouseId, PaginationInput pagination, final ApiCallback _callback) + throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling listConnectedSourcesFromWarehouse(Async)"); - } - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listConnectedSourcesFromWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " listConnectedSourcesFromWarehouse(Async)"); } - - - okhttp3.Call localVarCall = listConnectedSourcesFromWarehouseCall(warehouseId, pagination, _callback); - return localVarCall; + return listConnectedSourcesFromWarehouseCall(warehouseId, pagination, _callback); } /** - * List Connected Sources from Warehouse - * Returns the list of Sources that are connected to a Warehouse. - * @param warehouseId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Connected Sources from Warehouse Returns the list of Sources that are connected to a + * Warehouse. + * + * @param warehouseId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ListConnectedSourcesFromWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListConnectedSourcesFromWarehouse200Response listConnectedSourcesFromWarehouse(String warehouseId, PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listConnectedSourcesFromWarehouseWithHttpInfo(warehouseId, pagination); + public ListConnectedSourcesFromWarehouse200Response listConnectedSourcesFromWarehouse( + String warehouseId, PaginationInput pagination) throws ApiException { + ApiResponse localVarResp = + listConnectedSourcesFromWarehouseWithHttpInfo(warehouseId, pagination); return localVarResp.getData(); } /** - * List Connected Sources from Warehouse - * Returns the list of Sources that are connected to a Warehouse. - * @param warehouseId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Connected Sources from Warehouse Returns the list of Sources that are connected to a + * Warehouse. + * + * @param warehouseId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ApiResponse<ListConnectedSourcesFromWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listConnectedSourcesFromWarehouseWithHttpInfo(String warehouseId, PaginationInput pagination) throws ApiException { - okhttp3.Call localVarCall = listConnectedSourcesFromWarehouseValidateBeforeCall(warehouseId, pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + listConnectedSourcesFromWarehouseWithHttpInfo( + String warehouseId, PaginationInput pagination) throws ApiException { + okhttp3.Call localVarCall = + listConnectedSourcesFromWarehouseValidateBeforeCall(warehouseId, pagination, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Connected Sources from Warehouse (asynchronously) - * Returns the list of Sources that are connected to a Warehouse. - * @param warehouseId (required) - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Connected Sources from Warehouse (asynchronously) Returns the list of Sources that are + * connected to a Warehouse. + * + * @param warehouseId (required) + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listConnectedSourcesFromWarehouseAsync(String warehouseId, PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listConnectedSourcesFromWarehouseValidateBeforeCall(warehouseId, pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call listConnectedSourcesFromWarehouseAsync( + String warehouseId, + PaginationInput pagination, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listConnectedSourcesFromWarehouseValidateBeforeCall( + warehouseId, pagination, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for listWarehouses - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 -
404 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listWarehousesCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listWarehousesCall(PaginationInput pagination, final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1126,128 +1374,144 @@ public okhttp3.Call listWarehousesCall(PaginationInput pagination, final ApiCall } final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call listWarehousesValidateBeforeCall(PaginationInput pagination, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'pagination' is set - if (pagination == null) { - throw new ApiException("Missing the required parameter 'pagination' when calling listWarehouses(Async)"); - } - - - okhttp3.Call localVarCall = listWarehousesCall(pagination, _callback); - return localVarCall; - + private okhttp3.Call listWarehousesValidateBeforeCall( + PaginationInput pagination, final ApiCallback _callback) throws ApiException { + return listWarehousesCall(pagination, _callback); } /** - * List Warehouses - * Returns a list of Warehouses. - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Warehouses Returns a list of Warehouses. + * + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ListWarehouses200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ListWarehouses200Response listWarehouses(PaginationInput pagination) throws ApiException { - ApiResponse localVarResp = listWarehousesWithHttpInfo(pagination); + public ListWarehouses200Response listWarehouses(PaginationInput pagination) + throws ApiException { + ApiResponse localVarResp = + listWarehousesWithHttpInfo(pagination); return localVarResp.getData(); } /** - * List Warehouses - * Returns a list of Warehouses. - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Warehouses Returns a list of Warehouses. + * + * @param pagination Defines the pagination parameters. This parameter exists in v1. (optional) * @return ApiResponse<ListWarehouses200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse listWarehousesWithHttpInfo(PaginationInput pagination) throws ApiException { + public ApiResponse listWarehousesWithHttpInfo( + PaginationInput pagination) throws ApiException { okhttp3.Call localVarCall = listWarehousesValidateBeforeCall(pagination, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Warehouses (asynchronously) - * Returns a list of Warehouses. - * @param pagination Defines the pagination parameters. This parameter exists in alpha. (required) + * List Warehouses (asynchronously) Returns a list of Warehouses. + * + * @param pagination Defines the pagination parameters. This parameter exists in v1. (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call listWarehousesAsync(PaginationInput pagination, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listWarehousesAsync( + PaginationInput pagination, final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = listWarehousesValidateBeforeCall(pagination, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for removeSourceConnectionFromWarehouse - * @param warehouseId (required) - * @param sourceId (required) + * + * @param warehouseId (required) + * @param sourceId (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call removeSourceConnectionFromWarehouseCall(String warehouseId, String sourceId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call removeSourceConnectionFromWarehouseCall( + String warehouseId, String sourceId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1256,9 +1520,14 @@ public okhttp3.Call removeSourceConnectionFromWarehouseCall(String warehouseId, Object localVarPostBody = null; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}/connected-sources/{sourceId}" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())) - .replaceAll("\\{" + "sourceId" + "\\}", localVarApiClient.escapeString(sourceId.toString())); + String localVarPath = + "/warehouses/{warehouseId}/connected-sources/{sourceId}" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())) + .replace( + "{" + "sourceId" + "}", + localVarApiClient.escapeString(sourceId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1267,136 +1536,173 @@ public okhttp3.Call removeSourceConnectionFromWarehouseCall(String warehouseId, Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call removeSourceConnectionFromWarehouseValidateBeforeCall(String warehouseId, String sourceId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call removeSourceConnectionFromWarehouseValidateBeforeCall( + String warehouseId, String sourceId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling removeSourceConnectionFromWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " removeSourceConnectionFromWarehouse(Async)"); } - + // verify the required parameter 'sourceId' is set if (sourceId == null) { - throw new ApiException("Missing the required parameter 'sourceId' when calling removeSourceConnectionFromWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'sourceId' when calling" + + " removeSourceConnectionFromWarehouse(Async)"); } - - - okhttp3.Call localVarCall = removeSourceConnectionFromWarehouseCall(warehouseId, sourceId, _callback); - return localVarCall; + return removeSourceConnectionFromWarehouseCall(warehouseId, sourceId, _callback); } /** - * Remove Source Connection from Warehouse - * Disconnects a Source from a Warehouse. - * @param warehouseId (required) - * @param sourceId (required) + * Remove Source Connection from Warehouse Disconnects a Source from a Warehouse. + * + * @param warehouseId (required) + * @param sourceId (required) * @return RemoveSourceConnectionFromWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public RemoveSourceConnectionFromWarehouse200Response removeSourceConnectionFromWarehouse(String warehouseId, String sourceId) throws ApiException { - ApiResponse localVarResp = removeSourceConnectionFromWarehouseWithHttpInfo(warehouseId, sourceId); + public RemoveSourceConnectionFromWarehouse200Response removeSourceConnectionFromWarehouse( + String warehouseId, String sourceId) throws ApiException { + ApiResponse localVarResp = + removeSourceConnectionFromWarehouseWithHttpInfo(warehouseId, sourceId); return localVarResp.getData(); } /** - * Remove Source Connection from Warehouse - * Disconnects a Source from a Warehouse. - * @param warehouseId (required) - * @param sourceId (required) + * Remove Source Connection from Warehouse Disconnects a Source from a Warehouse. + * + * @param warehouseId (required) + * @param sourceId (required) * @return ApiResponse<RemoveSourceConnectionFromWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse removeSourceConnectionFromWarehouseWithHttpInfo(String warehouseId, String sourceId) throws ApiException { - okhttp3.Call localVarCall = removeSourceConnectionFromWarehouseValidateBeforeCall(warehouseId, sourceId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse + removeSourceConnectionFromWarehouseWithHttpInfo(String warehouseId, String sourceId) + throws ApiException { + okhttp3.Call localVarCall = + removeSourceConnectionFromWarehouseValidateBeforeCall(warehouseId, sourceId, null); + Type localVarReturnType = + new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Remove Source Connection from Warehouse (asynchronously) - * Disconnects a Source from a Warehouse. - * @param warehouseId (required) - * @param sourceId (required) + * Remove Source Connection from Warehouse (asynchronously) Disconnects a Source from a + * Warehouse. + * + * @param warehouseId (required) + * @param sourceId (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call removeSourceConnectionFromWarehouseAsync(String warehouseId, String sourceId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = removeSourceConnectionFromWarehouseValidateBeforeCall(warehouseId, sourceId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call removeSourceConnectionFromWarehouseAsync( + String warehouseId, + String sourceId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeSourceConnectionFromWarehouseValidateBeforeCall( + warehouseId, sourceId, _callback); + Type localVarReturnType = + new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** * Build call for updateWarehouse - * @param warehouseId (required) - * @param updateWarehouseV1Input (required) + * + * @param warehouseId (required) + * @param updateWarehouseV1Input (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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateWarehouseCall(String warehouseId, UpdateWarehouseV1Input updateWarehouseV1Input, final ApiCallback _callback) throws ApiException { + public okhttp3.Call updateWarehouseCall( + String warehouseId, + UpdateWarehouseV1Input updateWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1405,8 +1711,11 @@ public okhttp3.Call updateWarehouseCall(String warehouseId, UpdateWarehouseV1Inp Object localVarPostBody = updateWarehouseV1Input; // create path and map variables - String localVarPath = "/warehouses/{warehouseId}" - .replaceAll("\\{" + "warehouseId" + "\\}", localVarApiClient.escapeString(warehouseId.toString())); + String localVarPath = + "/warehouses/{warehouseId}" + .replace( + "{" + "warehouseId" + "}", + localVarApiClient.escapeString(warehouseId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1415,7 +1724,10 @@ public okhttp3.Call updateWarehouseCall(String warehouseId, UpdateWarehouseV1Inp Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -1423,100 +1735,137 @@ public okhttp3.Call updateWarehouseCall(String warehouseId, UpdateWarehouseV1Inp } final String[] localVarContentTypes = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json" + "application/json", + "application/vnd.segment.v1+json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateWarehouseValidateBeforeCall(String warehouseId, UpdateWarehouseV1Input updateWarehouseV1Input, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call updateWarehouseValidateBeforeCall( + String warehouseId, + UpdateWarehouseV1Input updateWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { // verify the required parameter 'warehouseId' is set if (warehouseId == null) { - throw new ApiException("Missing the required parameter 'warehouseId' when calling updateWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'warehouseId' when calling" + + " updateWarehouse(Async)"); } - + // verify the required parameter 'updateWarehouseV1Input' is set if (updateWarehouseV1Input == null) { - throw new ApiException("Missing the required parameter 'updateWarehouseV1Input' when calling updateWarehouse(Async)"); + throw new ApiException( + "Missing the required parameter 'updateWarehouseV1Input' when calling" + + " updateWarehouse(Async)"); } - - - okhttp3.Call localVarCall = updateWarehouseCall(warehouseId, updateWarehouseV1Input, _callback); - return localVarCall; + return updateWarehouseCall(warehouseId, updateWarehouseV1Input, _callback); } /** - * Update Warehouse - * Updates an existing Warehouse. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Storage Destination Modified * Storage Destination Enabled - * @param warehouseId (required) - * @param updateWarehouseV1Input (required) + * Update Warehouse Updates an existing Warehouse. • When called, this endpoint may generate one + * or more of the following [audit trail](/tag/Audit-Trail) events:* Storage Destination + * Modified * Storage Destination Enabled + * + * @param warehouseId (required) + * @param updateWarehouseV1Input (required) * @return UpdateWarehouse200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public UpdateWarehouse200Response updateWarehouse(String warehouseId, UpdateWarehouseV1Input updateWarehouseV1Input) throws ApiException { - ApiResponse localVarResp = updateWarehouseWithHttpInfo(warehouseId, updateWarehouseV1Input); + public UpdateWarehouse200Response updateWarehouse( + String warehouseId, UpdateWarehouseV1Input updateWarehouseV1Input) throws ApiException { + ApiResponse localVarResp = + updateWarehouseWithHttpInfo(warehouseId, updateWarehouseV1Input); return localVarResp.getData(); } /** - * Update Warehouse - * Updates an existing Warehouse. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Storage Destination Modified * Storage Destination Enabled - * @param warehouseId (required) - * @param updateWarehouseV1Input (required) + * Update Warehouse Updates an existing Warehouse. • When called, this endpoint may generate one + * or more of the following [audit trail](/tag/Audit-Trail) events:* Storage Destination + * Modified * Storage Destination Enabled + * + * @param warehouseId (required) + * @param updateWarehouseV1Input (required) * @return ApiResponse<UpdateWarehouse200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public ApiResponse updateWarehouseWithHttpInfo(String warehouseId, UpdateWarehouseV1Input updateWarehouseV1Input) throws ApiException { - okhttp3.Call localVarCall = updateWarehouseValidateBeforeCall(warehouseId, updateWarehouseV1Input, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse updateWarehouseWithHttpInfo( + String warehouseId, UpdateWarehouseV1Input updateWarehouseV1Input) throws ApiException { + okhttp3.Call localVarCall = + updateWarehouseValidateBeforeCall(warehouseId, updateWarehouseV1Input, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Warehouse (asynchronously) - * Updates an existing Warehouse. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Storage Destination Modified * Storage Destination Enabled - * @param warehouseId (required) - * @param updateWarehouseV1Input (required) + * Update Warehouse (asynchronously) Updates an existing Warehouse. • When called, this endpoint + * may generate one or more of the following [audit trail](/tag/Audit-Trail) events:* Storage + * Destination Modified * Storage Destination Enabled + * + * @param warehouseId (required) + * @param updateWarehouseV1Input (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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call updateWarehouseAsync(String warehouseId, UpdateWarehouseV1Input updateWarehouseV1Input, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateWarehouseValidateBeforeCall(warehouseId, updateWarehouseV1Input, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + public okhttp3.Call updateWarehouseAsync( + String warehouseId, + UpdateWarehouseV1Input updateWarehouseV1Input, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateWarehouseValidateBeforeCall(warehouseId, updateWarehouseV1Input, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/api/WorkspacesApi.java b/src/main/java/com/segment/publicapi/api/WorkspacesApi.java index d4b77184..c4a0dc0c 100644 --- a/src/main/java/com/segment/publicapi/api/WorkspacesApi.java +++ b/src/main/java/com/segment/publicapi/api/WorkspacesApi.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,32 +9,21 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; +import com.google.gson.reflect.TypeToken; import com.segment.publicapi.ApiCallback; import com.segment.publicapi.ApiClient; import com.segment.publicapi.ApiException; import com.segment.publicapi.ApiResponse; import com.segment.publicapi.Configuration; import com.segment.publicapi.Pair; -import com.segment.publicapi.ProgressRequestBody; -import com.segment.publicapi.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.segment.publicapi.models.GetWorkspace200Response; -import com.segment.publicapi.models.RequestErrorEnvelope; - import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.GenericType; public class WorkspacesApi { private ApiClient localVarApiClient; @@ -76,27 +64,28 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getWorkspace + * * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public okhttp3.Call getWorkspaceCall(final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { }; + String[] localBasePaths = new String[] {}; // Determine Base Path to Use - if (localCustomBaseUrl != null){ + if (localCustomBaseUrl != null) { basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { + } else if (localBasePaths.length > 0) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -114,47 +103,58 @@ public okhttp3.Call getWorkspaceCall(final ApiCallback _callback) throws ApiExce Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "application/vnd.segment.v1alpha+json", "application/vnd.segment.v1beta+json", "application/vnd.segment.v1+json", "application/json" + "application/vnd.segment.v1+json", + "application/json", + "application/vnd.segment.v1beta+json", + "application/vnd.segment.v1alpha+json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "token" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + String[] localVarAuthNames = new String[] {"token"}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getWorkspaceValidateBeforeCall(final ApiCallback _callback) throws ApiException { - - - okhttp3.Call localVarCall = getWorkspaceCall(_callback); - return localVarCall; - + private okhttp3.Call getWorkspaceValidateBeforeCall(final ApiCallback _callback) + throws ApiException { + return getWorkspaceCall(_callback); } /** - * Get Workspace - * Returns the Workspace associated with the token used to access this resource. + * Get Workspace Returns the Workspace associated with the token used to access this resource. + * * @return GetWorkspace200Response - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public GetWorkspace200Response getWorkspace() throws ApiException { ApiResponse localVarResp = getWorkspaceWithHttpInfo(); @@ -162,44 +162,48 @@ public GetWorkspace200Response getWorkspace() throws ApiException { } /** - * Get Workspace - * Returns the Workspace associated with the token used to access this resource. + * Get Workspace Returns the Workspace associated with the token used to access this resource. + * * @return ApiResponse<GetWorkspace200Response> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ public ApiResponse getWorkspaceWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = getWorkspaceValidateBeforeCall(null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Workspace (asynchronously) - * Returns the Workspace associated with the token used to access this resource. + * Get Workspace (asynchronously) Returns the Workspace associated with the token used to access + * this resource. + * * @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 + * @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 Resource not found -
422 Validation failure -
429 Too many requests -
+ * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
404 Resource not found -
422 Validation failure -
429 Too many requests -
*/ - public okhttp3.Call getWorkspaceAsync(final ApiCallback _callback) throws ApiException { + public okhttp3.Call getWorkspaceAsync(final ApiCallback _callback) + throws ApiException { okhttp3.Call localVarCall = getWorkspaceValidateBeforeCall(_callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/segment/publicapi/auth/ApiKeyAuth.java b/src/main/java/com/segment/publicapi/auth/ApiKeyAuth.java index f4e9c829..e55ea17c 100644 --- a/src/main/java/com/segment/publicapi/auth/ApiKeyAuth.java +++ b/src/main/java/com/segment/publicapi/auth/ApiKeyAuth.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,71 +9,74 @@ * Do not edit the class manually. */ - package com.segment.publicapi.auth; import com.segment.publicapi.ApiException; import com.segment.publicapi.Pair; - import java.net.URI; -import java.util.Map; import java.util.List; - +import java.util.Map; 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; - } + private final String location; + private final String paramName; - public String getLocation() { - return location; - } + private String apiKey; + private String apiKeyPrefix; - public String getParamName() { - return paramName; - } + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } - public String getApiKey() { - return apiKey; - } + public String getLocation() { + return location; + } - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } + public String getParamName() { + return paramName; + } - public String getApiKeyPrefix() { - return apiKeyPrefix; - } + public String getApiKey() { + return apiKey; + } - public void setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - } + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) throws ApiException { - if (apiKey == null) { - return; + public String getApiKeyPrefix() { + return apiKeyPrefix; } - String value; - if (apiKeyPrefix != null) { - value = apiKeyPrefix + " " + apiKey; - } else { - value = apiKey; + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; } - 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); + + @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/com/segment/publicapi/auth/Authentication.java b/src/main/java/com/segment/publicapi/auth/Authentication.java index cffcb3e3..29dcd339 100644 --- a/src/main/java/com/segment/publicapi/auth/Authentication.java +++ b/src/main/java/com/segment/publicapi/auth/Authentication.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,15 +9,13 @@ * Do not edit the class manually. */ - package com.segment.publicapi.auth; -import com.segment.publicapi.Pair; import com.segment.publicapi.ApiException; - +import com.segment.publicapi.Pair; import java.net.URI; -import java.util.Map; import java.util.List; +import java.util.Map; public interface Authentication { /** @@ -32,5 +29,12 @@ public interface Authentication { * @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; + void applyToParams( + List queryParams, + Map headerParams, + Map cookieParams, + String payload, + String method, + URI uri) + throws ApiException; } diff --git a/src/main/java/com/segment/publicapi/auth/HttpBasicAuth.java b/src/main/java/com/segment/publicapi/auth/HttpBasicAuth.java index 0d9da4e6..d0c1cc61 100644 --- a/src/main/java/com/segment/publicapi/auth/HttpBasicAuth.java +++ b/src/main/java/com/segment/publicapi/auth/HttpBasicAuth.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,19 +9,14 @@ * Do not edit the class manually. */ - package com.segment.publicapi.auth; -import com.segment.publicapi.Pair; import com.segment.publicapi.ApiException; - -import okhttp3.Credentials; - +import com.segment.publicapi.Pair; import java.net.URI; -import java.util.Map; import java.util.List; - -import java.io.UnsupportedEncodingException; +import java.util.Map; +import okhttp3.Credentials; public class HttpBasicAuth implements Authentication { private String username; @@ -45,13 +39,20 @@ public void setPassword(String password) { } @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams, - String payload, String method, URI uri) throws ApiException { + 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)); + headerParams.put( + "Authorization", + Credentials.basic( + username == null ? "" : username, password == null ? "" : password)); } } diff --git a/src/main/java/com/segment/publicapi/auth/HttpBearerAuth.java b/src/main/java/com/segment/publicapi/auth/HttpBearerAuth.java index dd01c029..60799dea 100644 --- a/src/main/java/com/segment/publicapi/auth/HttpBearerAuth.java +++ b/src/main/java/com/segment/publicapi/auth/HttpBearerAuth.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,54 +9,61 @@ * Do not edit the class manually. */ - package com.segment.publicapi.auth; import com.segment.publicapi.ApiException; import com.segment.publicapi.Pair; - import java.net.URI; -import java.util.Map; import java.util.List; - +import java.util.Map; 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; + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; } - headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); - } + /** + * 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; + } - private static String upperCaseBearer(String scheme) { - return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; - } + /** + * 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/com/segment/publicapi/models/APICallSnapshotV1.java b/src/main/java/com/segment/publicapi/models/APICallSnapshotV1.java index 59c19103..92744319 100644 --- a/src/main/java/com/segment/publicapi/models/APICallSnapshotV1.java +++ b/src/main/java/com/segment/publicapi/models/APICallSnapshotV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,242 +9,235 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * A snapshot of the number of API calls for a given Workspace. - */ -@ApiModel(description = "A snapshot of the number of API calls for a given Workspace.") - +/** A snapshot of the number of API calls for a given Workspace. */ public class APICallSnapshotV1 { - public static final String SERIALIZED_NAME_API_CALLS = "apiCalls"; - @SerializedName(SERIALIZED_NAME_API_CALLS) - private String apiCalls; + public static final String SERIALIZED_NAME_API_CALLS = "apiCalls"; - public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; - @SerializedName(SERIALIZED_NAME_TIMESTAMP) - private String timestamp; + @SerializedName(SERIALIZED_NAME_API_CALLS) + private String apiCalls; - public APICallSnapshotV1() { - } + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; - public APICallSnapshotV1 apiCalls(String apiCalls) { - - this.apiCalls = apiCalls; - return this; - } + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + private String timestamp; - /** - * A bigint of the number of API calls in this snapshot. - * @return apiCalls - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A bigint of the number of API calls in this snapshot.") + public APICallSnapshotV1() {} - public String getApiCalls() { - return apiCalls; - } + public APICallSnapshotV1 apiCalls(String apiCalls) { + this.apiCalls = apiCalls; + return this; + } - public void setApiCalls(String apiCalls) { - this.apiCalls = apiCalls; - } - + /** + * A bigint of the number of API calls in this snapshot. + * + * @return apiCalls + */ + @javax.annotation.Nonnull + public String getApiCalls() { + return apiCalls; + } - public APICallSnapshotV1 timestamp(String timestamp) { - - this.timestamp = timestamp; - return this; - } + public void setApiCalls(String apiCalls) { + this.apiCalls = apiCalls; + } - /** - * Timestamp of this snapshot within the billing cycle in the ISO-8601 format. - * @return timestamp - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Timestamp of this snapshot within the billing cycle in the ISO-8601 format.") + public APICallSnapshotV1 timestamp(String timestamp) { - public String getTimestamp() { - return timestamp; - } + this.timestamp = timestamp; + return this; + } + /** + * Timestamp of this snapshot within the billing cycle in the ISO-8601 format. + * + * @return timestamp + */ + @javax.annotation.Nonnull + public String getTimestamp() { + return timestamp; + } - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APICallSnapshotV1 apICallSnapshotV1 = (APICallSnapshotV1) o; + return Objects.equals(this.apiCalls, apICallSnapshotV1.apiCalls) + && Objects.equals(this.timestamp, apICallSnapshotV1.timestamp); + } + @Override + public int hashCode() { + return Objects.hash(apiCalls, timestamp); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APICallSnapshotV1 {\n"); + sb.append(" apiCalls: ").append(toIndentedString(apiCalls)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - APICallSnapshotV1 apICallSnapshotV1 = (APICallSnapshotV1) o; - return Objects.equals(this.apiCalls, apICallSnapshotV1.apiCalls) && - Objects.equals(this.timestamp, apICallSnapshotV1.timestamp); - } - - @Override - public int hashCode() { - return Objects.hash(apiCalls, timestamp); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class APICallSnapshotV1 {\n"); - sb.append(" apiCalls: ").append(toIndentedString(apiCalls)).append("\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("apiCalls"); + openapiFields.add("timestamp"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("apiCalls"); + openapiRequiredFields.add("timestamp"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("apiCalls"); - openapiFields.add("timestamp"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("apiCalls"); - openapiRequiredFields.add("timestamp"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to APICallSnapshotV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!APICallSnapshotV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in APICallSnapshotV1 is not found in the empty JSON string", APICallSnapshotV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to APICallSnapshotV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!APICallSnapshotV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in APICallSnapshotV1 is not found in the" + + " empty JSON string", + APICallSnapshotV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!APICallSnapshotV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `APICallSnapshotV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!APICallSnapshotV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `APICallSnapshotV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : APICallSnapshotV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : APICallSnapshotV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("apiCalls").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `apiCalls` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("apiCalls").toString())); + } + if (!jsonObj.get("timestamp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `timestamp` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("timestamp").toString())); } - } - if (!jsonObj.get("apiCalls").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `apiCalls` to be a primitive type in the JSON string but got `%s`", jsonObj.get("apiCalls").toString())); - } - if (!jsonObj.get("timestamp").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `timestamp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timestamp").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!APICallSnapshotV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'APICallSnapshotV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(APICallSnapshotV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, APICallSnapshotV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public APICallSnapshotV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of APICallSnapshotV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of APICallSnapshotV1 - * @throws IOException if the JSON string is invalid with respect to APICallSnapshotV1 - */ - public static APICallSnapshotV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, APICallSnapshotV1.class); - } - - /** - * Convert an instance of APICallSnapshotV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!APICallSnapshotV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'APICallSnapshotV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(APICallSnapshotV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, APICallSnapshotV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public APICallSnapshotV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of APICallSnapshotV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of APICallSnapshotV1 + * @throws IOException if the JSON string is invalid with respect to APICallSnapshotV1 + */ + public static APICallSnapshotV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, APICallSnapshotV1.class); + } + + /** + * Convert an instance of APICallSnapshotV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AbstractOpenApiSchema.java b/src/main/java/com/segment/publicapi/models/AbstractOpenApiSchema.java index b8cf4100..0adab642 100644 --- a/src/main/java/com/segment/publicapi/models/AbstractOpenApiSchema.java +++ b/src/main/java/com/segment/publicapi/models/AbstractOpenApiSchema.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,21 +9,14 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import com.segment.publicapi.ApiException; -import java.util.Objects; -import java.lang.reflect.Type; import java.util.Map; -import javax.ws.rs.core.GenericType; - -//import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; -/** - * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec - */ +// import com.fasterxml.jackson.annotation.JsonValue; +/** Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object @@ -46,25 +38,30 @@ public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { * * @return an instance of the actual schema/object */ - public abstract Map getSchemas(); + public abstract Map> getSchemas(); /** * Get the actual instance * * @return an instance of the actual schema/object */ - //@JsonValue - public Object getActualInstance() {return instance;} + // @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;} + 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 + * 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 */ @@ -76,7 +73,7 @@ private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { if (object.getActualInstance() == null) { return null; } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { - return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + return getActualInstanceRecursively((AbstractOpenApiSchema) object.getActualInstance()); } else { return object.getActualInstance(); } @@ -103,8 +100,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). */ private String toIndentedString(Object o) { if (o == null) { @@ -121,9 +118,9 @@ public boolean equals(Object o) { 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); + return Objects.equals(this.instance, a.instance) + && Objects.equals(this.isNullable, a.isNullable) + && Objects.equals(this.schemaType, a.schemaType); } @Override @@ -143,7 +140,4 @@ public Boolean isNullable() { return Boolean.FALSE; } } - - - } diff --git a/src/main/java/com/segment/publicapi/models/AccessPermissionV1.java b/src/main/java/com/segment/publicapi/models/AccessPermissionV1.java index 6e1cf34e..817211d9 100644 --- a/src/main/java/com/segment/publicapi/models/AccessPermissionV1.java +++ b/src/main/java/com/segment/publicapi/models/AccessPermissionV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,287 +9,290 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PermissionResourceV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * A permission governing access to a resource. - */ -@ApiModel(description = "A permission governing access to a resource.") - +/** A permission governing access to a resource. */ public class AccessPermissionV1 { - public static final String SERIALIZED_NAME_ROLE_ID = "roleId"; - @SerializedName(SERIALIZED_NAME_ROLE_ID) - private String roleId; - - public static final String SERIALIZED_NAME_ROLE_NAME = "roleName"; - @SerializedName(SERIALIZED_NAME_ROLE_NAME) - private String roleName; + public static final String SERIALIZED_NAME_ROLE_ID = "roleId"; - public static final String SERIALIZED_NAME_RESOURCES = "resources"; - @SerializedName(SERIALIZED_NAME_RESOURCES) - private List resources = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_ROLE_ID) + private String roleId; - public AccessPermissionV1() { - } + public static final String SERIALIZED_NAME_ROLE_NAME = "roleName"; - public AccessPermissionV1 roleId(String roleId) { - - this.roleId = roleId; - return this; - } + @SerializedName(SERIALIZED_NAME_ROLE_NAME) + private String roleName; - /** - * The id of the role that applies to this permission. - * @return roleId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the role that applies to this permission.") + public static final String SERIALIZED_NAME_RESOURCES = "resources"; - public String getRoleId() { - return roleId; - } + @SerializedName(SERIALIZED_NAME_RESOURCES) + private List resources = new ArrayList<>(); + public AccessPermissionV1() {} - public void setRoleId(String roleId) { - this.roleId = roleId; - } + public AccessPermissionV1 roleId(String roleId) { + this.roleId = roleId; + return this; + } - public AccessPermissionV1 roleName(String roleName) { - - this.roleName = roleName; - return this; - } - - /** - * The name of the role that applies to this permission. - * @return roleName - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the role that applies to this permission.") + /** + * The id of the role that applies to this permission. + * + * @return roleId + */ + @javax.annotation.Nonnull + public String getRoleId() { + return roleId; + } - public String getRoleName() { - return roleName; - } + public void setRoleId(String roleId) { + this.roleId = roleId; + } + public AccessPermissionV1 roleName(String roleName) { - public void setRoleName(String roleName) { - this.roleName = roleName; - } + this.roleName = roleName; + return this; + } + /** + * The name of the role that applies to this permission. + * + * @return roleName + */ + @javax.annotation.Nonnull + public String getRoleName() { + return roleName; + } - public AccessPermissionV1 resources(List resources) { - - this.resources = resources; - return this; - } + public void setRoleName(String roleName) { + this.roleName = roleName; + } - public AccessPermissionV1 addResourcesItem(PermissionResourceV1 resourcesItem) { - this.resources.add(resourcesItem); - return this; - } + public AccessPermissionV1 resources(List resources) { - /** - * The resources included with this permission. - * @return resources - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The resources included with this permission.") + this.resources = resources; + return this; + } - public List getResources() { - return resources; - } + public AccessPermissionV1 addResourcesItem(PermissionResourceV1 resourcesItem) { + if (this.resources == null) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + /** + * The resources included with this permission. + * + * @return resources + */ + @javax.annotation.Nonnull + public List getResources() { + return resources; + } - public void setResources(List resources) { - this.resources = 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; + } + AccessPermissionV1 accessPermissionV1 = (AccessPermissionV1) o; + return Objects.equals(this.roleId, accessPermissionV1.roleId) + && Objects.equals(this.roleName, accessPermissionV1.roleName) + && Objects.equals(this.resources, accessPermissionV1.resources); + } + @Override + public int hashCode() { + return Objects.hash(roleId, roleName, resources); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccessPermissionV1 {\n"); + sb.append(" roleId: ").append(toIndentedString(roleId)).append("\n"); + sb.append(" roleName: ").append(toIndentedString(roleName)).append("\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AccessPermissionV1 accessPermissionV1 = (AccessPermissionV1) o; - return Objects.equals(this.roleId, accessPermissionV1.roleId) && - Objects.equals(this.roleName, accessPermissionV1.roleName) && - Objects.equals(this.resources, accessPermissionV1.resources); - } - - @Override - public int hashCode() { - return Objects.hash(roleId, roleName, resources); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AccessPermissionV1 {\n"); - sb.append(" roleId: ").append(toIndentedString(roleId)).append("\n"); - sb.append(" roleName: ").append(toIndentedString(roleName)).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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("roleId"); + openapiFields.add("roleName"); + openapiFields.add("resources"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("roleId"); + openapiRequiredFields.add("roleName"); + openapiRequiredFields.add("resources"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("roleId"); - openapiFields.add("roleName"); - openapiFields.add("resources"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("roleId"); - openapiRequiredFields.add("roleName"); - openapiRequiredFields.add("resources"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AccessPermissionV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AccessPermissionV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AccessPermissionV1 is not found in the empty JSON string", AccessPermissionV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccessPermissionV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccessPermissionV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AccessPermissionV1 is not found in the" + + " empty JSON string", + AccessPermissionV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AccessPermissionV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccessPermissionV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AccessPermissionV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AccessPermissionV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AccessPermissionV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccessPermissionV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } } - } - if (!jsonObj.get("roleId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `roleId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("roleId").toString())); - } - if (!jsonObj.get("roleName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `roleName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("roleName").toString())); - } - // 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())); - } - - JsonArray jsonArrayresources = jsonObj.getAsJsonArray("resources"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AccessPermissionV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AccessPermissionV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AccessPermissionV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AccessPermissionV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AccessPermissionV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("roleId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `roleId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("roleId").toString())); + } + if (!jsonObj.get("roleName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `roleName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("roleName").toString())); + } + // 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())); + } + + JsonArray jsonArrayresources = jsonObj.getAsJsonArray("resources"); + // validate the required field `resources` (array) + for (int i = 0; i < jsonArrayresources.size(); i++) { + PermissionResourceV1.validateJsonElement(jsonArrayresources.get(i)); + } + ; } - } - - /** - * Create an instance of AccessPermissionV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of AccessPermissionV1 - * @throws IOException if the JSON string is invalid with respect to AccessPermissionV1 - */ - public static AccessPermissionV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AccessPermissionV1.class); - } - - /** - * Convert an instance of AccessPermissionV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccessPermissionV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccessPermissionV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AccessPermissionV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AccessPermissionV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AccessPermissionV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AccessPermissionV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccessPermissionV1 + * @throws IOException if the JSON string is invalid with respect to AccessPermissionV1 + */ + public static AccessPermissionV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccessPermissionV1.class); + } + + /** + * Convert an instance of AccessPermissionV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/ActivationSummaryOutput.java b/src/main/java/com/segment/publicapi/models/ActivationSummaryOutput.java new file mode 100644 index 00000000..a9a54016 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/ActivationSummaryOutput.java @@ -0,0 +1,237 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** A class that encapsulates the output shared across endpoints for a given activation. */ +public class ActivationSummaryOutput { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public ActivationSummaryOutput() {} + + public ActivationSummaryOutput id(String id) { + + this.id = id; + return this; + } + + /** + * The activation id. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ActivationSummaryOutput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Activation Enabled Status. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ActivationSummaryOutput activationSummaryOutput = (ActivationSummaryOutput) o; + return Objects.equals(this.id, activationSummaryOutput.id) + && Objects.equals(this.enabled, activationSummaryOutput.enabled); + } + + @Override + public int hashCode() { + return Objects.hash(id, enabled); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ActivationSummaryOutput {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("enabled"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("enabled"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ActivationSummaryOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ActivationSummaryOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ActivationSummaryOutput is not found" + + " in the empty JSON string", + ActivationSummaryOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ActivationSummaryOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ActivationSummaryOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ActivationSummaryOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ActivationSummaryOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ActivationSummaryOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ActivationSummaryOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ActivationSummaryOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ActivationSummaryOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ActivationSummaryOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of ActivationSummaryOutput + * @throws IOException if the JSON string is invalid with respect to ActivationSummaryOutput + */ + public static ActivationSummaryOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ActivationSummaryOutput.class); + } + + /** + * Convert an instance of ActivationSummaryOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddActivationToAudience200Response.java b/src/main/java/com/segment/publicapi/models/AddActivationToAudience200Response.java new file mode 100644 index 00000000..46388317 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AddActivationToAudience200Response.java @@ -0,0 +1,201 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** AddActivationToAudience200Response */ +public class AddActivationToAudience200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private AddActivationToAudienceAlphaOutput data; + + public AddActivationToAudience200Response() {} + + public AddActivationToAudience200Response data(AddActivationToAudienceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public AddActivationToAudienceAlphaOutput getData() { + return data; + } + + public void setData(AddActivationToAudienceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddActivationToAudience200Response addActivationToAudience200Response = + (AddActivationToAudience200Response) o; + return Objects.equals(this.data, addActivationToAudience200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddActivationToAudience200Response {\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 + * AddActivationToAudience200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddActivationToAudience200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddActivationToAudience200Response is" + + " not found in the empty JSON string", + AddActivationToAudience200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddActivationToAudience200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddActivationToAudience200Response` 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()) { + AddActivationToAudienceAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddActivationToAudience200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddActivationToAudience200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddActivationToAudience200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddActivationToAudience200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddActivationToAudience200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddActivationToAudience200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddActivationToAudience200Response + * @throws IOException if the JSON string is invalid with respect to + * AddActivationToAudience200Response + */ + public static AddActivationToAudience200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, AddActivationToAudience200Response.class); + } + + /** + * Convert an instance of AddActivationToAudience200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddActivationToAudienceAlphaInput.java b/src/main/java/com/segment/publicapi/models/AddActivationToAudienceAlphaInput.java new file mode 100644 index 00000000..2bc63a65 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AddActivationToAudienceAlphaInput.java @@ -0,0 +1,452 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Input to create an activation. */ +public class AddActivationToAudienceAlphaInput { + public static final String SERIALIZED_NAME_VERSION_SCHEMA = "versionSchema"; + + @SerializedName(SERIALIZED_NAME_VERSION_SCHEMA) + private String versionSchema; + + public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; + + @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) + private String workspaceId; + + public static final String SERIALIZED_NAME_DESTINATION_ID = "destinationId"; + + @SerializedName(SERIALIZED_NAME_DESTINATION_ID) + private String destinationId; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_HAS_ENABLED_RESYNC = "hasEnabledResync"; + + @SerializedName(SERIALIZED_NAME_HAS_ENABLED_RESYNC) + private Boolean hasEnabledResync; + + public static final String SERIALIZED_NAME_EMIT_ENTITY_CONTEXT = "emitEntityContext"; + + @SerializedName(SERIALIZED_NAME_EMIT_ENTITY_CONTEXT) + private String emitEntityContext; + + public static final String SERIALIZED_NAME_EVENT_EMITTER = "eventEmitter"; + + @SerializedName(SERIALIZED_NAME_EVENT_EMITTER) + private Object eventEmitter = null; + + public static final String SERIALIZED_NAME_SUBSCRIPTION = "subscription"; + + @SerializedName(SERIALIZED_NAME_SUBSCRIPTION) + private Object subscription = null; + + public AddActivationToAudienceAlphaInput() {} + + public AddActivationToAudienceAlphaInput versionSchema(String versionSchema) { + + this.versionSchema = versionSchema; + return this; + } + + /** + * Version Schema. + * + * @return versionSchema + */ + @javax.annotation.Nonnull + public String getVersionSchema() { + return versionSchema; + } + + public void setVersionSchema(String versionSchema) { + this.versionSchema = versionSchema; + } + + public AddActivationToAudienceAlphaInput workspaceId(String workspaceId) { + + this.workspaceId = workspaceId; + return this; + } + + /** + * The id of the Workspace the audience exists within. + * + * @return workspaceId + */ + @javax.annotation.Nonnull + public String getWorkspaceId() { + return workspaceId; + } + + public void setWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + } + + public AddActivationToAudienceAlphaInput destinationId(String destinationId) { + + this.destinationId = destinationId; + return this; + } + + /** + * The Destination id. + * + * @return destinationId + */ + @javax.annotation.Nonnull + public String getDestinationId() { + return destinationId; + } + + public void setDestinationId(String destinationId) { + this.destinationId = destinationId; + } + + public AddActivationToAudienceAlphaInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Whether the event emitter should be created in an enabled state. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public AddActivationToAudienceAlphaInput hasEnabledResync(Boolean hasEnabledResync) { + + this.hasEnabledResync = hasEnabledResync; + return this; + } + + /** + * Whether the event emitter should be created with the resync option. + * + * @return hasEnabledResync + */ + @javax.annotation.Nullable + public Boolean getHasEnabledResync() { + return hasEnabledResync; + } + + public void setHasEnabledResync(Boolean hasEnabledResync) { + this.hasEnabledResync = hasEnabledResync; + } + + public AddActivationToAudienceAlphaInput emitEntityContext(String emitEntityContext) { + + this.emitEntityContext = emitEntityContext; + return this; + } + + /** + * Whether the event emitter should emit events when the profile changes or when any enriched + * entity values changes. Only valid for identify events. + * + * @return emitEntityContext + */ + @javax.annotation.Nullable + public String getEmitEntityContext() { + return emitEntityContext; + } + + public void setEmitEntityContext(String emitEntityContext) { + this.emitEntityContext = emitEntityContext; + } + + public AddActivationToAudienceAlphaInput eventEmitter(Object eventEmitter) { + + this.eventEmitter = eventEmitter; + return this; + } + + /** + * Configuration settings for the event emitter to be created. + * + * @return eventEmitter + */ + @javax.annotation.Nullable + public Object getEventEmitter() { + return eventEmitter; + } + + public void setEventEmitter(Object eventEmitter) { + this.eventEmitter = eventEmitter; + } + + public AddActivationToAudienceAlphaInput subscription(Object subscription) { + + this.subscription = subscription; + return this; + } + + /** + * Subscription info to connect the event emitter to a Destination attached to the audience. + * + * @return subscription + */ + @javax.annotation.Nullable + public Object getSubscription() { + return subscription; + } + + public void setSubscription(Object subscription) { + this.subscription = subscription; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddActivationToAudienceAlphaInput addActivationToAudienceAlphaInput = + (AddActivationToAudienceAlphaInput) o; + return Objects.equals(this.versionSchema, addActivationToAudienceAlphaInput.versionSchema) + && Objects.equals(this.workspaceId, addActivationToAudienceAlphaInput.workspaceId) + && Objects.equals( + this.destinationId, addActivationToAudienceAlphaInput.destinationId) + && Objects.equals(this.enabled, addActivationToAudienceAlphaInput.enabled) + && Objects.equals( + this.hasEnabledResync, addActivationToAudienceAlphaInput.hasEnabledResync) + && Objects.equals( + this.emitEntityContext, addActivationToAudienceAlphaInput.emitEntityContext) + && Objects.equals(this.eventEmitter, addActivationToAudienceAlphaInput.eventEmitter) + && Objects.equals( + this.subscription, addActivationToAudienceAlphaInput.subscription); + } + + @Override + public int hashCode() { + return Objects.hash( + versionSchema, + workspaceId, + destinationId, + enabled, + hasEnabledResync, + emitEntityContext, + eventEmitter, + subscription); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddActivationToAudienceAlphaInput {\n"); + sb.append(" versionSchema: ").append(toIndentedString(versionSchema)).append("\n"); + sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); + sb.append(" destinationId: ").append(toIndentedString(destinationId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" hasEnabledResync: ").append(toIndentedString(hasEnabledResync)).append("\n"); + sb.append(" emitEntityContext: ") + .append(toIndentedString(emitEntityContext)) + .append("\n"); + sb.append(" eventEmitter: ").append(toIndentedString(eventEmitter)).append("\n"); + sb.append(" subscription: ").append(toIndentedString(subscription)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("versionSchema"); + openapiFields.add("workspaceId"); + openapiFields.add("destinationId"); + openapiFields.add("enabled"); + openapiFields.add("hasEnabledResync"); + openapiFields.add("emitEntityContext"); + openapiFields.add("eventEmitter"); + openapiFields.add("subscription"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("versionSchema"); + openapiRequiredFields.add("workspaceId"); + openapiRequiredFields.add("destinationId"); + openapiRequiredFields.add("eventEmitter"); + openapiRequiredFields.add("subscription"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddActivationToAudienceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddActivationToAudienceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddActivationToAudienceAlphaInput is" + + " not found in the empty JSON string", + AddActivationToAudienceAlphaInput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddActivationToAudienceAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddActivationToAudienceAlphaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddActivationToAudienceAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("versionSchema").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `versionSchema` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("versionSchema").toString())); + } + if (!jsonObj.get("workspaceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `workspaceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("workspaceId").toString())); + } + if (!jsonObj.get("destinationId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `destinationId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("destinationId").toString())); + } + if ((jsonObj.get("emitEntityContext") != null + && !jsonObj.get("emitEntityContext").isJsonNull()) + && !jsonObj.get("emitEntityContext").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `emitEntityContext` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("emitEntityContext").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddActivationToAudienceAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddActivationToAudienceAlphaInput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddActivationToAudienceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddActivationToAudienceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddActivationToAudienceAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddActivationToAudienceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddActivationToAudienceAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * AddActivationToAudienceAlphaInput + */ + public static AddActivationToAudienceAlphaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddActivationToAudienceAlphaInput.class); + } + + /** + * Convert an instance of AddActivationToAudienceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddActivationToAudienceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/AddActivationToAudienceAlphaOutput.java new file mode 100644 index 00000000..f99dbbca --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AddActivationToAudienceAlphaOutput.java @@ -0,0 +1,210 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Activation output for create. */ +public class AddActivationToAudienceAlphaOutput { + public static final String SERIALIZED_NAME_ACTIVATION = "activation"; + + @SerializedName(SERIALIZED_NAME_ACTIVATION) + private ActivationSummaryOutput activation; + + public AddActivationToAudienceAlphaOutput() {} + + public AddActivationToAudienceAlphaOutput activation(ActivationSummaryOutput activation) { + + this.activation = activation; + return this; + } + + /** + * Get activation + * + * @return activation + */ + @javax.annotation.Nonnull + public ActivationSummaryOutput getActivation() { + return activation; + } + + public void setActivation(ActivationSummaryOutput activation) { + this.activation = activation; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddActivationToAudienceAlphaOutput addActivationToAudienceAlphaOutput = + (AddActivationToAudienceAlphaOutput) o; + return Objects.equals(this.activation, addActivationToAudienceAlphaOutput.activation); + } + + @Override + public int hashCode() { + return Objects.hash(activation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddActivationToAudienceAlphaOutput {\n"); + sb.append(" activation: ").append(toIndentedString(activation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("activation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("activation"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddActivationToAudienceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddActivationToAudienceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddActivationToAudienceAlphaOutput is" + + " not found in the empty JSON string", + AddActivationToAudienceAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddActivationToAudienceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddActivationToAudienceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddActivationToAudienceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `activation` + ActivationSummaryOutput.validateJsonElement(jsonObj.get("activation")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddActivationToAudienceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddActivationToAudienceAlphaOutput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddActivationToAudienceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddActivationToAudienceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddActivationToAudienceAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddActivationToAudienceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddActivationToAudienceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * AddActivationToAudienceAlphaOutput + */ + public static AddActivationToAudienceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, AddActivationToAudienceAlphaOutput.class); + } + + /** + * Convert an instance of AddActivationToAudienceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddConnectionFromSourceToWarehouse200Response.java b/src/main/java/com/segment/publicapi/models/AddConnectionFromSourceToWarehouse200Response.java deleted file mode 100644 index dfff9b4c..00000000 --- a/src/main/java/com/segment/publicapi/models/AddConnectionFromSourceToWarehouse200Response.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.AddConnectionFromSourceToWarehouseV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * AddConnectionFromSourceToWarehouse200Response - */ - -public class AddConnectionFromSourceToWarehouse200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private AddConnectionFromSourceToWarehouseV1Output data; - - public AddConnectionFromSourceToWarehouse200Response() { - } - - public AddConnectionFromSourceToWarehouse200Response data(AddConnectionFromSourceToWarehouseV1Output data) { - - this.data = data; - return this; - } - - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public AddConnectionFromSourceToWarehouseV1Output getData() { - return data; - } - - - public void setData(AddConnectionFromSourceToWarehouseV1Output data) { - this.data = data; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AddConnectionFromSourceToWarehouse200Response addConnectionFromSourceToWarehouse200Response = (AddConnectionFromSourceToWarehouse200Response) o; - return Objects.equals(this.data, addConnectionFromSourceToWarehouse200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddConnectionFromSourceToWarehouse200Response {\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddConnectionFromSourceToWarehouse200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddConnectionFromSourceToWarehouse200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddConnectionFromSourceToWarehouse200Response is not found in the empty JSON string", AddConnectionFromSourceToWarehouse200Response.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddConnectionFromSourceToWarehouse200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddConnectionFromSourceToWarehouse200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddConnectionFromSourceToWarehouse200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddConnectionFromSourceToWarehouse200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddConnectionFromSourceToWarehouse200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddConnectionFromSourceToWarehouse200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddConnectionFromSourceToWarehouse200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of AddConnectionFromSourceToWarehouse200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddConnectionFromSourceToWarehouse200Response - * @throws IOException if the JSON string is invalid with respect to AddConnectionFromSourceToWarehouse200Response - */ - public static AddConnectionFromSourceToWarehouse200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddConnectionFromSourceToWarehouse200Response.class); - } - - /** - * Convert an instance of AddConnectionFromSourceToWarehouse200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/AddConnectionFromSourceToWarehouse201Response.java b/src/main/java/com/segment/publicapi/models/AddConnectionFromSourceToWarehouse201Response.java new file mode 100644 index 00000000..79ea5f50 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AddConnectionFromSourceToWarehouse201Response.java @@ -0,0 +1,210 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** AddConnectionFromSourceToWarehouse201Response */ +public class AddConnectionFromSourceToWarehouse201Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private AddConnectionFromSourceToWarehouseV1Output data; + + public AddConnectionFromSourceToWarehouse201Response() {} + + public AddConnectionFromSourceToWarehouse201Response data( + AddConnectionFromSourceToWarehouseV1Output data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public AddConnectionFromSourceToWarehouseV1Output getData() { + return data; + } + + public void setData(AddConnectionFromSourceToWarehouseV1Output data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddConnectionFromSourceToWarehouse201Response + addConnectionFromSourceToWarehouse201Response = + (AddConnectionFromSourceToWarehouse201Response) o; + return Objects.equals(this.data, addConnectionFromSourceToWarehouse201Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddConnectionFromSourceToWarehouse201Response {\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 + * AddConnectionFromSourceToWarehouse201Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddConnectionFromSourceToWarehouse201Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " AddConnectionFromSourceToWarehouse201Response is not found" + + " in the empty JSON string", + AddConnectionFromSourceToWarehouse201Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddConnectionFromSourceToWarehouse201Response.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddConnectionFromSourceToWarehouse201Response` 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()) { + AddConnectionFromSourceToWarehouseV1Output.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddConnectionFromSourceToWarehouse201Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'AddConnectionFromSourceToWarehouse201Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(AddConnectionFromSourceToWarehouse201Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, AddConnectionFromSourceToWarehouse201Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddConnectionFromSourceToWarehouse201Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddConnectionFromSourceToWarehouse201Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddConnectionFromSourceToWarehouse201Response + * @throws IOException if the JSON string is invalid with respect to + * AddConnectionFromSourceToWarehouse201Response + */ + public static AddConnectionFromSourceToWarehouse201Response fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, AddConnectionFromSourceToWarehouse201Response.class); + } + + /** + * Convert an instance of AddConnectionFromSourceToWarehouse201Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddConnectionFromSourceToWarehouseV1Output.java b/src/main/java/com/segment/publicapi/models/AddConnectionFromSourceToWarehouseV1Output.java index 3dc0518d..040a4f9e 100644 --- a/src/main/java/com/segment/publicapi/models/AddConnectionFromSourceToWarehouseV1Output.java +++ b/src/main/java/com/segment/publicapi/models/AddConnectionFromSourceToWarehouseV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,255 +9,261 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Response indicating whether the connection was successful. */ +public class AddConnectionFromSourceToWarehouseV1Output { + /** The status of the connection between the Source and Warehouse. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + CONNECTED("CONNECTED"), -/** - * Response indicating whether the connection was successful. - */ -@ApiModel(description = "Response indicating whether the connection was successful.") + NOT_CONNECTED("NOT_CONNECTED"); -public class AddConnectionFromSourceToWarehouseV1Output { - /** - * The status of the connection between the Source and Warehouse. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - CONNECTED("CONNECTED"), - - NOT_CONNECTED("NOT_CONNECTED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } + private String value; - public String getValue() { - return value; - } + StatusEnum(String value) { + this.value = value; + } - @Override - public String toString() { - return String.valueOf(value); - } + public String getValue() { + return value; + } - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; + @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 + "'"); } - } - 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 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_STATUS = "status"; - public AddConnectionFromSourceToWarehouseV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public AddConnectionFromSourceToWarehouseV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public AddConnectionFromSourceToWarehouseV1Output() {} - /** - * The status of the connection between the Source and Warehouse. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The status of the connection between the Source and Warehouse.") + public AddConnectionFromSourceToWarehouseV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The status of the connection between the Source and Warehouse. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + AddConnectionFromSourceToWarehouseV1Output addConnectionFromSourceToWarehouseV1Output = + (AddConnectionFromSourceToWarehouseV1Output) o; + return Objects.equals(this.status, addConnectionFromSourceToWarehouseV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddConnectionFromSourceToWarehouseV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddConnectionFromSourceToWarehouseV1Output addConnectionFromSourceToWarehouseV1Output = (AddConnectionFromSourceToWarehouseV1Output) o; - return Objects.equals(this.status, addConnectionFromSourceToWarehouseV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddConnectionFromSourceToWarehouseV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddConnectionFromSourceToWarehouseV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddConnectionFromSourceToWarehouseV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddConnectionFromSourceToWarehouseV1Output is not found in the empty JSON string", AddConnectionFromSourceToWarehouseV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddConnectionFromSourceToWarehouseV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddConnectionFromSourceToWarehouseV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " AddConnectionFromSourceToWarehouseV1Output is not found in" + + " the empty JSON string", + AddConnectionFromSourceToWarehouseV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddConnectionFromSourceToWarehouseV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddConnectionFromSourceToWarehouseV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddConnectionFromSourceToWarehouseV1Output.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddConnectionFromSourceToWarehouseV1Output` properties." + + " JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AddConnectionFromSourceToWarehouseV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + AddConnectionFromSourceToWarehouseV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!AddConnectionFromSourceToWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddConnectionFromSourceToWarehouseV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddConnectionFromSourceToWarehouseV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddConnectionFromSourceToWarehouseV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddConnectionFromSourceToWarehouseV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of AddConnectionFromSourceToWarehouseV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddConnectionFromSourceToWarehouseV1Output - * @throws IOException if the JSON string is invalid with respect to AddConnectionFromSourceToWarehouseV1Output - */ - public static AddConnectionFromSourceToWarehouseV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddConnectionFromSourceToWarehouseV1Output.class); - } - - /** - * Convert an instance of AddConnectionFromSourceToWarehouseV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddConnectionFromSourceToWarehouseV1Output.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'AddConnectionFromSourceToWarehouseV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddConnectionFromSourceToWarehouseV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, AddConnectionFromSourceToWarehouseV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddConnectionFromSourceToWarehouseV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddConnectionFromSourceToWarehouseV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddConnectionFromSourceToWarehouseV1Output + * @throws IOException if the JSON string is invalid with respect to + * AddConnectionFromSourceToWarehouseV1Output + */ + public static AddConnectionFromSourceToWarehouseV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, AddConnectionFromSourceToWarehouseV1Output.class); + } + + /** + * Convert an instance of AddConnectionFromSourceToWarehouseV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddDestinationToAudience200Response.java b/src/main/java/com/segment/publicapi/models/AddDestinationToAudience200Response.java new file mode 100644 index 00000000..c38032f6 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AddDestinationToAudience200Response.java @@ -0,0 +1,201 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** AddDestinationToAudience200Response */ +public class AddDestinationToAudience200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private AddDestinationToAudienceAlphaOutput data; + + public AddDestinationToAudience200Response() {} + + public AddDestinationToAudience200Response data(AddDestinationToAudienceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public AddDestinationToAudienceAlphaOutput getData() { + return data; + } + + public void setData(AddDestinationToAudienceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddDestinationToAudience200Response addDestinationToAudience200Response = + (AddDestinationToAudience200Response) o; + return Objects.equals(this.data, addDestinationToAudience200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddDestinationToAudience200Response {\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 + * AddDestinationToAudience200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddDestinationToAudience200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddDestinationToAudience200Response is" + + " not found in the empty JSON string", + AddDestinationToAudience200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddDestinationToAudience200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddDestinationToAudience200Response` 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()) { + AddDestinationToAudienceAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddDestinationToAudience200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddDestinationToAudience200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddDestinationToAudience200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddDestinationToAudience200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddDestinationToAudience200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddDestinationToAudience200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddDestinationToAudience200Response + * @throws IOException if the JSON string is invalid with respect to + * AddDestinationToAudience200Response + */ + public static AddDestinationToAudience200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, AddDestinationToAudience200Response.class); + } + + /** + * Convert an instance of AddDestinationToAudience200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddDestinationToAudienceAlphaInput.java b/src/main/java/com/segment/publicapi/models/AddDestinationToAudienceAlphaInput.java new file mode 100644 index 00000000..cb20e3b9 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AddDestinationToAudienceAlphaInput.java @@ -0,0 +1,282 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Input to Add a Destination into an Audience. */ +public class AddDestinationToAudienceAlphaInput { + public static final String SERIALIZED_NAME_VERSION_SCHEMA = "versionSchema"; + + @SerializedName(SERIALIZED_NAME_VERSION_SCHEMA) + private String versionSchema; + + public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; + + @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) + private String workspaceId; + + public static final String SERIALIZED_NAME_DESTINATION = "destination"; + + @SerializedName(SERIALIZED_NAME_DESTINATION) + private DestinationInput destination; + + public AddDestinationToAudienceAlphaInput() {} + + public AddDestinationToAudienceAlphaInput versionSchema(String versionSchema) { + + this.versionSchema = versionSchema; + return this; + } + + /** + * Version Schema. + * + * @return versionSchema + */ + @javax.annotation.Nonnull + public String getVersionSchema() { + return versionSchema; + } + + public void setVersionSchema(String versionSchema) { + this.versionSchema = versionSchema; + } + + public AddDestinationToAudienceAlphaInput workspaceId(String workspaceId) { + + this.workspaceId = workspaceId; + return this; + } + + /** + * The id of the Workspace the audience exists within. + * + * @return workspaceId + */ + @javax.annotation.Nonnull + public String getWorkspaceId() { + return workspaceId; + } + + public void setWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + } + + public AddDestinationToAudienceAlphaInput destination(DestinationInput destination) { + + this.destination = destination; + return this; + } + + /** + * Get destination + * + * @return destination + */ + @javax.annotation.Nonnull + public DestinationInput getDestination() { + return destination; + } + + public void setDestination(DestinationInput destination) { + this.destination = destination; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddDestinationToAudienceAlphaInput addDestinationToAudienceAlphaInput = + (AddDestinationToAudienceAlphaInput) o; + return Objects.equals(this.versionSchema, addDestinationToAudienceAlphaInput.versionSchema) + && Objects.equals(this.workspaceId, addDestinationToAudienceAlphaInput.workspaceId) + && Objects.equals(this.destination, addDestinationToAudienceAlphaInput.destination); + } + + @Override + public int hashCode() { + return Objects.hash(versionSchema, workspaceId, destination); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddDestinationToAudienceAlphaInput {\n"); + sb.append(" versionSchema: ").append(toIndentedString(versionSchema)).append("\n"); + sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("versionSchema"); + openapiFields.add("workspaceId"); + openapiFields.add("destination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("versionSchema"); + openapiRequiredFields.add("workspaceId"); + openapiRequiredFields.add("destination"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddDestinationToAudienceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddDestinationToAudienceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddDestinationToAudienceAlphaInput is" + + " not found in the empty JSON string", + AddDestinationToAudienceAlphaInput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddDestinationToAudienceAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddDestinationToAudienceAlphaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddDestinationToAudienceAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("versionSchema").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `versionSchema` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("versionSchema").toString())); + } + if (!jsonObj.get("workspaceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `workspaceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("workspaceId").toString())); + } + // validate the required field `destination` + DestinationInput.validateJsonElement(jsonObj.get("destination")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddDestinationToAudienceAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddDestinationToAudienceAlphaInput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddDestinationToAudienceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddDestinationToAudienceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddDestinationToAudienceAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddDestinationToAudienceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddDestinationToAudienceAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * AddDestinationToAudienceAlphaInput + */ + public static AddDestinationToAudienceAlphaInput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, AddDestinationToAudienceAlphaInput.class); + } + + /** + * Convert an instance of AddDestinationToAudienceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddDestinationToAudienceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/AddDestinationToAudienceAlphaOutput.java new file mode 100644 index 00000000..3b002a63 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AddDestinationToAudienceAlphaOutput.java @@ -0,0 +1,210 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** AddDestinationToAudienceAlphaOutput */ +public class AddDestinationToAudienceAlphaOutput { + public static final String SERIALIZED_NAME_CONNECTION = "connection"; + + @SerializedName(SERIALIZED_NAME_CONNECTION) + private Connection connection; + + public AddDestinationToAudienceAlphaOutput() {} + + public AddDestinationToAudienceAlphaOutput connection(Connection connection) { + + this.connection = connection; + return this; + } + + /** + * Get connection + * + * @return connection + */ + @javax.annotation.Nonnull + public Connection getConnection() { + return connection; + } + + public void setConnection(Connection connection) { + this.connection = connection; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddDestinationToAudienceAlphaOutput addDestinationToAudienceAlphaOutput = + (AddDestinationToAudienceAlphaOutput) o; + return Objects.equals(this.connection, addDestinationToAudienceAlphaOutput.connection); + } + + @Override + public int hashCode() { + return Objects.hash(connection); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddDestinationToAudienceAlphaOutput {\n"); + sb.append(" connection: ").append(toIndentedString(connection)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("connection"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("connection"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddDestinationToAudienceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddDestinationToAudienceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddDestinationToAudienceAlphaOutput is" + + " not found in the empty JSON string", + AddDestinationToAudienceAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddDestinationToAudienceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddDestinationToAudienceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddDestinationToAudienceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `connection` + Connection.validateJsonElement(jsonObj.get("connection")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddDestinationToAudienceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddDestinationToAudienceAlphaOutput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddDestinationToAudienceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddDestinationToAudienceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddDestinationToAudienceAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddDestinationToAudienceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddDestinationToAudienceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * AddDestinationToAudienceAlphaOutput + */ + public static AddDestinationToAudienceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, AddDestinationToAudienceAlphaOutput.class); + } + + /** + * Convert an instance of AddDestinationToAudienceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddLabelsToSource200Response.java b/src/main/java/com/segment/publicapi/models/AddLabelsToSource200Response.java index c8101d80..62e28839 100644 --- a/src/main/java/com/segment/publicapi/models/AddLabelsToSource200Response.java +++ b/src/main/java/com/segment/publicapi/models/AddLabelsToSource200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,190 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.AddLabelsToSourceAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * AddLabelsToSource200Response - */ - +/** AddLabelsToSource200Response */ public class AddLabelsToSource200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private AddLabelsToSourceAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public AddLabelsToSource200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private AddLabelsToSourceV1Output data; - public AddLabelsToSource200Response data(AddLabelsToSourceAlphaOutput data) { - - this.data = data; - return this; - } + public AddLabelsToSource200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public AddLabelsToSource200Response data(AddLabelsToSourceV1Output data) { - public AddLabelsToSourceAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public AddLabelsToSourceV1Output getData() { + return data; + } - public void setData(AddLabelsToSourceAlphaOutput data) { - this.data = data; - } + public void setData(AddLabelsToSourceV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddLabelsToSource200Response addLabelsToSource200Response = + (AddLabelsToSource200Response) o; + return Objects.equals(this.data, addLabelsToSource200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddLabelsToSource200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddLabelsToSource200Response addLabelsToSource200Response = (AddLabelsToSource200Response) o; - return Objects.equals(this.data, addLabelsToSource200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddLabelsToSource200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddLabelsToSource200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddLabelsToSource200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddLabelsToSource200Response is not found in the empty JSON string", AddLabelsToSource200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddLabelsToSource200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddLabelsToSource200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddLabelsToSource200Response is not" + + " found in the empty JSON string", + AddLabelsToSource200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddLabelsToSource200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddLabelsToSource200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddLabelsToSource200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddLabelsToSource200Response` 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()) { + AddLabelsToSourceV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddLabelsToSource200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddLabelsToSource200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddLabelsToSource200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddLabelsToSource200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddLabelsToSource200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddLabelsToSource200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddLabelsToSource200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddLabelsToSource200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddLabelsToSource200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddLabelsToSource200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddLabelsToSource200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddLabelsToSource200Response + * @throws IOException if the JSON string is invalid with respect to + * AddLabelsToSource200Response + */ + public static AddLabelsToSource200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddLabelsToSource200Response.class); } - } - - /** - * Create an instance of AddLabelsToSource200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddLabelsToSource200Response - * @throws IOException if the JSON string is invalid with respect to AddLabelsToSource200Response - */ - public static AddLabelsToSource200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddLabelsToSource200Response.class); - } - - /** - * Convert an instance of AddLabelsToSource200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddLabelsToSource200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddLabelsToSource200Response1.java b/src/main/java/com/segment/publicapi/models/AddLabelsToSource200Response1.java index 563ed207..9988253b 100644 --- a/src/main/java/com/segment/publicapi/models/AddLabelsToSource200Response1.java +++ b/src/main/java/com/segment/publicapi/models/AddLabelsToSource200Response1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.AddLabelsToSourceV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * AddLabelsToSource200Response1 - */ - +/** AddLabelsToSource200Response1 */ public class AddLabelsToSource200Response1 { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private AddLabelsToSourceV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public AddLabelsToSource200Response1() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private AddLabelsToSourceAlphaOutput data; - public AddLabelsToSource200Response1 data(AddLabelsToSourceV1Output data) { - - this.data = data; - return this; - } + public AddLabelsToSource200Response1() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public AddLabelsToSource200Response1 data(AddLabelsToSourceAlphaOutput data) { - public AddLabelsToSourceV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public AddLabelsToSourceAlphaOutput getData() { + return data; + } - public void setData(AddLabelsToSourceV1Output data) { - this.data = data; - } + public void setData(AddLabelsToSourceAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddLabelsToSource200Response1 addLabelsToSource200Response1 = + (AddLabelsToSource200Response1) o; + return Objects.equals(this.data, addLabelsToSource200Response1.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddLabelsToSource200Response1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddLabelsToSource200Response1 addLabelsToSource200Response1 = (AddLabelsToSource200Response1) o; - return Objects.equals(this.data, addLabelsToSource200Response1.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddLabelsToSource200Response1 {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddLabelsToSource200Response1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddLabelsToSource200Response1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddLabelsToSource200Response1 is not found in the empty JSON string", AddLabelsToSource200Response1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddLabelsToSource200Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddLabelsToSource200Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddLabelsToSource200Response1 is not" + + " found in the empty JSON string", + AddLabelsToSource200Response1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddLabelsToSource200Response1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddLabelsToSource200Response1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddLabelsToSource200Response1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddLabelsToSource200Response1` 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()) { + AddLabelsToSourceAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddLabelsToSource200Response1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddLabelsToSource200Response1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddLabelsToSource200Response1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddLabelsToSource200Response1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddLabelsToSource200Response1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddLabelsToSource200Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddLabelsToSource200Response1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddLabelsToSource200Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddLabelsToSource200Response1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddLabelsToSource200Response1 read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddLabelsToSource200Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddLabelsToSource200Response1 + * @throws IOException if the JSON string is invalid with respect to + * AddLabelsToSource200Response1 + */ + public static AddLabelsToSource200Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddLabelsToSource200Response1.class); } - } - - /** - * Create an instance of AddLabelsToSource200Response1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddLabelsToSource200Response1 - * @throws IOException if the JSON string is invalid with respect to AddLabelsToSource200Response1 - */ - public static AddLabelsToSource200Response1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddLabelsToSource200Response1.class); - } - - /** - * Convert an instance of AddLabelsToSource200Response1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddLabelsToSource200Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddLabelsToSourceAlphaInput.java b/src/main/java/com/segment/publicapi/models/AddLabelsToSourceAlphaInput.java index deffd01a..51b0db2b 100644 --- a/src/main/java/com/segment/publicapi/models/AddLabelsToSourceAlphaInput.java +++ b/src/main/java/com/segment/publicapi/models/AddLabelsToSourceAlphaInput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,219 +9,220 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelAlpha; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Applies an existing label to an existing Source. - */ -@ApiModel(description = "Applies an existing label to an existing Source.") - +/** Applies an existing label to an existing Source. */ public class AddLabelsToSourceAlphaInput { - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = new ArrayList<>(); + public static final String SERIALIZED_NAME_LABELS = "labels"; - public AddLabelsToSourceAlphaInput() { - } + @SerializedName(SERIALIZED_NAME_LABELS) + private List labels = new ArrayList<>(); - public AddLabelsToSourceAlphaInput labels(List labels) { - - this.labels = labels; - return this; - } + public AddLabelsToSourceAlphaInput() {} - public AddLabelsToSourceAlphaInput addLabelsItem(LabelAlpha labelsItem) { - this.labels.add(labelsItem); - return this; - } + public AddLabelsToSourceAlphaInput labels(List labels) { - /** - * The labels to associate with a Source. - * @return labels - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The labels to associate with a Source.") + this.labels = labels; + return this; + } - public List getLabels() { - return labels; - } + public AddLabelsToSourceAlphaInput addLabelsItem(LabelAlpha labelsItem) { + if (this.labels == null) { + this.labels = new ArrayList<>(); + } + this.labels.add(labelsItem); + return this; + } + /** + * The labels to associate with a Source. + * + * @return labels + */ + @javax.annotation.Nonnull + public List getLabels() { + return labels; + } - public void setLabels(List labels) { - this.labels = labels; - } + public void setLabels(List labels) { + this.labels = labels; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddLabelsToSourceAlphaInput addLabelsToSourceAlphaInput = (AddLabelsToSourceAlphaInput) o; + return Objects.equals(this.labels, addLabelsToSourceAlphaInput.labels); + } + @Override + public int hashCode() { + return Objects.hash(labels); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddLabelsToSourceAlphaInput {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddLabelsToSourceAlphaInput addLabelsToSourceAlphaInput = (AddLabelsToSourceAlphaInput) o; - return Objects.equals(this.labels, addLabelsToSourceAlphaInput.labels); - } - - @Override - public int hashCode() { - return Objects.hash(labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddLabelsToSourceAlphaInput {\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("labels"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("labels"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("labels"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddLabelsToSourceAlphaInput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddLabelsToSourceAlphaInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddLabelsToSourceAlphaInput is not found in the empty JSON string", AddLabelsToSourceAlphaInput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddLabelsToSourceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddLabelsToSourceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddLabelsToSourceAlphaInput is not" + + " found in the empty JSON string", + AddLabelsToSourceAlphaInput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddLabelsToSourceAlphaInput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddLabelsToSourceAlphaInput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddLabelsToSourceAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddLabelsToSourceAlphaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AddLabelsToSourceAlphaInput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddLabelsToSourceAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("labels").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `labels` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("labels").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - } + JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); + // validate the required field `labels` (array) + for (int i = 0; i < jsonArraylabels.size(); i++) { + LabelAlpha.validateJsonElement(jsonArraylabels.get(i)); + } + ; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddLabelsToSourceAlphaInput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddLabelsToSourceAlphaInput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddLabelsToSourceAlphaInput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddLabelsToSourceAlphaInput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddLabelsToSourceAlphaInput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddLabelsToSourceAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddLabelsToSourceAlphaInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AddLabelsToSourceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddLabelsToSourceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddLabelsToSourceAlphaInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddLabelsToSourceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddLabelsToSourceAlphaInput + * @throws IOException if the JSON string is invalid with respect to AddLabelsToSourceAlphaInput + */ + public static AddLabelsToSourceAlphaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddLabelsToSourceAlphaInput.class); } - } - - /** - * Create an instance of AddLabelsToSourceAlphaInput given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddLabelsToSourceAlphaInput - * @throws IOException if the JSON string is invalid with respect to AddLabelsToSourceAlphaInput - */ - public static AddLabelsToSourceAlphaInput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddLabelsToSourceAlphaInput.class); - } - - /** - * Convert an instance of AddLabelsToSourceAlphaInput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddLabelsToSourceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddLabelsToSourceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/AddLabelsToSourceAlphaOutput.java index 30a82014..d049531d 100644 --- a/src/main/java/com/segment/publicapi/models/AddLabelsToSourceAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/AddLabelsToSourceAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,219 +9,223 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelAlpha; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Applies an existing label to an existing Source. - */ -@ApiModel(description = "Applies an existing label to an existing Source.") - +/** Applies an existing label to an existing Source. */ public class AddLabelsToSourceAlphaOutput { - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = new ArrayList<>(); + public static final String SERIALIZED_NAME_LABELS = "labels"; - public AddLabelsToSourceAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_LABELS) + private List labels = new ArrayList<>(); - public AddLabelsToSourceAlphaOutput labels(List labels) { - - this.labels = labels; - return this; - } + public AddLabelsToSourceAlphaOutput() {} - public AddLabelsToSourceAlphaOutput addLabelsItem(LabelAlpha labelsItem) { - this.labels.add(labelsItem); - return this; - } + public AddLabelsToSourceAlphaOutput labels(List labels) { - /** - * All labels applied to the Source. - * @return labels - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "All labels applied to the Source.") + this.labels = labels; + return this; + } - public List getLabels() { - return labels; - } + public AddLabelsToSourceAlphaOutput addLabelsItem(LabelAlpha labelsItem) { + if (this.labels == null) { + this.labels = new ArrayList<>(); + } + this.labels.add(labelsItem); + return this; + } + /** + * All labels applied to the Source. + * + * @return labels + */ + @javax.annotation.Nonnull + public List getLabels() { + return labels; + } - public void setLabels(List labels) { - this.labels = labels; - } + public void setLabels(List labels) { + this.labels = labels; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddLabelsToSourceAlphaOutput addLabelsToSourceAlphaOutput = + (AddLabelsToSourceAlphaOutput) o; + return Objects.equals(this.labels, addLabelsToSourceAlphaOutput.labels); + } + @Override + public int hashCode() { + return Objects.hash(labels); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddLabelsToSourceAlphaOutput {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddLabelsToSourceAlphaOutput addLabelsToSourceAlphaOutput = (AddLabelsToSourceAlphaOutput) o; - return Objects.equals(this.labels, addLabelsToSourceAlphaOutput.labels); - } - - @Override - public int hashCode() { - return Objects.hash(labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddLabelsToSourceAlphaOutput {\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("labels"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("labels"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("labels"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddLabelsToSourceAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddLabelsToSourceAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddLabelsToSourceAlphaOutput is not found in the empty JSON string", AddLabelsToSourceAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddLabelsToSourceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddLabelsToSourceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddLabelsToSourceAlphaOutput is not" + + " found in the empty JSON string", + AddLabelsToSourceAlphaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddLabelsToSourceAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddLabelsToSourceAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddLabelsToSourceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddLabelsToSourceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AddLabelsToSourceAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddLabelsToSourceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("labels").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `labels` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("labels").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - } + JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); + // validate the required field `labels` (array) + for (int i = 0; i < jsonArraylabels.size(); i++) { + LabelAlpha.validateJsonElement(jsonArraylabels.get(i)); + } + ; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddLabelsToSourceAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddLabelsToSourceAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddLabelsToSourceAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddLabelsToSourceAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddLabelsToSourceAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddLabelsToSourceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddLabelsToSourceAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddLabelsToSourceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddLabelsToSourceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddLabelsToSourceAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddLabelsToSourceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddLabelsToSourceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * AddLabelsToSourceAlphaOutput + */ + public static AddLabelsToSourceAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddLabelsToSourceAlphaOutput.class); } - } - - /** - * Create an instance of AddLabelsToSourceAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddLabelsToSourceAlphaOutput - * @throws IOException if the JSON string is invalid with respect to AddLabelsToSourceAlphaOutput - */ - public static AddLabelsToSourceAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddLabelsToSourceAlphaOutput.class); - } - - /** - * Convert an instance of AddLabelsToSourceAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddLabelsToSourceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddLabelsToSourceV1Input.java b/src/main/java/com/segment/publicapi/models/AddLabelsToSourceV1Input.java index 85e8e756..ac72996e 100644 --- a/src/main/java/com/segment/publicapi/models/AddLabelsToSourceV1Input.java +++ b/src/main/java/com/segment/publicapi/models/AddLabelsToSourceV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,217 +9,219 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Applies an existing label to an existing Source. */ +public class AddLabelsToSourceV1Input { + public static final String SERIALIZED_NAME_LABELS = "labels"; -/** - * Applies an existing label to an existing Source. - */ -@ApiModel(description = "Applies an existing label to an existing Source.") + @SerializedName(SERIALIZED_NAME_LABELS) + private List labels = new ArrayList<>(); -public class AddLabelsToSourceV1Input { - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = null; - - public AddLabelsToSourceV1Input() { - } - - public AddLabelsToSourceV1Input labels(List labels) { - - this.labels = labels; - return this; - } - - public AddLabelsToSourceV1Input addLabelsItem(LabelV1 labelsItem) { - if (this.labels == null) { - this.labels = new ArrayList<>(); - } - this.labels.add(labelsItem); - return this; - } + public AddLabelsToSourceV1Input() {} - /** - * The labels to associate with a Source. - * @return labels - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The labels to associate with a Source.") + public AddLabelsToSourceV1Input labels(List labels) { - public List getLabels() { - return labels; - } + this.labels = labels; + return this; + } + public AddLabelsToSourceV1Input addLabelsItem(LabelV1 labelsItem) { + if (this.labels == null) { + this.labels = new ArrayList<>(); + } + this.labels.add(labelsItem); + return this; + } - public void setLabels(List labels) { - this.labels = labels; - } + /** + * The labels to associate with a Source. + * + * @return labels + */ + @javax.annotation.Nonnull + public List getLabels() { + return labels; + } + public void setLabels(List labels) { + this.labels = labels; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddLabelsToSourceV1Input addLabelsToSourceV1Input = (AddLabelsToSourceV1Input) o; + return Objects.equals(this.labels, addLabelsToSourceV1Input.labels); + } + + @Override + public int hashCode() { + return Objects.hash(labels); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddLabelsToSourceV1Input {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddLabelsToSourceV1Input addLabelsToSourceV1Input = (AddLabelsToSourceV1Input) o; - return Objects.equals(this.labels, addLabelsToSourceV1Input.labels); - } - - @Override - public int hashCode() { - return Objects.hash(labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddLabelsToSourceV1Input {\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("labels"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("labels"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddLabelsToSourceV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddLabelsToSourceV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddLabelsToSourceV1Input is not found in the empty JSON string", AddLabelsToSourceV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AddLabelsToSourceV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddLabelsToSourceV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddLabelsToSourceV1Input is not found" + + " in the empty JSON string", + AddLabelsToSourceV1Input.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddLabelsToSourceV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddLabelsToSourceV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddLabelsToSourceV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddLabelsToSourceV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddLabelsToSourceV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("labels").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `labels` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("labels").toString())); } - } - if (jsonObj.get("labels") != null && !jsonObj.get("labels").isJsonNull()) { + JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - if (jsonArraylabels != null) { - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } + // validate the required field `labels` (array) + for (int i = 0; i < jsonArraylabels.size(); i++) { + LabelV1.validateJsonElement(jsonArraylabels.get(i)); } - } - } + ; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddLabelsToSourceV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddLabelsToSourceV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddLabelsToSourceV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddLabelsToSourceV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddLabelsToSourceV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddLabelsToSourceV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddLabelsToSourceV1Input' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AddLabelsToSourceV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddLabelsToSourceV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddLabelsToSourceV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddLabelsToSourceV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddLabelsToSourceV1Input + * @throws IOException if the JSON string is invalid with respect to AddLabelsToSourceV1Input + */ + public static AddLabelsToSourceV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddLabelsToSourceV1Input.class); } - } - - /** - * Create an instance of AddLabelsToSourceV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddLabelsToSourceV1Input - * @throws IOException if the JSON string is invalid with respect to AddLabelsToSourceV1Input - */ - public static AddLabelsToSourceV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddLabelsToSourceV1Input.class); - } - - /** - * Convert an instance of AddLabelsToSourceV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddLabelsToSourceV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddLabelsToSourceV1Output.java b/src/main/java/com/segment/publicapi/models/AddLabelsToSourceV1Output.java index 71b92c0e..6aa10311 100644 --- a/src/main/java/com/segment/publicapi/models/AddLabelsToSourceV1Output.java +++ b/src/main/java/com/segment/publicapi/models/AddLabelsToSourceV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,219 +9,219 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Applies an existing label to an existing Source. - */ -@ApiModel(description = "Applies an existing label to an existing Source.") - +/** Applies an existing label to an existing Source. */ public class AddLabelsToSourceV1Output { - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = new ArrayList<>(); + public static final String SERIALIZED_NAME_LABELS = "labels"; - public AddLabelsToSourceV1Output() { - } + @SerializedName(SERIALIZED_NAME_LABELS) + private List labels = new ArrayList<>(); - public AddLabelsToSourceV1Output labels(List labels) { - - this.labels = labels; - return this; - } + public AddLabelsToSourceV1Output() {} - public AddLabelsToSourceV1Output addLabelsItem(LabelV1 labelsItem) { - this.labels.add(labelsItem); - return this; - } + public AddLabelsToSourceV1Output labels(List labels) { - /** - * All labels applied to the Source. - * @return labels - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "All labels applied to the Source.") + this.labels = labels; + return this; + } - public List getLabels() { - return labels; - } + public AddLabelsToSourceV1Output addLabelsItem(LabelV1 labelsItem) { + if (this.labels == null) { + this.labels = new ArrayList<>(); + } + this.labels.add(labelsItem); + return this; + } + /** + * All labels applied to the Source. + * + * @return labels + */ + @javax.annotation.Nonnull + public List getLabels() { + return labels; + } - public void setLabels(List labels) { - this.labels = labels; - } + public void setLabels(List labels) { + this.labels = labels; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddLabelsToSourceV1Output addLabelsToSourceV1Output = (AddLabelsToSourceV1Output) o; + return Objects.equals(this.labels, addLabelsToSourceV1Output.labels); + } + @Override + public int hashCode() { + return Objects.hash(labels); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddLabelsToSourceV1Output {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddLabelsToSourceV1Output addLabelsToSourceV1Output = (AddLabelsToSourceV1Output) o; - return Objects.equals(this.labels, addLabelsToSourceV1Output.labels); - } - - @Override - public int hashCode() { - return Objects.hash(labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddLabelsToSourceV1Output {\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("labels"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("labels"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("labels"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddLabelsToSourceV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddLabelsToSourceV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddLabelsToSourceV1Output is not found in the empty JSON string", AddLabelsToSourceV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AddLabelsToSourceV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddLabelsToSourceV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddLabelsToSourceV1Output is not found" + + " in the empty JSON string", + AddLabelsToSourceV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddLabelsToSourceV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddLabelsToSourceV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddLabelsToSourceV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddLabelsToSourceV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AddLabelsToSourceV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddLabelsToSourceV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("labels").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `labels` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("labels").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - } + JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); + // validate the required field `labels` (array) + for (int i = 0; i < jsonArraylabels.size(); i++) { + LabelV1.validateJsonElement(jsonArraylabels.get(i)); + } + ; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddLabelsToSourceV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddLabelsToSourceV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddLabelsToSourceV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddLabelsToSourceV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddLabelsToSourceV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddLabelsToSourceV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddLabelsToSourceV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AddLabelsToSourceV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddLabelsToSourceV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddLabelsToSourceV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddLabelsToSourceV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddLabelsToSourceV1Output + * @throws IOException if the JSON string is invalid with respect to AddLabelsToSourceV1Output + */ + public static AddLabelsToSourceV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddLabelsToSourceV1Output.class); } - } - - /** - * Create an instance of AddLabelsToSourceV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddLabelsToSourceV1Output - * @throws IOException if the JSON string is invalid with respect to AddLabelsToSourceV1Output - */ - public static AddLabelsToSourceV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddLabelsToSourceV1Output.class); - } - - /** - * Convert an instance of AddLabelsToSourceV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddLabelsToSourceV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddPermissionsToUser200Response.java b/src/main/java/com/segment/publicapi/models/AddPermissionsToUser200Response.java index d6368aee..1a6612b7 100644 --- a/src/main/java/com/segment/publicapi/models/AddPermissionsToUser200Response.java +++ b/src/main/java/com/segment/publicapi/models/AddPermissionsToUser200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.AddPermissionsToUserV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * AddPermissionsToUser200Response - */ - +/** AddPermissionsToUser200Response */ public class AddPermissionsToUser200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private AddPermissionsToUserV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public AddPermissionsToUser200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private AddPermissionsToUserV1Output data; - public AddPermissionsToUser200Response data(AddPermissionsToUserV1Output data) { - - this.data = data; - return this; - } + public AddPermissionsToUser200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public AddPermissionsToUser200Response data(AddPermissionsToUserV1Output data) { - public AddPermissionsToUserV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public AddPermissionsToUserV1Output getData() { + return data; + } - public void setData(AddPermissionsToUserV1Output data) { - this.data = data; - } + public void setData(AddPermissionsToUserV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddPermissionsToUser200Response addPermissionsToUser200Response = + (AddPermissionsToUser200Response) o; + return Objects.equals(this.data, addPermissionsToUser200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddPermissionsToUser200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddPermissionsToUser200Response addPermissionsToUser200Response = (AddPermissionsToUser200Response) o; - return Objects.equals(this.data, addPermissionsToUser200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddPermissionsToUser200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddPermissionsToUser200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddPermissionsToUser200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddPermissionsToUser200Response is not found in the empty JSON string", AddPermissionsToUser200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddPermissionsToUser200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddPermissionsToUser200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddPermissionsToUser200Response is not" + + " found in the empty JSON string", + AddPermissionsToUser200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddPermissionsToUser200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddPermissionsToUser200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddPermissionsToUser200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddPermissionsToUser200Response` 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()) { + AddPermissionsToUserV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddPermissionsToUser200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddPermissionsToUser200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddPermissionsToUser200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddPermissionsToUser200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddPermissionsToUser200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddPermissionsToUser200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddPermissionsToUser200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddPermissionsToUser200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddPermissionsToUser200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddPermissionsToUser200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddPermissionsToUser200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddPermissionsToUser200Response + * @throws IOException if the JSON string is invalid with respect to + * AddPermissionsToUser200Response + */ + public static AddPermissionsToUser200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddPermissionsToUser200Response.class); } - } - - /** - * Create an instance of AddPermissionsToUser200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddPermissionsToUser200Response - * @throws IOException if the JSON string is invalid with respect to AddPermissionsToUser200Response - */ - public static AddPermissionsToUser200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddPermissionsToUser200Response.class); - } - - /** - * Convert an instance of AddPermissionsToUser200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddPermissionsToUser200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddPermissionsToUserGroup200Response.java b/src/main/java/com/segment/publicapi/models/AddPermissionsToUserGroup200Response.java index e2613c95..d3ed1500 100644 --- a/src/main/java/com/segment/publicapi/models/AddPermissionsToUserGroup200Response.java +++ b/src/main/java/com/segment/publicapi/models/AddPermissionsToUserGroup200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.AddPermissionsToUserGroupV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * AddPermissionsToUserGroup200Response - */ - +/** AddPermissionsToUserGroup200Response */ public class AddPermissionsToUserGroup200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private AddPermissionsToUserGroupV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public AddPermissionsToUserGroup200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private AddPermissionsToUserGroupV1Output data; - public AddPermissionsToUserGroup200Response data(AddPermissionsToUserGroupV1Output data) { - - this.data = data; - return this; - } + public AddPermissionsToUserGroup200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public AddPermissionsToUserGroup200Response data(AddPermissionsToUserGroupV1Output data) { - public AddPermissionsToUserGroupV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public AddPermissionsToUserGroupV1Output getData() { + return data; + } - public void setData(AddPermissionsToUserGroupV1Output data) { - this.data = data; - } + public void setData(AddPermissionsToUserGroupV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddPermissionsToUserGroup200Response addPermissionsToUserGroup200Response = + (AddPermissionsToUserGroup200Response) o; + return Objects.equals(this.data, addPermissionsToUserGroup200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddPermissionsToUserGroup200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddPermissionsToUserGroup200Response addPermissionsToUserGroup200Response = (AddPermissionsToUserGroup200Response) o; - return Objects.equals(this.data, addPermissionsToUserGroup200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddPermissionsToUserGroup200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddPermissionsToUserGroup200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddPermissionsToUserGroup200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddPermissionsToUserGroup200Response is not found in the empty JSON string", AddPermissionsToUserGroup200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddPermissionsToUserGroup200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddPermissionsToUserGroup200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddPermissionsToUserGroup200Response" + + " is not found in the empty JSON string", + AddPermissionsToUserGroup200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddPermissionsToUserGroup200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddPermissionsToUserGroup200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddPermissionsToUserGroup200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddPermissionsToUserGroup200Response` 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()) { + AddPermissionsToUserGroupV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddPermissionsToUserGroup200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddPermissionsToUserGroup200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddPermissionsToUserGroup200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddPermissionsToUserGroup200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddPermissionsToUserGroup200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddPermissionsToUserGroup200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddPermissionsToUserGroup200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddPermissionsToUserGroup200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, AddPermissionsToUserGroup200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddPermissionsToUserGroup200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddPermissionsToUserGroup200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddPermissionsToUserGroup200Response + * @throws IOException if the JSON string is invalid with respect to + * AddPermissionsToUserGroup200Response + */ + public static AddPermissionsToUserGroup200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, AddPermissionsToUserGroup200Response.class); } - } - - /** - * Create an instance of AddPermissionsToUserGroup200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddPermissionsToUserGroup200Response - * @throws IOException if the JSON string is invalid with respect to AddPermissionsToUserGroup200Response - */ - public static AddPermissionsToUserGroup200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddPermissionsToUserGroup200Response.class); - } - - /** - * Convert an instance of AddPermissionsToUserGroup200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddPermissionsToUserGroup200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddPermissionsToUserGroupV1Input.java b/src/main/java/com/segment/publicapi/models/AddPermissionsToUserGroupV1Input.java index d560fd08..79cb7ef0 100644 --- a/src/main/java/com/segment/publicapi/models/AddPermissionsToUserGroupV1Input.java +++ b/src/main/java/com/segment/publicapi/models/AddPermissionsToUserGroupV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,217 +9,224 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PermissionInputV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Adds a list of permissions to a user group. */ +public class AddPermissionsToUserGroupV1Input { + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; -/** - * Adds a list of permissions to a user group. - */ -@ApiModel(description = "Adds a list of permissions to a user group.") + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions = new ArrayList<>(); -public class AddPermissionsToUserGroupV1Input { - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions = null; - - public AddPermissionsToUserGroupV1Input() { - } - - public AddPermissionsToUserGroupV1Input permissions(List permissions) { - - this.permissions = permissions; - return this; - } - - public AddPermissionsToUserGroupV1Input addPermissionsItem(PermissionInputV1 permissionsItem) { - if (this.permissions == null) { - this.permissions = new ArrayList<>(); - } - this.permissions.add(permissionsItem); - return this; - } + public AddPermissionsToUserGroupV1Input() {} - /** - * The permissions to add. - * @return permissions - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The permissions to add.") + public AddPermissionsToUserGroupV1Input permissions(List permissions) { - public List getPermissions() { - return permissions; - } + this.permissions = permissions; + return this; + } + public AddPermissionsToUserGroupV1Input addPermissionsItem(PermissionInputV1 permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); + } + this.permissions.add(permissionsItem); + return this; + } - public void setPermissions(List permissions) { - this.permissions = permissions; - } + /** + * The permissions to add. + * + * @return permissions + */ + @javax.annotation.Nonnull + public List getPermissions() { + return permissions; + } + public void setPermissions(List permissions) { + this.permissions = permissions; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input = + (AddPermissionsToUserGroupV1Input) o; + return Objects.equals(this.permissions, addPermissionsToUserGroupV1Input.permissions); + } + + @Override + public int hashCode() { + return Objects.hash(permissions); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddPermissionsToUserGroupV1Input {\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddPermissionsToUserGroupV1Input addPermissionsToUserGroupV1Input = (AddPermissionsToUserGroupV1Input) o; - return Objects.equals(this.permissions, addPermissionsToUserGroupV1Input.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(permissions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddPermissionsToUserGroupV1Input {\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("permissions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("permissions"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("permissions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddPermissionsToUserGroupV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddPermissionsToUserGroupV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddPermissionsToUserGroupV1Input is not found in the empty JSON string", AddPermissionsToUserGroupV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddPermissionsToUserGroupV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddPermissionsToUserGroupV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddPermissionsToUserGroupV1Input is" + + " not found in the empty JSON string", + AddPermissionsToUserGroupV1Input.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddPermissionsToUserGroupV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddPermissionsToUserGroupV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddPermissionsToUserGroupV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddPermissionsToUserGroupV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddPermissionsToUserGroupV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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())); } - } - if (jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { + JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - if (jsonArraypermissions != null) { - // ensure the json data is an array - if (!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())); - } + // validate the required field `permissions` (array) + for (int i = 0; i < jsonArraypermissions.size(); i++) { + PermissionInputV1.validateJsonElement(jsonArraypermissions.get(i)); } - } - } + ; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddPermissionsToUserGroupV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddPermissionsToUserGroupV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddPermissionsToUserGroupV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddPermissionsToUserGroupV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddPermissionsToUserGroupV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddPermissionsToUserGroupV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddPermissionsToUserGroupV1Input' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddPermissionsToUserGroupV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddPermissionsToUserGroupV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddPermissionsToUserGroupV1Input read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddPermissionsToUserGroupV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddPermissionsToUserGroupV1Input + * @throws IOException if the JSON string is invalid with respect to + * AddPermissionsToUserGroupV1Input + */ + public static AddPermissionsToUserGroupV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddPermissionsToUserGroupV1Input.class); } - } - - /** - * Create an instance of AddPermissionsToUserGroupV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddPermissionsToUserGroupV1Input - * @throws IOException if the JSON string is invalid with respect to AddPermissionsToUserGroupV1Input - */ - public static AddPermissionsToUserGroupV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddPermissionsToUserGroupV1Input.class); - } - - /** - * Convert an instance of AddPermissionsToUserGroupV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddPermissionsToUserGroupV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddPermissionsToUserGroupV1Output.java b/src/main/java/com/segment/publicapi/models/AddPermissionsToUserGroupV1Output.java index 5076337b..6b615543 100644 --- a/src/main/java/com/segment/publicapi/models/AddPermissionsToUserGroupV1Output.java +++ b/src/main/java/com/segment/publicapi/models/AddPermissionsToUserGroupV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,219 +9,226 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.AccessPermissionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the group's permissions, including the added permissions. - */ -@ApiModel(description = "Returns the group's permissions, including the added permissions.") - +/** Returns the group's permissions, including the added permissions. */ public class AddPermissionsToUserGroupV1Output { - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions = new ArrayList<>(); + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - public AddPermissionsToUserGroupV1Output() { - } + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions = new ArrayList<>(); - public AddPermissionsToUserGroupV1Output permissions(List permissions) { - - this.permissions = permissions; - return this; - } + public AddPermissionsToUserGroupV1Output() {} - public AddPermissionsToUserGroupV1Output addPermissionsItem(AccessPermissionV1 permissionsItem) { - this.permissions.add(permissionsItem); - return this; - } + public AddPermissionsToUserGroupV1Output permissions(List permissions) { - /** - * The updated set of permissions assigned to the user group. - * @return permissions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The updated set of permissions assigned to the user group.") + this.permissions = permissions; + return this; + } - public List getPermissions() { - return permissions; - } + public AddPermissionsToUserGroupV1Output addPermissionsItem( + AccessPermissionV1 permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); + } + this.permissions.add(permissionsItem); + return this; + } + /** + * The updated set of permissions assigned to the user group. + * + * @return permissions + */ + @javax.annotation.Nonnull + public List getPermissions() { + return permissions; + } - public void setPermissions(List permissions) { - this.permissions = permissions; - } + public void setPermissions(List permissions) { + this.permissions = permissions; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddPermissionsToUserGroupV1Output addPermissionsToUserGroupV1Output = + (AddPermissionsToUserGroupV1Output) o; + return Objects.equals(this.permissions, addPermissionsToUserGroupV1Output.permissions); + } + @Override + public int hashCode() { + return Objects.hash(permissions); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddPermissionsToUserGroupV1Output {\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddPermissionsToUserGroupV1Output addPermissionsToUserGroupV1Output = (AddPermissionsToUserGroupV1Output) o; - return Objects.equals(this.permissions, addPermissionsToUserGroupV1Output.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(permissions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddPermissionsToUserGroupV1Output {\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("permissions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("permissions"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("permissions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("permissions"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddPermissionsToUserGroupV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddPermissionsToUserGroupV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddPermissionsToUserGroupV1Output is not found in the empty JSON string", AddPermissionsToUserGroupV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddPermissionsToUserGroupV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddPermissionsToUserGroupV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddPermissionsToUserGroupV1Output is" + + " not found in the empty JSON string", + AddPermissionsToUserGroupV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddPermissionsToUserGroupV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddPermissionsToUserGroupV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddPermissionsToUserGroupV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddPermissionsToUserGroupV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AddPermissionsToUserGroupV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddPermissionsToUserGroupV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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())); } - } - // ensure the json data is an array - if (!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())); - } - JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - } + JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); + // validate the required field `permissions` (array) + for (int i = 0; i < jsonArraypermissions.size(); i++) { + AccessPermissionV1.validateJsonElement(jsonArraypermissions.get(i)); + } + ; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddPermissionsToUserGroupV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddPermissionsToUserGroupV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddPermissionsToUserGroupV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddPermissionsToUserGroupV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddPermissionsToUserGroupV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddPermissionsToUserGroupV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddPermissionsToUserGroupV1Output' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddPermissionsToUserGroupV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddPermissionsToUserGroupV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddPermissionsToUserGroupV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddPermissionsToUserGroupV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddPermissionsToUserGroupV1Output + * @throws IOException if the JSON string is invalid with respect to + * AddPermissionsToUserGroupV1Output + */ + public static AddPermissionsToUserGroupV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddPermissionsToUserGroupV1Output.class); } - } - - /** - * Create an instance of AddPermissionsToUserGroupV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddPermissionsToUserGroupV1Output - * @throws IOException if the JSON string is invalid with respect to AddPermissionsToUserGroupV1Output - */ - public static AddPermissionsToUserGroupV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddPermissionsToUserGroupV1Output.class); - } - - /** - * Convert an instance of AddPermissionsToUserGroupV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddPermissionsToUserGroupV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddPermissionsToUserV1Input.java b/src/main/java/com/segment/publicapi/models/AddPermissionsToUserV1Input.java index f83e6042..69987234 100644 --- a/src/main/java/com/segment/publicapi/models/AddPermissionsToUserV1Input.java +++ b/src/main/java/com/segment/publicapi/models/AddPermissionsToUserV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,217 +9,220 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PermissionInputV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Adds a list of permissions to a user. */ +public class AddPermissionsToUserV1Input { + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; -/** - * Adds a list of permissions to a user. - */ -@ApiModel(description = "Adds a list of permissions to a user.") + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions = new ArrayList<>(); -public class AddPermissionsToUserV1Input { - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions = null; - - public AddPermissionsToUserV1Input() { - } - - public AddPermissionsToUserV1Input permissions(List permissions) { - - this.permissions = permissions; - return this; - } - - public AddPermissionsToUserV1Input addPermissionsItem(PermissionInputV1 permissionsItem) { - if (this.permissions == null) { - this.permissions = new ArrayList<>(); - } - this.permissions.add(permissionsItem); - return this; - } + public AddPermissionsToUserV1Input() {} - /** - * The permissions to add. - * @return permissions - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The permissions to add.") + public AddPermissionsToUserV1Input permissions(List permissions) { - public List getPermissions() { - return permissions; - } + this.permissions = permissions; + return this; + } + public AddPermissionsToUserV1Input addPermissionsItem(PermissionInputV1 permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); + } + this.permissions.add(permissionsItem); + return this; + } - public void setPermissions(List permissions) { - this.permissions = permissions; - } + /** + * The permissions to add. + * + * @return permissions + */ + @javax.annotation.Nonnull + public List getPermissions() { + return permissions; + } + public void setPermissions(List permissions) { + this.permissions = permissions; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddPermissionsToUserV1Input addPermissionsToUserV1Input = (AddPermissionsToUserV1Input) o; + return Objects.equals(this.permissions, addPermissionsToUserV1Input.permissions); + } + + @Override + public int hashCode() { + return Objects.hash(permissions); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddPermissionsToUserV1Input {\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddPermissionsToUserV1Input addPermissionsToUserV1Input = (AddPermissionsToUserV1Input) o; - return Objects.equals(this.permissions, addPermissionsToUserV1Input.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(permissions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddPermissionsToUserV1Input {\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("permissions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("permissions"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("permissions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddPermissionsToUserV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddPermissionsToUserV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddPermissionsToUserV1Input is not found in the empty JSON string", AddPermissionsToUserV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddPermissionsToUserV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddPermissionsToUserV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddPermissionsToUserV1Input is not" + + " found in the empty JSON string", + AddPermissionsToUserV1Input.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddPermissionsToUserV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddPermissionsToUserV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddPermissionsToUserV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddPermissionsToUserV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddPermissionsToUserV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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())); } - } - if (jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { + JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - if (jsonArraypermissions != null) { - // ensure the json data is an array - if (!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())); - } + // validate the required field `permissions` (array) + for (int i = 0; i < jsonArraypermissions.size(); i++) { + PermissionInputV1.validateJsonElement(jsonArraypermissions.get(i)); } - } - } + ; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddPermissionsToUserV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddPermissionsToUserV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddPermissionsToUserV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddPermissionsToUserV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddPermissionsToUserV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddPermissionsToUserV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddPermissionsToUserV1Input' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AddPermissionsToUserV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddPermissionsToUserV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddPermissionsToUserV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddPermissionsToUserV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddPermissionsToUserV1Input + * @throws IOException if the JSON string is invalid with respect to AddPermissionsToUserV1Input + */ + public static AddPermissionsToUserV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddPermissionsToUserV1Input.class); } - } - - /** - * Create an instance of AddPermissionsToUserV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddPermissionsToUserV1Input - * @throws IOException if the JSON string is invalid with respect to AddPermissionsToUserV1Input - */ - public static AddPermissionsToUserV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddPermissionsToUserV1Input.class); - } - - /** - * Convert an instance of AddPermissionsToUserV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddPermissionsToUserV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddPermissionsToUserV1Output.java b/src/main/java/com/segment/publicapi/models/AddPermissionsToUserV1Output.java index 65b2ffe7..624264db 100644 --- a/src/main/java/com/segment/publicapi/models/AddPermissionsToUserV1Output.java +++ b/src/main/java/com/segment/publicapi/models/AddPermissionsToUserV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,219 +9,223 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.AccessPermissionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the user's permissions, including the added permissions. - */ -@ApiModel(description = "Returns the user's permissions, including the added permissions.") - +/** Returns the user's permissions, including the added permissions. */ public class AddPermissionsToUserV1Output { - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions = new ArrayList<>(); + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - public AddPermissionsToUserV1Output() { - } + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions = new ArrayList<>(); - public AddPermissionsToUserV1Output permissions(List permissions) { - - this.permissions = permissions; - return this; - } + public AddPermissionsToUserV1Output() {} - public AddPermissionsToUserV1Output addPermissionsItem(AccessPermissionV1 permissionsItem) { - this.permissions.add(permissionsItem); - return this; - } + public AddPermissionsToUserV1Output permissions(List permissions) { - /** - * The new permissions. - * @return permissions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The new permissions.") + this.permissions = permissions; + return this; + } - public List getPermissions() { - return permissions; - } + public AddPermissionsToUserV1Output addPermissionsItem(AccessPermissionV1 permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); + } + this.permissions.add(permissionsItem); + return this; + } + /** + * The new permissions. + * + * @return permissions + */ + @javax.annotation.Nonnull + public List getPermissions() { + return permissions; + } - public void setPermissions(List permissions) { - this.permissions = permissions; - } + public void setPermissions(List permissions) { + this.permissions = permissions; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddPermissionsToUserV1Output addPermissionsToUserV1Output = + (AddPermissionsToUserV1Output) o; + return Objects.equals(this.permissions, addPermissionsToUserV1Output.permissions); + } + @Override + public int hashCode() { + return Objects.hash(permissions); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddPermissionsToUserV1Output {\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddPermissionsToUserV1Output addPermissionsToUserV1Output = (AddPermissionsToUserV1Output) o; - return Objects.equals(this.permissions, addPermissionsToUserV1Output.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(permissions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddPermissionsToUserV1Output {\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("permissions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("permissions"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("permissions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("permissions"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddPermissionsToUserV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddPermissionsToUserV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddPermissionsToUserV1Output is not found in the empty JSON string", AddPermissionsToUserV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddPermissionsToUserV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddPermissionsToUserV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddPermissionsToUserV1Output is not" + + " found in the empty JSON string", + AddPermissionsToUserV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddPermissionsToUserV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddPermissionsToUserV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddPermissionsToUserV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddPermissionsToUserV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AddPermissionsToUserV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddPermissionsToUserV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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())); } - } - // ensure the json data is an array - if (!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())); - } - JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - } + JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); + // validate the required field `permissions` (array) + for (int i = 0; i < jsonArraypermissions.size(); i++) { + AccessPermissionV1.validateJsonElement(jsonArraypermissions.get(i)); + } + ; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddPermissionsToUserV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddPermissionsToUserV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddPermissionsToUserV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddPermissionsToUserV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddPermissionsToUserV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddPermissionsToUserV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddPermissionsToUserV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddPermissionsToUserV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddPermissionsToUserV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddPermissionsToUserV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddPermissionsToUserV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddPermissionsToUserV1Output + * @throws IOException if the JSON string is invalid with respect to + * AddPermissionsToUserV1Output + */ + public static AddPermissionsToUserV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddPermissionsToUserV1Output.class); } - } - - /** - * Create an instance of AddPermissionsToUserV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddPermissionsToUserV1Output - * @throws IOException if the JSON string is invalid with respect to AddPermissionsToUserV1Output - */ - public static AddPermissionsToUserV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddPermissionsToUserV1Output.class); - } - - /** - * Convert an instance of AddPermissionsToUserV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddPermissionsToUserV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddSourceToTrackingPlan200Response.java b/src/main/java/com/segment/publicapi/models/AddSourceToTrackingPlan200Response.java index a4533edd..8a7b4ad2 100644 --- a/src/main/java/com/segment/publicapi/models/AddSourceToTrackingPlan200Response.java +++ b/src/main/java/com/segment/publicapi/models/AddSourceToTrackingPlan200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,193 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.AddSourceToTrackingPlanV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * AddSourceToTrackingPlan200Response - */ - +/** AddSourceToTrackingPlan200Response */ public class AddSourceToTrackingPlan200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private AddSourceToTrackingPlanV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public AddSourceToTrackingPlan200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private AddSourceToTrackingPlanV1Output data; - public AddSourceToTrackingPlan200Response data(AddSourceToTrackingPlanV1Output data) { - - this.data = data; - return this; - } + public AddSourceToTrackingPlan200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public AddSourceToTrackingPlan200Response data(AddSourceToTrackingPlanV1Output data) { - public AddSourceToTrackingPlanV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public AddSourceToTrackingPlanV1Output getData() { + return data; + } - public void setData(AddSourceToTrackingPlanV1Output data) { - this.data = data; - } + public void setData(AddSourceToTrackingPlanV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddSourceToTrackingPlan200Response addSourceToTrackingPlan200Response = + (AddSourceToTrackingPlan200Response) o; + return Objects.equals(this.data, addSourceToTrackingPlan200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddSourceToTrackingPlan200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddSourceToTrackingPlan200Response addSourceToTrackingPlan200Response = (AddSourceToTrackingPlan200Response) o; - return Objects.equals(this.data, addSourceToTrackingPlan200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddSourceToTrackingPlan200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddSourceToTrackingPlan200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddSourceToTrackingPlan200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddSourceToTrackingPlan200Response is not found in the empty JSON string", AddSourceToTrackingPlan200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddSourceToTrackingPlan200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddSourceToTrackingPlan200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddSourceToTrackingPlan200Response is" + + " not found in the empty JSON string", + AddSourceToTrackingPlan200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddSourceToTrackingPlan200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddSourceToTrackingPlan200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddSourceToTrackingPlan200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddSourceToTrackingPlan200Response` 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()) { + AddSourceToTrackingPlanV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddSourceToTrackingPlan200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddSourceToTrackingPlan200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddSourceToTrackingPlan200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddSourceToTrackingPlan200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddSourceToTrackingPlan200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddSourceToTrackingPlan200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddSourceToTrackingPlan200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddSourceToTrackingPlan200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddSourceToTrackingPlan200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddSourceToTrackingPlan200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddSourceToTrackingPlan200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddSourceToTrackingPlan200Response + * @throws IOException if the JSON string is invalid with respect to + * AddSourceToTrackingPlan200Response + */ + public static AddSourceToTrackingPlan200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, AddSourceToTrackingPlan200Response.class); } - } - - /** - * Create an instance of AddSourceToTrackingPlan200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddSourceToTrackingPlan200Response - * @throws IOException if the JSON string is invalid with respect to AddSourceToTrackingPlan200Response - */ - public static AddSourceToTrackingPlan200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddSourceToTrackingPlan200Response.class); - } - - /** - * Convert an instance of AddSourceToTrackingPlan200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddSourceToTrackingPlan200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddSourceToTrackingPlanV1Input.java b/src/main/java/com/segment/publicapi/models/AddSourceToTrackingPlanV1Input.java index 35f4a137..eb2b8596 100644 --- a/src/main/java/com/segment/publicapi/models/AddSourceToTrackingPlanV1Input.java +++ b/src/main/java/com/segment/publicapi/models/AddSourceToTrackingPlanV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,200 +9,206 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Connects a Source to a Tracking Plan. - */ -@ApiModel(description = "Connects a Source to a Tracking Plan.") - +/** Connects a Source to a Tracking Plan. */ public class AddSourceToTrackingPlanV1Input { - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - public AddSourceToTrackingPlanV1Input() { - } + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; - public AddSourceToTrackingPlanV1Input sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + public AddSourceToTrackingPlanV1Input() {} - /** - * The id of the Source associated with the Tracking Plan. Config API note: analogous to `sourceName`. - * @return sourceId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the Source associated with the Tracking Plan. Config API note: analogous to `sourceName`.") + public AddSourceToTrackingPlanV1Input sourceId(String sourceId) { - public String getSourceId() { - return sourceId; - } + this.sourceId = sourceId; + return this; + } + /** + * The id of the Source associated with the Tracking Plan. Config API note: analogous to + * `sourceName`. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input = + (AddSourceToTrackingPlanV1Input) o; + return Objects.equals(this.sourceId, addSourceToTrackingPlanV1Input.sourceId); + } + @Override + public int hashCode() { + return Objects.hash(sourceId); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddSourceToTrackingPlanV1Input {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddSourceToTrackingPlanV1Input addSourceToTrackingPlanV1Input = (AddSourceToTrackingPlanV1Input) o; - return Objects.equals(this.sourceId, addSourceToTrackingPlanV1Input.sourceId); - } - - @Override - public int hashCode() { - return Objects.hash(sourceId); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddSourceToTrackingPlanV1Input {\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourceId"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddSourceToTrackingPlanV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddSourceToTrackingPlanV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddSourceToTrackingPlanV1Input is not found in the empty JSON string", AddSourceToTrackingPlanV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddSourceToTrackingPlanV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddSourceToTrackingPlanV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddSourceToTrackingPlanV1Input is not" + + " found in the empty JSON string", + AddSourceToTrackingPlanV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddSourceToTrackingPlanV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddSourceToTrackingPlanV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddSourceToTrackingPlanV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddSourceToTrackingPlanV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddSourceToTrackingPlanV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); } - } - if ((jsonObj.get("sourceId") != null && !jsonObj.get("sourceId").isJsonNull()) && !jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddSourceToTrackingPlanV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddSourceToTrackingPlanV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddSourceToTrackingPlanV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddSourceToTrackingPlanV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddSourceToTrackingPlanV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of AddSourceToTrackingPlanV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddSourceToTrackingPlanV1Input - * @throws IOException if the JSON string is invalid with respect to AddSourceToTrackingPlanV1Input - */ - public static AddSourceToTrackingPlanV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddSourceToTrackingPlanV1Input.class); - } - - /** - * Convert an instance of AddSourceToTrackingPlanV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddSourceToTrackingPlanV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddSourceToTrackingPlanV1Input' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddSourceToTrackingPlanV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddSourceToTrackingPlanV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddSourceToTrackingPlanV1Input read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddSourceToTrackingPlanV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddSourceToTrackingPlanV1Input + * @throws IOException if the JSON string is invalid with respect to + * AddSourceToTrackingPlanV1Input + */ + public static AddSourceToTrackingPlanV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddSourceToTrackingPlanV1Input.class); + } + + /** + * Convert an instance of AddSourceToTrackingPlanV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddSourceToTrackingPlanV1Output.java b/src/main/java/com/segment/publicapi/models/AddSourceToTrackingPlanV1Output.java index 727caa7d..cb3b8fbb 100644 --- a/src/main/java/com/segment/publicapi/models/AddSourceToTrackingPlanV1Output.java +++ b/src/main/java/com/segment/publicapi/models/AddSourceToTrackingPlanV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,250 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Connects a Source to a Tracking Plan. - */ -@ApiModel(description = "Connects a Source to a Tracking Plan.") - +/** Connects a Source to a Tracking Plan. */ public class AddSourceToTrackingPlanV1Output { - /** - * The operation status. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The operation status. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public AddSourceToTrackingPlanV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public AddSourceToTrackingPlanV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public AddSourceToTrackingPlanV1Output() {} - /** - * The operation status. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The operation status.") + public AddSourceToTrackingPlanV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The operation status. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + AddSourceToTrackingPlanV1Output addSourceToTrackingPlanV1Output = + (AddSourceToTrackingPlanV1Output) o; + return Objects.equals(this.status, addSourceToTrackingPlanV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddSourceToTrackingPlanV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddSourceToTrackingPlanV1Output addSourceToTrackingPlanV1Output = (AddSourceToTrackingPlanV1Output) o; - return Objects.equals(this.status, addSourceToTrackingPlanV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddSourceToTrackingPlanV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddSourceToTrackingPlanV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddSourceToTrackingPlanV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddSourceToTrackingPlanV1Output is not found in the empty JSON string", AddSourceToTrackingPlanV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddSourceToTrackingPlanV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddSourceToTrackingPlanV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddSourceToTrackingPlanV1Output is not" + + " found in the empty JSON string", + AddSourceToTrackingPlanV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddSourceToTrackingPlanV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddSourceToTrackingPlanV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddSourceToTrackingPlanV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddSourceToTrackingPlanV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AddSourceToTrackingPlanV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddSourceToTrackingPlanV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!AddSourceToTrackingPlanV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddSourceToTrackingPlanV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddSourceToTrackingPlanV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddSourceToTrackingPlanV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddSourceToTrackingPlanV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of AddSourceToTrackingPlanV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddSourceToTrackingPlanV1Output - * @throws IOException if the JSON string is invalid with respect to AddSourceToTrackingPlanV1Output - */ - public static AddSourceToTrackingPlanV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddSourceToTrackingPlanV1Output.class); - } - - /** - * Convert an instance of AddSourceToTrackingPlanV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddSourceToTrackingPlanV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddSourceToTrackingPlanV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddSourceToTrackingPlanV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddSourceToTrackingPlanV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddSourceToTrackingPlanV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddSourceToTrackingPlanV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddSourceToTrackingPlanV1Output + * @throws IOException if the JSON string is invalid with respect to + * AddSourceToTrackingPlanV1Output + */ + public static AddSourceToTrackingPlanV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddSourceToTrackingPlanV1Output.class); + } + + /** + * Convert an instance of AddSourceToTrackingPlanV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddUsersToUserGroup200Response.java b/src/main/java/com/segment/publicapi/models/AddUsersToUserGroup200Response.java index 4593501a..4b95e09d 100644 --- a/src/main/java/com/segment/publicapi/models/AddUsersToUserGroup200Response.java +++ b/src/main/java/com/segment/publicapi/models/AddUsersToUserGroup200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.AddUsersToUserGroupV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * AddUsersToUserGroup200Response - */ - +/** AddUsersToUserGroup200Response */ public class AddUsersToUserGroup200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private AddUsersToUserGroupV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public AddUsersToUserGroup200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private AddUsersToUserGroupV1Output data; - public AddUsersToUserGroup200Response data(AddUsersToUserGroupV1Output data) { - - this.data = data; - return this; - } + public AddUsersToUserGroup200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public AddUsersToUserGroup200Response data(AddUsersToUserGroupV1Output data) { - public AddUsersToUserGroupV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public AddUsersToUserGroupV1Output getData() { + return data; + } - public void setData(AddUsersToUserGroupV1Output data) { - this.data = data; - } + public void setData(AddUsersToUserGroupV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddUsersToUserGroup200Response addUsersToUserGroup200Response = + (AddUsersToUserGroup200Response) o; + return Objects.equals(this.data, addUsersToUserGroup200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddUsersToUserGroup200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddUsersToUserGroup200Response addUsersToUserGroup200Response = (AddUsersToUserGroup200Response) o; - return Objects.equals(this.data, addUsersToUserGroup200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddUsersToUserGroup200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddUsersToUserGroup200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddUsersToUserGroup200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddUsersToUserGroup200Response is not found in the empty JSON string", AddUsersToUserGroup200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddUsersToUserGroup200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddUsersToUserGroup200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddUsersToUserGroup200Response is not" + + " found in the empty JSON string", + AddUsersToUserGroup200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddUsersToUserGroup200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddUsersToUserGroup200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddUsersToUserGroup200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddUsersToUserGroup200Response` 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()) { + AddUsersToUserGroupV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddUsersToUserGroup200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddUsersToUserGroup200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddUsersToUserGroup200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddUsersToUserGroup200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddUsersToUserGroup200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddUsersToUserGroup200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddUsersToUserGroup200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddUsersToUserGroup200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddUsersToUserGroup200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddUsersToUserGroup200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddUsersToUserGroup200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddUsersToUserGroup200Response + * @throws IOException if the JSON string is invalid with respect to + * AddUsersToUserGroup200Response + */ + public static AddUsersToUserGroup200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddUsersToUserGroup200Response.class); } - } - - /** - * Create an instance of AddUsersToUserGroup200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddUsersToUserGroup200Response - * @throws IOException if the JSON string is invalid with respect to AddUsersToUserGroup200Response - */ - public static AddUsersToUserGroup200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddUsersToUserGroup200Response.class); - } - - /** - * Convert an instance of AddUsersToUserGroup200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddUsersToUserGroup200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddUsersToUserGroupV1Input.java b/src/main/java/com/segment/publicapi/models/AddUsersToUserGroupV1Input.java index 271fef24..e8d93a3f 100644 --- a/src/main/java/com/segment/publicapi/models/AddUsersToUserGroupV1Input.java +++ b/src/main/java/com/segment/publicapi/models/AddUsersToUserGroupV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,211 +9,215 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Adds a list of users and invites to a user group. */ +public class AddUsersToUserGroupV1Input { + public static final String SERIALIZED_NAME_EMAILS = "emails"; -/** - * Adds a list of users and invites to a user group. - */ -@ApiModel(description = "Adds a list of users and invites to a user group.") + @SerializedName(SERIALIZED_NAME_EMAILS) + private List emails = new ArrayList<>(); -public class AddUsersToUserGroupV1Input { - public static final String SERIALIZED_NAME_EMAILS = "emails"; - @SerializedName(SERIALIZED_NAME_EMAILS) - private List emails = null; - - public AddUsersToUserGroupV1Input() { - } - - public AddUsersToUserGroupV1Input emails(List emails) { - - this.emails = emails; - return this; - } - - public AddUsersToUserGroupV1Input addEmailsItem(String emailsItem) { - if (this.emails == null) { - this.emails = new ArrayList<>(); - } - this.emails.add(emailsItem); - return this; - } + public AddUsersToUserGroupV1Input() {} - /** - * The email addresses of the users and invites to add. - * @return emails - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The email addresses of the users and invites to add.") + public AddUsersToUserGroupV1Input emails(List emails) { - public List getEmails() { - return emails; - } + this.emails = emails; + return this; + } + public AddUsersToUserGroupV1Input addEmailsItem(String emailsItem) { + if (this.emails == null) { + this.emails = new ArrayList<>(); + } + this.emails.add(emailsItem); + return this; + } - public void setEmails(List emails) { - this.emails = emails; - } + /** + * The email addresses of the users and invites to add. + * + * @return emails + */ + @javax.annotation.Nonnull + public List getEmails() { + return emails; + } + public void setEmails(List emails) { + this.emails = emails; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddUsersToUserGroupV1Input addUsersToUserGroupV1Input = (AddUsersToUserGroupV1Input) o; + return Objects.equals(this.emails, addUsersToUserGroupV1Input.emails); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public int hashCode() { + return Objects.hash(emails); } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddUsersToUserGroupV1Input {\n"); + sb.append(" emails: ").append(toIndentedString(emails)).append("\n"); + sb.append("}"); + return sb.toString(); } - AddUsersToUserGroupV1Input addUsersToUserGroupV1Input = (AddUsersToUserGroupV1Input) o; - return Objects.equals(this.emails, addUsersToUserGroupV1Input.emails); - } - - @Override - public int hashCode() { - return Objects.hash(emails); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddUsersToUserGroupV1Input {\n"); - sb.append(" emails: ").append(toIndentedString(emails)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("emails"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("emails"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("emails"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddUsersToUserGroupV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddUsersToUserGroupV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddUsersToUserGroupV1Input is not found in the empty JSON string", AddUsersToUserGroupV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AddUsersToUserGroupV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddUsersToUserGroupV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddUsersToUserGroupV1Input is not" + + " found in the empty JSON string", + AddUsersToUserGroupV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddUsersToUserGroupV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddUsersToUserGroupV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddUsersToUserGroupV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddUsersToUserGroupV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddUsersToUserGroupV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 required json array is present + if (jsonObj.get("emails") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("emails").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `emails` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("emails").toString())); } - } - // ensure the optional json data is an array if present - if (jsonObj.get("emails") != null && !jsonObj.get("emails").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `emails` to be an array in the JSON string but got `%s`", jsonObj.get("emails").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddUsersToUserGroupV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddUsersToUserGroupV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddUsersToUserGroupV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddUsersToUserGroupV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddUsersToUserGroupV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of AddUsersToUserGroupV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddUsersToUserGroupV1Input - * @throws IOException if the JSON string is invalid with respect to AddUsersToUserGroupV1Input - */ - public static AddUsersToUserGroupV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddUsersToUserGroupV1Input.class); - } - - /** - * Convert an instance of AddUsersToUserGroupV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddUsersToUserGroupV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddUsersToUserGroupV1Input' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AddUsersToUserGroupV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddUsersToUserGroupV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddUsersToUserGroupV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddUsersToUserGroupV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddUsersToUserGroupV1Input + * @throws IOException if the JSON string is invalid with respect to AddUsersToUserGroupV1Input + */ + public static AddUsersToUserGroupV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddUsersToUserGroupV1Input.class); + } + + /** + * Convert an instance of AddUsersToUserGroupV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AddUsersToUserGroupV1Output.java b/src/main/java/com/segment/publicapi/models/AddUsersToUserGroupV1Output.java index 10a1cf92..6e1bcc5d 100644 --- a/src/main/java/com/segment/publicapi/models/AddUsersToUserGroupV1Output.java +++ b/src/main/java/com/segment/publicapi/models/AddUsersToUserGroupV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,196 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UserGroup1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the updated user group. - */ -@ApiModel(description = "Returns the updated user group.") - +/** Returns the updated user group. */ public class AddUsersToUserGroupV1Output { - public static final String SERIALIZED_NAME_USER_GROUP = "userGroup"; - @SerializedName(SERIALIZED_NAME_USER_GROUP) - private UserGroup1 userGroup; + public static final String SERIALIZED_NAME_USER_GROUP = "userGroup"; - public AddUsersToUserGroupV1Output() { - } + @SerializedName(SERIALIZED_NAME_USER_GROUP) + private UserGroupV1 userGroup; - public AddUsersToUserGroupV1Output userGroup(UserGroup1 userGroup) { - - this.userGroup = userGroup; - return this; - } + public AddUsersToUserGroupV1Output() {} - /** - * Get userGroup - * @return userGroup - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public AddUsersToUserGroupV1Output userGroup(UserGroupV1 userGroup) { - public UserGroup1 getUserGroup() { - return userGroup; - } + this.userGroup = userGroup; + return this; + } + /** + * Get userGroup + * + * @return userGroup + */ + @javax.annotation.Nonnull + public UserGroupV1 getUserGroup() { + return userGroup; + } - public void setUserGroup(UserGroup1 userGroup) { - this.userGroup = userGroup; - } + public void setUserGroup(UserGroupV1 userGroup) { + this.userGroup = userGroup; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddUsersToUserGroupV1Output addUsersToUserGroupV1Output = (AddUsersToUserGroupV1Output) o; + return Objects.equals(this.userGroup, addUsersToUserGroupV1Output.userGroup); + } + @Override + public int hashCode() { + return Objects.hash(userGroup); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddUsersToUserGroupV1Output {\n"); + sb.append(" userGroup: ").append(toIndentedString(userGroup)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AddUsersToUserGroupV1Output addUsersToUserGroupV1Output = (AddUsersToUserGroupV1Output) o; - return Objects.equals(this.userGroup, addUsersToUserGroupV1Output.userGroup); - } - - @Override - public int hashCode() { - return Objects.hash(userGroup); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddUsersToUserGroupV1Output {\n"); - sb.append(" userGroup: ").append(toIndentedString(userGroup)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("userGroup"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("userGroup"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("userGroup"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("userGroup"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AddUsersToUserGroupV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AddUsersToUserGroupV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AddUsersToUserGroupV1Output is not found in the empty JSON string", AddUsersToUserGroupV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AddUsersToUserGroupV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddUsersToUserGroupV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AddUsersToUserGroupV1Output is not" + + " found in the empty JSON string", + AddUsersToUserGroupV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AddUsersToUserGroupV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddUsersToUserGroupV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddUsersToUserGroupV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AddUsersToUserGroupV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AddUsersToUserGroupV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddUsersToUserGroupV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `userGroup` + UserGroupV1.validateJsonElement(jsonObj.get("userGroup")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddUsersToUserGroupV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddUsersToUserGroupV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AddUsersToUserGroupV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AddUsersToUserGroupV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddUsersToUserGroupV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddUsersToUserGroupV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddUsersToUserGroupV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AddUsersToUserGroupV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddUsersToUserGroupV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddUsersToUserGroupV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AddUsersToUserGroupV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddUsersToUserGroupV1Output + * @throws IOException if the JSON string is invalid with respect to AddUsersToUserGroupV1Output + */ + public static AddUsersToUserGroupV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddUsersToUserGroupV1Output.class); } - } - - /** - * Create an instance of AddUsersToUserGroupV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddUsersToUserGroupV1Output - * @throws IOException if the JSON string is invalid with respect to AddUsersToUserGroupV1Output - */ - public static AddUsersToUserGroupV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddUsersToUserGroupV1Output.class); - } - - /** - * Convert an instance of AddUsersToUserGroupV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of AddUsersToUserGroupV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AdvancedWarehouseSyncScheduleV1Input.java b/src/main/java/com/segment/publicapi/models/AdvancedWarehouseSyncScheduleV1Input.java index c71a11a4..db519752 100644 --- a/src/main/java/com/segment/publicapi/models/AdvancedWarehouseSyncScheduleV1Input.java +++ b/src/main/java/com/segment/publicapi/models/AdvancedWarehouseSyncScheduleV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,264 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.WarehouseAdvancedSyncV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Defines the advanced sync schedule for a Warehouse. - */ -@ApiModel(description = "Defines the advanced sync schedule for a Warehouse.") - +/** Defines the advanced sync schedule for a Warehouse. */ public class AdvancedWarehouseSyncScheduleV1Input { - public static final String SERIALIZED_NAME_TIMES = "times"; - @SerializedName(SERIALIZED_NAME_TIMES) - private List times = new ArrayList<>(); - - public static final String SERIALIZED_NAME_TIMEZONE = "timezone"; - @SerializedName(SERIALIZED_NAME_TIMEZONE) - private String timezone; + public static final String SERIALIZED_NAME_TIMES = "times"; - public AdvancedWarehouseSyncScheduleV1Input() { - } + @SerializedName(SERIALIZED_NAME_TIMES) + private List times = new ArrayList<>(); - public AdvancedWarehouseSyncScheduleV1Input times(List times) { - - this.times = times; - return this; - } + public static final String SERIALIZED_NAME_TIMEZONE = "timezone"; - public AdvancedWarehouseSyncScheduleV1Input addTimesItem(WarehouseAdvancedSyncV1 timesItem) { - this.times.add(timesItem); - return this; - } + @SerializedName(SERIALIZED_NAME_TIMEZONE) + private String timezone; - /** - * A list that contains the times when syncs should occur. - * @return times - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list that contains the times when syncs should occur.") + public AdvancedWarehouseSyncScheduleV1Input() {} - public List getTimes() { - return times; - } + public AdvancedWarehouseSyncScheduleV1Input times(List times) { + this.times = times; + return this; + } - public void setTimes(List times) { - this.times = times; - } + public AdvancedWarehouseSyncScheduleV1Input addTimesItem(WarehouseAdvancedSyncV1 timesItem) { + if (this.times == null) { + this.times = new ArrayList<>(); + } + this.times.add(timesItem); + return this; + } + /** + * A list that contains the times when syncs should occur. + * + * @return times + */ + @javax.annotation.Nonnull + public List getTimes() { + return times; + } - public AdvancedWarehouseSyncScheduleV1Input timezone(String timezone) { - - this.timezone = timezone; - return this; - } + public void setTimes(List times) { + this.times = times; + } - /** - * A TZ-database timezone for this sync schedule. - * @return timezone - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A TZ-database timezone for this sync schedule.") + public AdvancedWarehouseSyncScheduleV1Input timezone(String timezone) { - public String getTimezone() { - return timezone; - } + this.timezone = timezone; + return this; + } + /** + * A TZ-database timezone for this sync schedule. + * + * @return timezone + */ + @javax.annotation.Nonnull + public String getTimezone() { + return timezone; + } - public void setTimezone(String timezone) { - this.timezone = timezone; - } + public void setTimezone(String timezone) { + this.timezone = timezone; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdvancedWarehouseSyncScheduleV1Input advancedWarehouseSyncScheduleV1Input = + (AdvancedWarehouseSyncScheduleV1Input) o; + return Objects.equals(this.times, advancedWarehouseSyncScheduleV1Input.times) + && Objects.equals(this.timezone, advancedWarehouseSyncScheduleV1Input.timezone); + } + @Override + public int hashCode() { + return Objects.hash(times, timezone); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdvancedWarehouseSyncScheduleV1Input {\n"); + sb.append(" times: ").append(toIndentedString(times)).append("\n"); + sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - AdvancedWarehouseSyncScheduleV1Input advancedWarehouseSyncScheduleV1Input = (AdvancedWarehouseSyncScheduleV1Input) o; - return Objects.equals(this.times, advancedWarehouseSyncScheduleV1Input.times) && - Objects.equals(this.timezone, advancedWarehouseSyncScheduleV1Input.timezone); - } - - @Override - public int hashCode() { - return Objects.hash(times, timezone); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AdvancedWarehouseSyncScheduleV1Input {\n"); - sb.append(" times: ").append(toIndentedString(times)).append("\n"); - sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("times"); + openapiFields.add("timezone"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("times"); + openapiRequiredFields.add("timezone"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("times"); - openapiFields.add("timezone"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("times"); - openapiRequiredFields.add("timezone"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AdvancedWarehouseSyncScheduleV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AdvancedWarehouseSyncScheduleV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AdvancedWarehouseSyncScheduleV1Input is not found in the empty JSON string", AdvancedWarehouseSyncScheduleV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AdvancedWarehouseSyncScheduleV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdvancedWarehouseSyncScheduleV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AdvancedWarehouseSyncScheduleV1Input" + + " is not found in the empty JSON string", + AdvancedWarehouseSyncScheduleV1Input.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AdvancedWarehouseSyncScheduleV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdvancedWarehouseSyncScheduleV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdvancedWarehouseSyncScheduleV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AdvancedWarehouseSyncScheduleV1Input` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AdvancedWarehouseSyncScheduleV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdvancedWarehouseSyncScheduleV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("times").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `times` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("times").toString())); + } + + JsonArray jsonArraytimes = jsonObj.getAsJsonArray("times"); + // validate the required field `times` (array) + for (int i = 0; i < jsonArraytimes.size(); i++) { + WarehouseAdvancedSyncV1.validateJsonElement(jsonArraytimes.get(i)); + } + ; + if (!jsonObj.get("timezone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `timezone` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("timezone").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("times").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `times` to be an array in the JSON string but got `%s`", jsonObj.get("times").toString())); - } - - JsonArray jsonArraytimes = jsonObj.getAsJsonArray("times"); - if (!jsonObj.get("timezone").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `timezone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timezone").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AdvancedWarehouseSyncScheduleV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AdvancedWarehouseSyncScheduleV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AdvancedWarehouseSyncScheduleV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AdvancedWarehouseSyncScheduleV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AdvancedWarehouseSyncScheduleV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of AdvancedWarehouseSyncScheduleV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of AdvancedWarehouseSyncScheduleV1Input - * @throws IOException if the JSON string is invalid with respect to AdvancedWarehouseSyncScheduleV1Input - */ - public static AdvancedWarehouseSyncScheduleV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AdvancedWarehouseSyncScheduleV1Input.class); - } - - /** - * Convert an instance of AdvancedWarehouseSyncScheduleV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdvancedWarehouseSyncScheduleV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdvancedWarehouseSyncScheduleV1Input' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AdvancedWarehouseSyncScheduleV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, AdvancedWarehouseSyncScheduleV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdvancedWarehouseSyncScheduleV1Input read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AdvancedWarehouseSyncScheduleV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdvancedWarehouseSyncScheduleV1Input + * @throws IOException if the JSON string is invalid with respect to + * AdvancedWarehouseSyncScheduleV1Input + */ + public static AdvancedWarehouseSyncScheduleV1Input fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, AdvancedWarehouseSyncScheduleV1Input.class); + } + + /** + * Convert an instance of AdvancedWarehouseSyncScheduleV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AdvancedWarehouseSyncScheduleV1Output.java b/src/main/java/com/segment/publicapi/models/AdvancedWarehouseSyncScheduleV1Output.java index de73ab3f..d118ddac 100644 --- a/src/main/java/com/segment/publicapi/models/AdvancedWarehouseSyncScheduleV1Output.java +++ b/src/main/java/com/segment/publicapi/models/AdvancedWarehouseSyncScheduleV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,250 +9,257 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.WarehouseAdvancedSyncV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Defines the advanced sync schedule for a Warehouse. - */ -@ApiModel(description = "Defines the advanced sync schedule for a Warehouse.") - +/** Defines the advanced sync schedule for a Warehouse. */ public class AdvancedWarehouseSyncScheduleV1Output { - public static final String SERIALIZED_NAME_TIMES = "times"; - @SerializedName(SERIALIZED_NAME_TIMES) - private List times = null; - - public static final String SERIALIZED_NAME_TIMEZONE = "timezone"; - @SerializedName(SERIALIZED_NAME_TIMEZONE) - private String timezone; - - public AdvancedWarehouseSyncScheduleV1Output() { - } - - public AdvancedWarehouseSyncScheduleV1Output times(List times) { - - this.times = times; - return this; - } - - public AdvancedWarehouseSyncScheduleV1Output addTimesItem(WarehouseAdvancedSyncV1 timesItem) { - if (this.times == null) { - this.times = new ArrayList<>(); - } - this.times.add(timesItem); - return this; - } + public static final String SERIALIZED_NAME_TIMES = "times"; - /** - * A list that contains the times when syncs should occur. - * @return times - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A list that contains the times when syncs should occur.") + @SerializedName(SERIALIZED_NAME_TIMES) + private List times; - public List getTimes() { - return times; - } + public static final String SERIALIZED_NAME_TIMEZONE = "timezone"; + @SerializedName(SERIALIZED_NAME_TIMEZONE) + private String timezone; - public void setTimes(List times) { - this.times = times; - } + public AdvancedWarehouseSyncScheduleV1Output() {} + public AdvancedWarehouseSyncScheduleV1Output times(List times) { - public AdvancedWarehouseSyncScheduleV1Output timezone(String timezone) { - - this.timezone = timezone; - return this; - } - - /** - * A TZ-database timezone for this sync schedule. - * @return timezone - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A TZ-database timezone for this sync schedule.") + this.times = times; + return this; + } - public String getTimezone() { - return timezone; - } + public AdvancedWarehouseSyncScheduleV1Output addTimesItem(WarehouseAdvancedSyncV1 timesItem) { + if (this.times == null) { + this.times = new ArrayList<>(); + } + this.times.add(timesItem); + return this; + } + /** + * A list that contains the times when syncs should occur. + * + * @return times + */ + @javax.annotation.Nullable + public List getTimes() { + return times; + } - public void setTimezone(String timezone) { - this.timezone = timezone; - } + public void setTimes(List times) { + this.times = times; + } + public AdvancedWarehouseSyncScheduleV1Output timezone(String timezone) { + this.timezone = timezone; + return this; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * A TZ-database timezone for this sync schedule. + * + * @return timezone + */ + @javax.annotation.Nullable + public String getTimezone() { + return timezone; } - if (o == null || getClass() != o.getClass()) { - return false; + + public void setTimezone(String timezone) { + this.timezone = timezone; } - AdvancedWarehouseSyncScheduleV1Output advancedWarehouseSyncScheduleV1Output = (AdvancedWarehouseSyncScheduleV1Output) o; - return Objects.equals(this.times, advancedWarehouseSyncScheduleV1Output.times) && - Objects.equals(this.timezone, advancedWarehouseSyncScheduleV1Output.timezone); - } - @Override - public int hashCode() { - return Objects.hash(times, timezone); - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdvancedWarehouseSyncScheduleV1Output advancedWarehouseSyncScheduleV1Output = + (AdvancedWarehouseSyncScheduleV1Output) o; + return Objects.equals(this.times, advancedWarehouseSyncScheduleV1Output.times) + && Objects.equals(this.timezone, advancedWarehouseSyncScheduleV1Output.timezone); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AdvancedWarehouseSyncScheduleV1Output {\n"); - sb.append(" times: ").append(toIndentedString(times)).append("\n"); - sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); - sb.append("}"); - return sb.toString(); - } + @Override + public int hashCode() { + return Objects.hash(times, timezone); + } - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdvancedWarehouseSyncScheduleV1Output {\n"); + sb.append(" times: ").append(toIndentedString(times)).append("\n"); + sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); + sb.append("}"); + return sb.toString(); } - return o.toString().replace("\n", "\n "); - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("times"); - openapiFields.add("timezone"); + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("times"); + openapiFields.add("timezone"); - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AdvancedWarehouseSyncScheduleV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AdvancedWarehouseSyncScheduleV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AdvancedWarehouseSyncScheduleV1Output is not found in the empty JSON string", AdvancedWarehouseSyncScheduleV1Output.openapiRequiredFields.toString())); + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AdvancedWarehouseSyncScheduleV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdvancedWarehouseSyncScheduleV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AdvancedWarehouseSyncScheduleV1Output" + + " is not found in the empty JSON string", + AdvancedWarehouseSyncScheduleV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AdvancedWarehouseSyncScheduleV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdvancedWarehouseSyncScheduleV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdvancedWarehouseSyncScheduleV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AdvancedWarehouseSyncScheduleV1Output` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - if (jsonObj.get("times") != null && !jsonObj.get("times").isJsonNull()) { - JsonArray jsonArraytimes = jsonObj.getAsJsonArray("times"); - if (jsonArraytimes != null) { - // ensure the json data is an array - if (!jsonObj.get("times").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `times` to be an array in the JSON string but got `%s`", jsonObj.get("times").toString())); - } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("times") != null && !jsonObj.get("times").isJsonNull()) { + JsonArray jsonArraytimes = jsonObj.getAsJsonArray("times"); + if (jsonArraytimes != null) { + // ensure the json data is an array + if (!jsonObj.get("times").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `times` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("times").toString())); + } + + // validate the optional field `times` (array) + for (int i = 0; i < jsonArraytimes.size(); i++) { + WarehouseAdvancedSyncV1.validateJsonElement(jsonArraytimes.get(i)); + } + ; + } } - } - if ((jsonObj.get("timezone") != null && !jsonObj.get("timezone").isJsonNull()) && !jsonObj.get("timezone").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `timezone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timezone").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AdvancedWarehouseSyncScheduleV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AdvancedWarehouseSyncScheduleV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AdvancedWarehouseSyncScheduleV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AdvancedWarehouseSyncScheduleV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AdvancedWarehouseSyncScheduleV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } + if ((jsonObj.get("timezone") != null && !jsonObj.get("timezone").isJsonNull()) + && !jsonObj.get("timezone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `timezone` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("timezone").toString())); + } + } - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdvancedWarehouseSyncScheduleV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdvancedWarehouseSyncScheduleV1Output' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AdvancedWarehouseSyncScheduleV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, AdvancedWarehouseSyncScheduleV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdvancedWarehouseSyncScheduleV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } } - } - /** - * Create an instance of AdvancedWarehouseSyncScheduleV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of AdvancedWarehouseSyncScheduleV1Output - * @throws IOException if the JSON string is invalid with respect to AdvancedWarehouseSyncScheduleV1Output - */ - public static AdvancedWarehouseSyncScheduleV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AdvancedWarehouseSyncScheduleV1Output.class); - } + /** + * Create an instance of AdvancedWarehouseSyncScheduleV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdvancedWarehouseSyncScheduleV1Output + * @throws IOException if the JSON string is invalid with respect to + * AdvancedWarehouseSyncScheduleV1Output + */ + public static AdvancedWarehouseSyncScheduleV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, AdvancedWarehouseSyncScheduleV1Output.class); + } - /** - * Convert an instance of AdvancedWarehouseSyncScheduleV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + /** + * Convert an instance of AdvancedWarehouseSyncScheduleV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } - diff --git a/src/main/java/com/segment/publicapi/models/AllowedLabelBeta.java b/src/main/java/com/segment/publicapi/models/AllowedLabelBeta.java index df59d42c..027124c3 100644 --- a/src/main/java/com/segment/publicapi/models/AllowedLabelBeta.java +++ b/src/main/java/com/segment/publicapi/models/AllowedLabelBeta.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,275 +9,271 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Defines a label that you may apply to resources within a Workspace. */ +public class AllowedLabelBeta { + public static final String SERIALIZED_NAME_KEY = "key"; -/** - * Defines a label that you may apply to resources within a Workspace. - */ -@ApiModel(description = "Defines a label that you may apply to resources within a Workspace.") + @SerializedName(SERIALIZED_NAME_KEY) + private String key; -public class AllowedLabelBeta { - public static final String SERIALIZED_NAME_KEY = "key"; - @SerializedName(SERIALIZED_NAME_KEY) - private String key; + public static final String SERIALIZED_NAME_VALUE = "value"; - public static final String SERIALIZED_NAME_VALUE = "value"; - @SerializedName(SERIALIZED_NAME_VALUE) - private String value; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value; - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - public AllowedLabelBeta() { - } + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - public AllowedLabelBeta key(String key) { - - this.key = key; - return this; - } + public AllowedLabelBeta() {} - /** - * The key identifier for this label. - * @return key - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The key identifier for this label.") + public AllowedLabelBeta key(String key) { - public String getKey() { - return key; - } + this.key = key; + return this; + } + /** + * The key identifier for this label. + * + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } - public void setKey(String key) { - this.key = key; - } + public void setKey(String key) { + this.key = key; + } + public AllowedLabelBeta value(String value) { - public AllowedLabelBeta value(String value) { - - this.value = value; - return this; - } + this.value = value; + return this; + } - /** - * The value of this label. - * @return value - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The value of this label.") + /** + * The value of this label. + * + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } - public String getValue() { - return value; - } + public void setValue(String value) { + this.value = value; + } + public AllowedLabelBeta description(String description) { - public void setValue(String value) { - this.value = value; - } + this.description = description; + return this; + } + /** + * A description of what this label represents. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } - public AllowedLabelBeta description(String description) { - - this.description = description; - return this; - } + public void setDescription(String description) { + this.description = description; + } - /** - * A description of what this label represents. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A description of what this label represents.") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllowedLabelBeta allowedLabelBeta = (AllowedLabelBeta) o; + return Objects.equals(this.key, allowedLabelBeta.key) + && Objects.equals(this.value, allowedLabelBeta.value) + && Objects.equals(this.description, allowedLabelBeta.description); + } - public String getDescription() { - return description; - } + @Override + public int hashCode() { + return Objects.hash(key, value, description); + } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllowedLabelBeta {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public void setDescription(String description) { - this.description = description; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("key"); + openapiFields.add("value"); + openapiFields.add("description"); - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AllowedLabelBeta allowedLabelBeta = (AllowedLabelBeta) o; - return Objects.equals(this.key, allowedLabelBeta.key) && - Objects.equals(this.value, allowedLabelBeta.value) && - Objects.equals(this.description, allowedLabelBeta.description); - } - - @Override - public int hashCode() { - return Objects.hash(key, value, description); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AllowedLabelBeta {\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).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"; + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("value"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("key"); - openapiFields.add("value"); - openapiFields.add("description"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("key"); - openapiRequiredFields.add("value"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AllowedLabelBeta - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AllowedLabelBeta.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AllowedLabelBeta is not found in the empty JSON string", AllowedLabelBeta.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllowedLabelBeta + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllowedLabelBeta.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AllowedLabelBeta is not found in the" + + " empty JSON string", + AllowedLabelBeta.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AllowedLabelBeta.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllowedLabelBeta` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllowedLabelBeta.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AllowedLabelBeta` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AllowedLabelBeta.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllowedLabelBeta.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("key").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `key` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("key").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())); + } + 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("key").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").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())); - } - 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 (!AllowedLabelBeta.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AllowedLabelBeta' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AllowedLabelBeta.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AllowedLabelBeta value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AllowedLabelBeta read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of AllowedLabelBeta given an JSON string - * - * @param jsonString JSON string - * @return An instance of AllowedLabelBeta - * @throws IOException if the JSON string is invalid with respect to AllowedLabelBeta - */ - public static AllowedLabelBeta fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AllowedLabelBeta.class); - } - - /** - * Convert an instance of AllowedLabelBeta to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllowedLabelBeta.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllowedLabelBeta' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AllowedLabelBeta.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AllowedLabelBeta value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllowedLabelBeta read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AllowedLabelBeta given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllowedLabelBeta + * @throws IOException if the JSON string is invalid with respect to AllowedLabelBeta + */ + public static AllowedLabelBeta fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllowedLabelBeta.class); + } + + /** + * Convert an instance of AllowedLabelBeta to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudienceComputeCadence.java b/src/main/java/com/segment/publicapi/models/AudienceComputeCadence.java new file mode 100644 index 00000000..331b83cf --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudienceComputeCadence.java @@ -0,0 +1,260 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** AudienceComputeCadence */ +public class AudienceComputeCadence { + /** + * The cadence type on which the audience's membership is computed. If 'BATCH', the + * audience is computed on a periodic basis. If 'REALTIME', the audience is continously + * computed. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BATCH("BATCH"), + + REALTIME("REALTIME"); + + 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 AudienceComputeCadence() {} + + public AudienceComputeCadence type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * The cadence type on which the audience's membership is computed. If 'BATCH', the + * audience is computed on a periodic basis. If 'REALTIME', the audience is continously + * computed. + * + * @return type + */ + @javax.annotation.Nonnull + 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; + } + AudienceComputeCadence audienceComputeCadence = (AudienceComputeCadence) o; + return Objects.equals(this.type, audienceComputeCadence.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AudienceComputeCadence {\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(); + 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 AudienceComputeCadence + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudienceComputeCadence.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AudienceComputeCadence is not found in" + + " the empty JSON string", + AudienceComputeCadence.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudienceComputeCadence.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudienceComputeCadence` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AudienceComputeCadence.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AudienceComputeCadence.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudienceComputeCadence' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AudienceComputeCadence.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudienceComputeCadence value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudienceComputeCadence read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudienceComputeCadence given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudienceComputeCadence + * @throws IOException if the JSON string is invalid with respect to AudienceComputeCadence + */ + public static AudienceComputeCadence fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudienceComputeCadence.class); + } + + /** + * Convert an instance of AudienceComputeCadence to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudienceDefinition.java b/src/main/java/com/segment/publicapi/models/AudienceDefinition.java new file mode 100644 index 00000000..575c8342 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudienceDefinition.java @@ -0,0 +1,294 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** AudienceDefinition */ +public class AudienceDefinition { + /** + * The underlying data type being segmented for this audience. Possible values: users, accounts. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACCOUNTS("ACCOUNTS"), + + USERS("USERS"); + + 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_QUERY = "query"; + + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + + public AudienceDefinition() {} + + public AudienceDefinition type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * The underlying data type being segmented for this audience. Possible values: users, accounts. + * + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + public AudienceDefinition query(String query) { + + this.query = query; + return this; + } + + /** + * The query language string defining the audience segmentation criteria. For guidance on using + * the query language, see the [Segment documentation + * site](https://segment.com/docs/api/public-api/query-language). + * + * @return query + */ + @javax.annotation.Nonnull + 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; + } + AudienceDefinition audienceDefinition = (AudienceDefinition) o; + return Objects.equals(this.type, audienceDefinition.type) + && Objects.equals(this.query, audienceDefinition.query); + } + + @Override + public int hashCode() { + return Objects.hash(type, query); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AudienceDefinition {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\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("type"); + openapiFields.add("query"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("query"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AudienceDefinition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudienceDefinition.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AudienceDefinition is not found in the" + + " empty JSON string", + AudienceDefinition.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudienceDefinition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudienceDefinition` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AudienceDefinition.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!AudienceDefinition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudienceDefinition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AudienceDefinition.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudienceDefinition value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudienceDefinition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudienceDefinition given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudienceDefinition + * @throws IOException if the JSON string is invalid with respect to AudienceDefinition + */ + public static AudienceDefinition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudienceDefinition.class); + } + + /** + * Convert an instance of AudienceDefinition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudienceDefinitionWithoutType.java b/src/main/java/com/segment/publicapi/models/AudienceDefinitionWithoutType.java new file mode 100644 index 00000000..7130a1dd --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudienceDefinitionWithoutType.java @@ -0,0 +1,215 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** AudienceDefinitionWithoutType */ +public class AudienceDefinitionWithoutType { + public static final String SERIALIZED_NAME_QUERY = "query"; + + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + + public AudienceDefinitionWithoutType() {} + + public AudienceDefinitionWithoutType query(String query) { + + this.query = query; + return this; + } + + /** + * The query language string defining the audience segmentation criteria. For guidance on using + * the query language, see the [Segment documentation + * site](https://segment.com/docs/api/public-api/query-language). + * + * @return query + */ + @javax.annotation.Nonnull + 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; + } + AudienceDefinitionWithoutType audienceDefinitionWithoutType = + (AudienceDefinitionWithoutType) o; + return Objects.equals(this.query, audienceDefinitionWithoutType.query); + } + + @Override + public int hashCode() { + return Objects.hash(query); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AudienceDefinitionWithoutType {\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(); + openapiRequiredFields.add("query"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AudienceDefinitionWithoutType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudienceDefinitionWithoutType.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AudienceDefinitionWithoutType is not" + + " found in the empty JSON string", + AudienceDefinitionWithoutType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudienceDefinitionWithoutType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudienceDefinitionWithoutType` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AudienceDefinitionWithoutType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!AudienceDefinitionWithoutType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudienceDefinitionWithoutType' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AudienceDefinitionWithoutType.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudienceDefinitionWithoutType value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudienceDefinitionWithoutType read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudienceDefinitionWithoutType given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudienceDefinitionWithoutType + * @throws IOException if the JSON string is invalid with respect to + * AudienceDefinitionWithoutType + */ + public static AudienceDefinitionWithoutType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudienceDefinitionWithoutType.class); + } + + /** + * Convert an instance of AudienceDefinitionWithoutType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudienceOptions.java b/src/main/java/com/segment/publicapi/models/AudienceOptions.java new file mode 100644 index 00000000..e5dceab4 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudienceOptions.java @@ -0,0 +1,225 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** AudienceOptions */ +public class AudienceOptions { + public static final String SERIALIZED_NAME_INCLUDE_HISTORICAL_DATA = "includeHistoricalData"; + + @SerializedName(SERIALIZED_NAME_INCLUDE_HISTORICAL_DATA) + private Boolean includeHistoricalData; + + public static final String SERIALIZED_NAME_INCLUDE_ANONYMOUS_USERS = "includeAnonymousUsers"; + + @SerializedName(SERIALIZED_NAME_INCLUDE_ANONYMOUS_USERS) + private Boolean includeAnonymousUsers; + + public AudienceOptions() {} + + public AudienceOptions includeHistoricalData(Boolean includeHistoricalData) { + + this.includeHistoricalData = includeHistoricalData; + return this; + } + + /** + * Determines whether data prior to the audience being created is included when determining + * audience membership. Note that including historical data may be needed in order to properly + * handle the definition specified. In these cases, Segment will automatically handle including + * historical data and the response will return the includeHistoricalData parameter as true. + * + * @return includeHistoricalData + */ + @javax.annotation.Nullable + public Boolean getIncludeHistoricalData() { + return includeHistoricalData; + } + + public void setIncludeHistoricalData(Boolean includeHistoricalData) { + this.includeHistoricalData = includeHistoricalData; + } + + public AudienceOptions includeAnonymousUsers(Boolean includeAnonymousUsers) { + + this.includeAnonymousUsers = includeAnonymousUsers; + return this; + } + + /** + * Determines whether anonymous users should be included when determining audience membership. + * + * @return includeAnonymousUsers + */ + @javax.annotation.Nullable + public Boolean getIncludeAnonymousUsers() { + return includeAnonymousUsers; + } + + public void setIncludeAnonymousUsers(Boolean includeAnonymousUsers) { + this.includeAnonymousUsers = includeAnonymousUsers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AudienceOptions audienceOptions = (AudienceOptions) o; + return Objects.equals(this.includeHistoricalData, audienceOptions.includeHistoricalData) + && Objects.equals( + this.includeAnonymousUsers, audienceOptions.includeAnonymousUsers); + } + + @Override + public int hashCode() { + return Objects.hash(includeHistoricalData, includeAnonymousUsers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AudienceOptions {\n"); + sb.append(" includeHistoricalData: ") + .append(toIndentedString(includeHistoricalData)) + .append("\n"); + sb.append(" includeAnonymousUsers: ") + .append(toIndentedString(includeAnonymousUsers)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("includeHistoricalData"); + openapiFields.add("includeAnonymousUsers"); + + // 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 AudienceOptions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudienceOptions.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AudienceOptions is not found in the" + + " empty JSON string", + AudienceOptions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudienceOptions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudienceOptions` 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 (!AudienceOptions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudienceOptions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AudienceOptions.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudienceOptions value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudienceOptions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudienceOptions given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudienceOptions + * @throws IOException if the JSON string is invalid with respect to AudienceOptions + */ + public static AudienceOptions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudienceOptions.class); + } + + /** + * Convert an instance of AudienceOptions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudienceOptionsWithLookback.java b/src/main/java/com/segment/publicapi/models/AudienceOptionsWithLookback.java new file mode 100644 index 00000000..8d3e0565 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudienceOptionsWithLookback.java @@ -0,0 +1,337 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** AudienceOptionsWithLookback */ +public class AudienceOptionsWithLookback { + public static final String SERIALIZED_NAME_FILTER_BY_EXTERNAL_IDS = "filterByExternalIds"; + + @SerializedName(SERIALIZED_NAME_FILTER_BY_EXTERNAL_IDS) + private List filterByExternalIds = new ArrayList<>(); + + public static final String SERIALIZED_NAME_BACKFILL_EVENT_DATA_DAYS = "backfillEventDataDays"; + + @SerializedName(SERIALIZED_NAME_BACKFILL_EVENT_DATA_DAYS) + private BigDecimal backfillEventDataDays; + + public static final String SERIALIZED_NAME_INCLUDE_HISTORICAL_DATA = "includeHistoricalData"; + + @SerializedName(SERIALIZED_NAME_INCLUDE_HISTORICAL_DATA) + private Boolean includeHistoricalData; + + public static final String SERIALIZED_NAME_INCLUDE_ANONYMOUS_USERS = "includeAnonymousUsers"; + + @SerializedName(SERIALIZED_NAME_INCLUDE_ANONYMOUS_USERS) + private Boolean includeAnonymousUsers; + + public AudienceOptionsWithLookback() {} + + public AudienceOptionsWithLookback filterByExternalIds(List filterByExternalIds) { + + this.filterByExternalIds = filterByExternalIds; + return this; + } + + public AudienceOptionsWithLookback addFilterByExternalIdsItem(String filterByExternalIdsItem) { + if (this.filterByExternalIds == null) { + this.filterByExternalIds = new ArrayList<>(); + } + this.filterByExternalIds.add(filterByExternalIdsItem); + return this; + } + + /** + * The set of profile external identifiers being used to determine audience membership. Profiles + * will only be considered for audience membership if the profile has at least one external id + * whose key matches a value in this set. + * + * @return filterByExternalIds + */ + @javax.annotation.Nonnull + public List getFilterByExternalIds() { + return filterByExternalIds; + } + + public void setFilterByExternalIds(List filterByExternalIds) { + this.filterByExternalIds = filterByExternalIds; + } + + public AudienceOptionsWithLookback backfillEventDataDays(BigDecimal backfillEventDataDays) { + + this.backfillEventDataDays = backfillEventDataDays; + return this; + } + + /** + * If specified, the value of this field indicates the number of days, specified from the date + * the audience was created, that event data will be included from when determining audience + * membership. If unspecified, defer to the value of `includeHistoricalData` to + * determine whether historical data is either entirely included or entirely excluded when + * determining audience membership. + * + * @return backfillEventDataDays + */ + @javax.annotation.Nullable + public BigDecimal getBackfillEventDataDays() { + return backfillEventDataDays; + } + + public void setBackfillEventDataDays(BigDecimal backfillEventDataDays) { + this.backfillEventDataDays = backfillEventDataDays; + } + + public AudienceOptionsWithLookback includeHistoricalData(Boolean includeHistoricalData) { + + this.includeHistoricalData = includeHistoricalData; + return this; + } + + /** + * Determines whether data prior to the audience being created is included when determining + * audience membership. Note that including historical data may be needed in order to properly + * handle the definition specified. In these cases, Segment will automatically handle including + * historical data and the response will return the includeHistoricalData parameter as true. + * + * @return includeHistoricalData + */ + @javax.annotation.Nullable + public Boolean getIncludeHistoricalData() { + return includeHistoricalData; + } + + public void setIncludeHistoricalData(Boolean includeHistoricalData) { + this.includeHistoricalData = includeHistoricalData; + } + + public AudienceOptionsWithLookback includeAnonymousUsers(Boolean includeAnonymousUsers) { + + this.includeAnonymousUsers = includeAnonymousUsers; + return this; + } + + /** + * Determines whether anonymous users should be included when determining audience membership. + * + * @return includeAnonymousUsers + */ + @javax.annotation.Nullable + public Boolean getIncludeAnonymousUsers() { + return includeAnonymousUsers; + } + + public void setIncludeAnonymousUsers(Boolean includeAnonymousUsers) { + this.includeAnonymousUsers = includeAnonymousUsers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AudienceOptionsWithLookback audienceOptionsWithLookback = (AudienceOptionsWithLookback) o; + return Objects.equals( + this.filterByExternalIds, audienceOptionsWithLookback.filterByExternalIds) + && Objects.equals( + this.backfillEventDataDays, + audienceOptionsWithLookback.backfillEventDataDays) + && Objects.equals( + this.includeHistoricalData, + audienceOptionsWithLookback.includeHistoricalData) + && Objects.equals( + this.includeAnonymousUsers, + audienceOptionsWithLookback.includeAnonymousUsers); + } + + @Override + public int hashCode() { + return Objects.hash( + filterByExternalIds, + backfillEventDataDays, + includeHistoricalData, + includeAnonymousUsers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AudienceOptionsWithLookback {\n"); + sb.append(" filterByExternalIds: ") + .append(toIndentedString(filterByExternalIds)) + .append("\n"); + sb.append(" backfillEventDataDays: ") + .append(toIndentedString(backfillEventDataDays)) + .append("\n"); + sb.append(" includeHistoricalData: ") + .append(toIndentedString(includeHistoricalData)) + .append("\n"); + sb.append(" includeAnonymousUsers: ") + .append(toIndentedString(includeAnonymousUsers)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("filterByExternalIds"); + openapiFields.add("backfillEventDataDays"); + openapiFields.add("includeHistoricalData"); + openapiFields.add("includeAnonymousUsers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("filterByExternalIds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AudienceOptionsWithLookback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudienceOptionsWithLookback.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AudienceOptionsWithLookback is not" + + " found in the empty JSON string", + AudienceOptionsWithLookback.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudienceOptionsWithLookback.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudienceOptionsWithLookback` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AudienceOptionsWithLookback.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 required json array is present + if (jsonObj.get("filterByExternalIds") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("filterByExternalIds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `filterByExternalIds` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("filterByExternalIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AudienceOptionsWithLookback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudienceOptionsWithLookback' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AudienceOptionsWithLookback.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudienceOptionsWithLookback value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudienceOptionsWithLookback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudienceOptionsWithLookback given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudienceOptionsWithLookback + * @throws IOException if the JSON string is invalid with respect to AudienceOptionsWithLookback + */ + public static AudienceOptionsWithLookback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudienceOptionsWithLookback.class); + } + + /** + * Convert an instance of AudienceOptionsWithLookback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudiencePreview.java b/src/main/java/com/segment/publicapi/models/AudiencePreview.java new file mode 100644 index 00000000..f6f59e60 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudiencePreview.java @@ -0,0 +1,567 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** An audience preview. */ +public class AudiencePreview { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + /** The audience type of the preview. */ + @JsonAdapter(AudienceTypeEnum.Adapter.class) + public enum AudienceTypeEnum { + ACCOUNTS("ACCOUNTS"), + + LINKED("LINKED"), + + USERS("USERS"); + + private String value; + + AudienceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AudienceTypeEnum fromValue(String value) { + for (AudienceTypeEnum b : AudienceTypeEnum.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 AudienceTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AudienceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AudienceTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_AUDIENCE_TYPE = "audienceType"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE_TYPE) + private AudienceTypeEnum audienceType; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + + @SerializedName(SERIALIZED_NAME_DEFINITION) + private AudienceDefinitionWithoutType definition; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + + @SerializedName(SERIALIZED_NAME_OPTIONS) + private ReadAudiencePreviewOptions options; + + /** Status for the audience preview. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + COMPLETED("COMPLETED"), + + FAILED("FAILED"), + + RUNNING("RUNNING"); + + 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_RESULTS = "results"; + + @SerializedName(SERIALIZED_NAME_RESULTS) + private List results; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + private AudienceSize size; + + public static final String SERIALIZED_NAME_FAILURE_REASON = "failureReason"; + + @SerializedName(SERIALIZED_NAME_FAILURE_REASON) + private String failureReason; + + public AudiencePreview() {} + + public AudiencePreview id(String id) { + + this.id = id; + return this; + } + + /** + * Unique identifier for tracking and retrieving results of an audience preview. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AudiencePreview audienceType(AudienceTypeEnum audienceType) { + + this.audienceType = audienceType; + return this; + } + + /** + * The audience type of the preview. + * + * @return audienceType + */ + @javax.annotation.Nonnull + public AudienceTypeEnum getAudienceType() { + return audienceType; + } + + public void setAudienceType(AudienceTypeEnum audienceType) { + this.audienceType = audienceType; + } + + public AudiencePreview definition(AudienceDefinitionWithoutType definition) { + + this.definition = definition; + return this; + } + + /** + * Get definition + * + * @return definition + */ + @javax.annotation.Nonnull + public AudienceDefinitionWithoutType getDefinition() { + return definition; + } + + public void setDefinition(AudienceDefinitionWithoutType definition) { + this.definition = definition; + } + + public AudiencePreview options(ReadAudiencePreviewOptions options) { + + this.options = options; + return this; + } + + /** + * Get options + * + * @return options + */ + @javax.annotation.Nonnull + public ReadAudiencePreviewOptions getOptions() { + return options; + } + + public void setOptions(ReadAudiencePreviewOptions options) { + this.options = options; + } + + public AudiencePreview status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Status for the audience preview. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public AudiencePreview results(List results) { + + this.results = results; + return this; + } + + public AudiencePreview addResultsItem(AudiencePreviewResult resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } + this.results.add(resultsItem); + return this; + } + + /** + * Sampled result membership for the audience preview. Only has a value if the status is + * 'COMPLETED'. + * + * @return results + */ + @javax.annotation.Nullable + public List getResults() { + return results; + } + + public void setResults(List results) { + this.results = results; + } + + public AudiencePreview size(AudienceSize size) { + + this.size = size; + return this; + } + + /** + * Get size + * + * @return size + */ + @javax.annotation.Nullable + public AudienceSize getSize() { + return size; + } + + public void setSize(AudienceSize size) { + this.size = size; + } + + public AudiencePreview failureReason(String failureReason) { + + this.failureReason = failureReason; + return this; + } + + /** + * Explanation of why the audience preview failed. Only has a value if status is + * 'FAILED'. + * + * @return failureReason + */ + @javax.annotation.Nullable + public String getFailureReason() { + return failureReason; + } + + public void setFailureReason(String failureReason) { + this.failureReason = failureReason; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AudiencePreview audiencePreview = (AudiencePreview) o; + return Objects.equals(this.id, audiencePreview.id) + && Objects.equals(this.audienceType, audiencePreview.audienceType) + && Objects.equals(this.definition, audiencePreview.definition) + && Objects.equals(this.options, audiencePreview.options) + && Objects.equals(this.status, audiencePreview.status) + && Objects.equals(this.results, audiencePreview.results) + && Objects.equals(this.size, audiencePreview.size) + && Objects.equals(this.failureReason, audiencePreview.failureReason); + } + + @Override + public int hashCode() { + return Objects.hash( + id, audienceType, definition, options, status, results, size, failureReason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AudiencePreview {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" audienceType: ").append(toIndentedString(audienceType)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" failureReason: ").append(toIndentedString(failureReason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("audienceType"); + openapiFields.add("definition"); + openapiFields.add("options"); + openapiFields.add("status"); + openapiFields.add("results"); + openapiFields.add("size"); + openapiFields.add("failureReason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("audienceType"); + openapiRequiredFields.add("definition"); + openapiRequiredFields.add("options"); + 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 AudiencePreview + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudiencePreview.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AudiencePreview is not found in the" + + " empty JSON string", + AudiencePreview.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudiencePreview.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudiencePreview` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AudiencePreview.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("audienceType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `audienceType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("audienceType").toString())); + } + // validate the required field `definition` + AudienceDefinitionWithoutType.validateJsonElement(jsonObj.get("definition")); + // validate the required field `options` + ReadAudiencePreviewOptions.validateJsonElement(jsonObj.get("options")); + 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("results") != null && !jsonObj.get("results").isJsonNull()) { + JsonArray jsonArrayresults = jsonObj.getAsJsonArray("results"); + if (jsonArrayresults != null) { + // ensure the json data is an array + if (!jsonObj.get("results").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `results` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("results").toString())); + } + + // validate the optional field `results` (array) + for (int i = 0; i < jsonArrayresults.size(); i++) { + AudiencePreviewResult.validateJsonElement(jsonArrayresults.get(i)); + } + ; + } + } + // validate the optional field `size` + if (jsonObj.get("size") != null && !jsonObj.get("size").isJsonNull()) { + AudienceSize.validateJsonElement(jsonObj.get("size")); + } + if ((jsonObj.get("failureReason") != null && !jsonObj.get("failureReason").isJsonNull()) + && !jsonObj.get("failureReason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `failureReason` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("failureReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AudiencePreview.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudiencePreview' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AudiencePreview.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudiencePreview value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudiencePreview read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudiencePreview given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudiencePreview + * @throws IOException if the JSON string is invalid with respect to AudiencePreview + */ + public static AudiencePreview fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudiencePreview.class); + } + + /** + * Convert an instance of AudiencePreview to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudiencePreviewAccountResult.java b/src/main/java/com/segment/publicapi/models/AudiencePreviewAccountResult.java new file mode 100644 index 00000000..c2657ae4 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudiencePreviewAccountResult.java @@ -0,0 +1,212 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Result membership object for an audience preview with `audienceType: ACCOUNTS`. */ +public class AudiencePreviewAccountResult { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AudiencePreviewAccountResult() {} + + public AudiencePreviewAccountResult id(String id) { + + this.id = id; + return this; + } + + /** + * Account 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; + } + AudiencePreviewAccountResult audiencePreviewAccountResult = + (AudiencePreviewAccountResult) o; + return Objects.equals(this.id, audiencePreviewAccountResult.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AudiencePreviewAccountResult {\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("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + 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 + * AudiencePreviewAccountResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudiencePreviewAccountResult.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AudiencePreviewAccountResult is not" + + " found in the empty JSON string", + AudiencePreviewAccountResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudiencePreviewAccountResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudiencePreviewAccountResult` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AudiencePreviewAccountResult.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AudiencePreviewAccountResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudiencePreviewAccountResult' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AudiencePreviewAccountResult.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudiencePreviewAccountResult value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudiencePreviewAccountResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudiencePreviewAccountResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudiencePreviewAccountResult + * @throws IOException if the JSON string is invalid with respect to + * AudiencePreviewAccountResult + */ + public static AudiencePreviewAccountResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudiencePreviewAccountResult.class); + } + + /** + * Convert an instance of AudiencePreviewAccountResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudiencePreviewIdentifier.java b/src/main/java/com/segment/publicapi/models/AudiencePreviewIdentifier.java new file mode 100644 index 00000000..5fadb72a --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudiencePreviewIdentifier.java @@ -0,0 +1,208 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Identifier for an audience preview. */ +public class AudiencePreviewIdentifier { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AudiencePreviewIdentifier() {} + + public AudiencePreviewIdentifier id(String id) { + + this.id = id; + return this; + } + + /** + * Unique identifier for tracking and retrieving results of an audience preview. + * + * @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; + } + AudiencePreviewIdentifier audiencePreviewIdentifier = (AudiencePreviewIdentifier) o; + return Objects.equals(this.id, audiencePreviewIdentifier.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AudiencePreviewIdentifier {\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("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + 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 AudiencePreviewIdentifier + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudiencePreviewIdentifier.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AudiencePreviewIdentifier is not found" + + " in the empty JSON string", + AudiencePreviewIdentifier.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudiencePreviewIdentifier.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudiencePreviewIdentifier` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AudiencePreviewIdentifier.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AudiencePreviewIdentifier.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudiencePreviewIdentifier' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AudiencePreviewIdentifier.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudiencePreviewIdentifier value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudiencePreviewIdentifier read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudiencePreviewIdentifier given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudiencePreviewIdentifier + * @throws IOException if the JSON string is invalid with respect to AudiencePreviewIdentifier + */ + public static AudiencePreviewIdentifier fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudiencePreviewIdentifier.class); + } + + /** + * Convert an instance of AudiencePreviewIdentifier to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudiencePreviewProfileResult.java b/src/main/java/com/segment/publicapi/models/AudiencePreviewProfileResult.java new file mode 100644 index 00000000..c8fa29f8 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudiencePreviewProfileResult.java @@ -0,0 +1,254 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * Result membership object for an audience preview with `audienceType: USERS` or + * `audienceType: LINKED`. + */ +public class AudiencePreviewProfileResult { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ENTITIES = "entities"; + + @SerializedName(SERIALIZED_NAME_ENTITIES) + private Map> entities; + + public AudiencePreviewProfileResult() {} + + public AudiencePreviewProfileResult id(String id) { + + this.id = id; + return this; + } + + /** + * Segment id. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AudiencePreviewProfileResult entities(Map> entities) { + + this.entities = entities; + return this; + } + + public AudiencePreviewProfileResult putEntitiesItem( + String key, List entitiesItem) { + if (this.entities == null) { + this.entities = new HashMap<>(); + } + this.entities.put(key, entitiesItem); + return this; + } + + /** + * Associated entities. + * + * @return entities + */ + @javax.annotation.Nullable + public Map> getEntities() { + return entities; + } + + public void setEntities(Map> entities) { + this.entities = entities; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AudiencePreviewProfileResult audiencePreviewProfileResult = + (AudiencePreviewProfileResult) o; + return Objects.equals(this.id, audiencePreviewProfileResult.id) + && Objects.equals(this.entities, audiencePreviewProfileResult.entities); + } + + @Override + public int hashCode() { + return Objects.hash(id, entities); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AudiencePreviewProfileResult {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" entities: ").append(toIndentedString(entities)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("entities"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + 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 + * AudiencePreviewProfileResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudiencePreviewProfileResult.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AudiencePreviewProfileResult is not" + + " found in the empty JSON string", + AudiencePreviewProfileResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudiencePreviewProfileResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudiencePreviewProfileResult` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AudiencePreviewProfileResult.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AudiencePreviewProfileResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudiencePreviewProfileResult' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AudiencePreviewProfileResult.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudiencePreviewProfileResult value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudiencePreviewProfileResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudiencePreviewProfileResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudiencePreviewProfileResult + * @throws IOException if the JSON string is invalid with respect to + * AudiencePreviewProfileResult + */ + public static AudiencePreviewProfileResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudiencePreviewProfileResult.class); + } + + /** + * Convert an instance of AudiencePreviewProfileResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudiencePreviewResult.java b/src/main/java/com/segment/publicapi/models/AudiencePreviewResult.java new file mode 100644 index 00000000..38c3214b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudiencePreviewResult.java @@ -0,0 +1,290 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class AudiencePreviewResult extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AudiencePreviewResult.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AudiencePreviewResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudiencePreviewResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterAudiencePreviewAccountResult = + gson.getDelegateAdapter( + this, TypeToken.get(AudiencePreviewAccountResult.class)); + final TypeAdapter adapterAudiencePreviewProfileResult = + gson.getDelegateAdapter( + this, TypeToken.get(AudiencePreviewProfileResult.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudiencePreviewResult value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type + // `AudiencePreviewAccountResult` + if (value.getActualInstance() instanceof AudiencePreviewAccountResult) { + JsonElement element = + adapterAudiencePreviewAccountResult.toJsonTree( + (AudiencePreviewAccountResult) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `AudiencePreviewProfileResult` + if (value.getActualInstance() instanceof AudiencePreviewProfileResult) { + JsonElement element = + adapterAudiencePreviewProfileResult.toJsonTree( + (AudiencePreviewProfileResult) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match anyOf schemae:" + + " AudiencePreviewAccountResult," + + " AudiencePreviewProfileResult"); + } + + @Override + public AudiencePreviewResult read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize AudiencePreviewAccountResult + try { + // validate the JSON object to see if any exception is thrown + AudiencePreviewAccountResult.validateJsonElement(jsonElement); + actualAdapter = adapterAudiencePreviewAccountResult; + AudiencePreviewResult ret = new AudiencePreviewResult(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for AudiencePreviewAccountResult" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'AudiencePreviewAccountResult'", + e); + } + // deserialize AudiencePreviewProfileResult + try { + // validate the JSON object to see if any exception is thrown + AudiencePreviewProfileResult.validateJsonElement(jsonElement); + actualAdapter = adapterAudiencePreviewProfileResult; + AudiencePreviewResult ret = new AudiencePreviewResult(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for AudiencePreviewProfileResult" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'AudiencePreviewProfileResult'", + e); + } + + throw new IOException( + String.format( + "Failed deserialization for AudiencePreviewResult: no" + + " class matches result, expected at least 1." + + " Detailed failure message for anyOf schemas: %s." + + " JSON: %s", + errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public AudiencePreviewResult() { + super("anyOf", Boolean.FALSE); + } + + public AudiencePreviewResult(AudiencePreviewAccountResult o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public AudiencePreviewResult(AudiencePreviewProfileResult o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("AudiencePreviewAccountResult", AudiencePreviewAccountResult.class); + schemas.put("AudiencePreviewProfileResult", AudiencePreviewProfileResult.class); + } + + @Override + public Map> getSchemas() { + return AudiencePreviewResult.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check the instance parameter is valid + * against the anyOf child schemas: AudiencePreviewAccountResult, AudiencePreviewProfileResult + * + *

It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof AudiencePreviewAccountResult) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof AudiencePreviewProfileResult) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be AudiencePreviewAccountResult," + + " AudiencePreviewProfileResult"); + } + + /** + * Get the actual instance, which can be the following: AudiencePreviewAccountResult, + * AudiencePreviewProfileResult + * + * @return The actual instance (AudiencePreviewAccountResult, AudiencePreviewProfileResult) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AudiencePreviewAccountResult`. If the actual instance is not + * `AudiencePreviewAccountResult`, the ClassCastException will be thrown. + * + * @return The actual instance of `AudiencePreviewAccountResult` + * @throws ClassCastException if the instance is not `AudiencePreviewAccountResult` + */ + public AudiencePreviewAccountResult getAudiencePreviewAccountResult() + throws ClassCastException { + return (AudiencePreviewAccountResult) super.getActualInstance(); + } + + /** + * Get the actual instance of `AudiencePreviewProfileResult`. If the actual instance is not + * `AudiencePreviewProfileResult`, the ClassCastException will be thrown. + * + * @return The actual instance of `AudiencePreviewProfileResult` + * @throws ClassCastException if the instance is not `AudiencePreviewProfileResult` + */ + public AudiencePreviewProfileResult getAudiencePreviewProfileResult() + throws ClassCastException { + return (AudiencePreviewProfileResult) 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 AudiencePreviewResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with AudiencePreviewAccountResult + try { + AudiencePreviewAccountResult.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for AudiencePreviewAccountResult failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with AudiencePreviewProfileResult + try { + AudiencePreviewProfileResult.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for AudiencePreviewProfileResult failed with `%s`.", + e.getMessage())); + // continue to the next one + } + throw new IOException( + String.format( + "The JSON string is invalid for AudiencePreviewResult with anyOf schemas:" + + " AudiencePreviewAccountResult, AudiencePreviewProfileResult. no" + + " class match the result, expected at least 1. Detailed failure" + + " message for anyOf schemas: %s. JSON: %s", + errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of AudiencePreviewResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudiencePreviewResult + * @throws IOException if the JSON string is invalid with respect to AudiencePreviewResult + */ + public static AudiencePreviewResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudiencePreviewResult.class); + } + + /** + * Convert an instance of AudiencePreviewResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudienceSchedule.java b/src/main/java/com/segment/publicapi/models/AudienceSchedule.java new file mode 100644 index 00000000..e2430a2e --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudienceSchedule.java @@ -0,0 +1,378 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Defines an Audience Schedule. */ +public class AudienceSchedule { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + /** Strategy of the audience schedule (manual, periodic, or specific days). */ + @JsonAdapter(StrategyEnum.Adapter.class) + public enum StrategyEnum { + MANUAL("MANUAL"), + + PERIODIC("PERIODIC"), + + SPECIFIC_DAYS("SPECIFIC_DAYS"); + + private String value; + + StrategyEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StrategyEnum fromValue(String value) { + for (StrategyEnum b : StrategyEnum.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 StrategyEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StrategyEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StrategyEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STRATEGY = "strategy"; + + @SerializedName(SERIALIZED_NAME_STRATEGY) + private StrategyEnum strategy; + + public static final String SERIALIZED_NAME_CONFIG = "config"; + + @SerializedName(SERIALIZED_NAME_CONFIG) + private Config config; + + public static final String SERIALIZED_NAME_NEXT_EXECUTION = "nextExecution"; + + @SerializedName(SERIALIZED_NAME_NEXT_EXECUTION) + private String nextExecution; + + public AudienceSchedule() {} + + public AudienceSchedule id(String id) { + + this.id = id; + return this; + } + + /** + * Distinct identifier for the schedule. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AudienceSchedule strategy(StrategyEnum strategy) { + + this.strategy = strategy; + return this; + } + + /** + * Strategy of the audience schedule (manual, periodic, or specific days). + * + * @return strategy + */ + @javax.annotation.Nonnull + public StrategyEnum getStrategy() { + return strategy; + } + + public void setStrategy(StrategyEnum strategy) { + this.strategy = strategy; + } + + public AudienceSchedule config(Config config) { + + this.config = config; + return this; + } + + /** + * Get config + * + * @return config + */ + @javax.annotation.Nullable + public Config getConfig() { + return config; + } + + public void setConfig(Config config) { + this.config = config; + } + + public AudienceSchedule nextExecution(String nextExecution) { + + this.nextExecution = nextExecution; + return this; + } + + /** + * The next scheduled execution time (RFC3339). + * + * @return nextExecution + */ + @javax.annotation.Nullable + public String getNextExecution() { + return nextExecution; + } + + public void setNextExecution(String nextExecution) { + this.nextExecution = nextExecution; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AudienceSchedule audienceSchedule = (AudienceSchedule) o; + return Objects.equals(this.id, audienceSchedule.id) + && Objects.equals(this.strategy, audienceSchedule.strategy) + && Objects.equals(this.config, audienceSchedule.config) + && Objects.equals(this.nextExecution, audienceSchedule.nextExecution); + } + + 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(id, strategy, config, nextExecution); + } + + 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 AudienceSchedule {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" strategy: ").append(toIndentedString(strategy)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" nextExecution: ").append(toIndentedString(nextExecution)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("strategy"); + openapiFields.add("config"); + openapiFields.add("nextExecution"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("strategy"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AudienceSchedule + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudienceSchedule.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AudienceSchedule is not found in the" + + " empty JSON string", + AudienceSchedule.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudienceSchedule.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudienceSchedule` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AudienceSchedule.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("strategy").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `strategy` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("strategy").toString())); + } + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + Config.validateJsonElement(jsonObj.get("config")); + } + if ((jsonObj.get("nextExecution") != null && !jsonObj.get("nextExecution").isJsonNull()) + && !jsonObj.get("nextExecution").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `nextExecution` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("nextExecution").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AudienceSchedule.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudienceSchedule' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AudienceSchedule.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudienceSchedule value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudienceSchedule read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudienceSchedule given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudienceSchedule + * @throws IOException if the JSON string is invalid with respect to AudienceSchedule + */ + public static AudienceSchedule fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudienceSchedule.class); + } + + /** + * Convert an instance of AudienceSchedule to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudienceSize.java b/src/main/java/com/segment/publicapi/models/AudienceSize.java new file mode 100644 index 00000000..51d2a3af --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudienceSize.java @@ -0,0 +1,284 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** AudienceSize */ +public class AudienceSize { + public static final String SERIALIZED_NAME_COUNT = "count"; + + @SerializedName(SERIALIZED_NAME_COUNT) + private BigDecimal count; + + /** The unit type for the count(s) being returned. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACCOUNTS("ACCOUNTS"), + + USERS("USERS"); + + 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 AudienceSize() {} + + public AudienceSize count(BigDecimal count) { + + this.count = count; + return this; + } + + /** + * The total audience membership count. Refer to the type field to determine the unit for this + * field (profiles, accounts, etc). + * + * @return count + */ + @javax.annotation.Nonnull + public BigDecimal getCount() { + return count; + } + + public void setCount(BigDecimal count) { + this.count = count; + } + + public AudienceSize type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * The unit type for the count(s) being returned. + * + * @return type + */ + @javax.annotation.Nonnull + 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; + } + AudienceSize audienceSize = (AudienceSize) o; + return Objects.equals(this.count, audienceSize.count) + && Objects.equals(this.type, audienceSize.type); + } + + @Override + public int hashCode() { + return Objects.hash(count, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AudienceSize {\n"); + sb.append(" count: ").append(toIndentedString(count)).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("count"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("count"); + 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 AudienceSize + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudienceSize.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AudienceSize is not found in the empty" + + " JSON string", + AudienceSize.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudienceSize.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudienceSize` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AudienceSize.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AudienceSize.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudienceSize' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AudienceSize.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudienceSize value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudienceSize read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudienceSize given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudienceSize + * @throws IOException if the JSON string is invalid with respect to AudienceSize + */ + public static AudienceSize fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudienceSize.class); + } + + /** + * Convert an instance of AudienceSize to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudienceSummary.java b/src/main/java/com/segment/publicapi/models/AudienceSummary.java new file mode 100644 index 00000000..310b96d4 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudienceSummary.java @@ -0,0 +1,637 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Defines an Audience. */ +public class AudienceSummary { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_SPACE_ID = "spaceId"; + + @SerializedName(SERIALIZED_NAME_SPACE_ID) + private String spaceId; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_KEY = "key"; + + @SerializedName(SERIALIZED_NAME_KEY) + private String key; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + + @SerializedName(SERIALIZED_NAME_DEFINITION) + private AudienceDefinition definition; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; + + @SerializedName(SERIALIZED_NAME_CREATED_BY) + private String createdBy; + + public static final String SERIALIZED_NAME_UPDATED_BY = "updatedBy"; + + @SerializedName(SERIALIZED_NAME_UPDATED_BY) + private String updatedBy; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private String updatedAt; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + + @SerializedName(SERIALIZED_NAME_OPTIONS) + private AudienceOptions options; + + public AudienceSummary() {} + + public AudienceSummary id(String id) { + + this.id = id; + return this; + } + + /** + * Audience id. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AudienceSummary spaceId(String spaceId) { + + this.spaceId = spaceId; + return this; + } + + /** + * Space id for the audience. + * + * @return spaceId + */ + @javax.annotation.Nonnull + public String getSpaceId() { + return spaceId; + } + + public void setSpaceId(String spaceId) { + this.spaceId = spaceId; + } + + public AudienceSummary name(String name) { + + this.name = name; + return this; + } + + /** + * Name of the audience. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public AudienceSummary description(String description) { + + this.description = description; + return this; + } + + /** + * Description of the audience. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public AudienceSummary key(String key) { + + this.key = key; + return this; + } + + /** + * Key for the audience. + * + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public AudienceSummary enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Enabled/disabled status for the audience. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public AudienceSummary definition(AudienceDefinition definition) { + + this.definition = definition; + return this; + } + + /** + * Get definition + * + * @return definition + */ + @javax.annotation.Nullable + public AudienceDefinition getDefinition() { + return definition; + } + + public void setDefinition(AudienceDefinition definition) { + this.definition = definition; + } + + public AudienceSummary status(String status) { + + this.status = status; + return this; + } + + /** + * Status for the audience. Possible values: Backfilling, Computing, Failed, Live, Awaiting + * Destinations, Disabled. + * + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public AudienceSummary createdBy(String createdBy) { + + this.createdBy = createdBy; + return this; + } + + /** + * User id who created the audience. + * + * @return createdBy + */ + @javax.annotation.Nonnull + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public AudienceSummary updatedBy(String updatedBy) { + + this.updatedBy = updatedBy; + return this; + } + + /** + * User id who last updated the audience. + * + * @return updatedBy + */ + @javax.annotation.Nonnull + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public AudienceSummary createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Date the audience was created. + * + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public AudienceSummary updatedAt(String updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Date the audience was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nonnull + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + + public AudienceSummary options(AudienceOptions options) { + + this.options = options; + return this; + } + + /** + * Get options + * + * @return options + */ + @javax.annotation.Nullable + public AudienceOptions getOptions() { + return options; + } + + public void setOptions(AudienceOptions options) { + this.options = options; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AudienceSummary audienceSummary = (AudienceSummary) o; + return Objects.equals(this.id, audienceSummary.id) + && Objects.equals(this.spaceId, audienceSummary.spaceId) + && Objects.equals(this.name, audienceSummary.name) + && Objects.equals(this.description, audienceSummary.description) + && Objects.equals(this.key, audienceSummary.key) + && Objects.equals(this.enabled, audienceSummary.enabled) + && Objects.equals(this.definition, audienceSummary.definition) + && Objects.equals(this.status, audienceSummary.status) + && Objects.equals(this.createdBy, audienceSummary.createdBy) + && Objects.equals(this.updatedBy, audienceSummary.updatedBy) + && Objects.equals(this.createdAt, audienceSummary.createdAt) + && Objects.equals(this.updatedAt, audienceSummary.updatedAt) + && Objects.equals(this.options, audienceSummary.options); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + spaceId, + name, + description, + key, + enabled, + definition, + status, + createdBy, + updatedBy, + createdAt, + updatedAt, + options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AudienceSummary {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" spaceId: ").append(toIndentedString(spaceId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("spaceId"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("key"); + openapiFields.add("enabled"); + openapiFields.add("definition"); + openapiFields.add("status"); + openapiFields.add("createdBy"); + openapiFields.add("updatedBy"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("options"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("spaceId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("definition"); + openapiRequiredFields.add("createdBy"); + openapiRequiredFields.add("updatedBy"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AudienceSummary + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudienceSummary.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AudienceSummary is not found in the" + + " empty JSON string", + AudienceSummary.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudienceSummary.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudienceSummary` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AudienceSummary.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("spaceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spaceId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("spaceId").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("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("key").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `key` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("key").toString())); + } + // validate the required field `definition` + AudienceDefinition.validateJsonElement(jsonObj.get("definition")); + 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("createdBy").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdBy` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdBy").toString())); + } + if (!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())); + } + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdAt").toString())); + } + if (!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())); + } + // validate the optional field `options` + if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull()) { + AudienceOptions.validateJsonElement(jsonObj.get("options")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AudienceSummary.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AudienceSummary' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AudienceSummary.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AudienceSummary value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudienceSummary read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudienceSummary given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudienceSummary + * @throws IOException if the JSON string is invalid with respect to AudienceSummary + */ + public static AudienceSummary fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AudienceSummary.class); + } + + /** + * Convert an instance of AudienceSummary to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AudienceSummaryWithAudienceTypeAndLookback.java b/src/main/java/com/segment/publicapi/models/AudienceSummaryWithAudienceTypeAndLookback.java new file mode 100644 index 00000000..c225d085 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/AudienceSummaryWithAudienceTypeAndLookback.java @@ -0,0 +1,874 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** AudienceSummaryWithAudienceTypeAndLookback */ +public class AudienceSummaryWithAudienceTypeAndLookback { + /** Discriminator denoting the audience's product type. */ + @JsonAdapter(AudienceTypeEnum.Adapter.class) + public enum AudienceTypeEnum { + ACCOUNTS("ACCOUNTS"), + + LINKED("LINKED"), + + USERS("USERS"); + + private String value; + + AudienceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AudienceTypeEnum fromValue(String value) { + for (AudienceTypeEnum b : AudienceTypeEnum.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 AudienceTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AudienceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AudienceTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_AUDIENCE_TYPE = "audienceType"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE_TYPE) + private AudienceTypeEnum audienceType; + + public static final String SERIALIZED_NAME_COMPUTE_CADENCE = "computeCadence"; + + @SerializedName(SERIALIZED_NAME_COMPUTE_CADENCE) + private AudienceComputeCadence computeCadence; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + private AudienceSize size; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + + @SerializedName(SERIALIZED_NAME_OPTIONS) + private AudienceOptionsWithLookback options; + + public static final String SERIALIZED_NAME_SCHEDULES = "schedules"; + + @SerializedName(SERIALIZED_NAME_SCHEDULES) + private List schedules; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_SPACE_ID = "spaceId"; + + @SerializedName(SERIALIZED_NAME_SPACE_ID) + private String spaceId; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_KEY = "key"; + + @SerializedName(SERIALIZED_NAME_KEY) + private String key; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + + @SerializedName(SERIALIZED_NAME_DEFINITION) + private AudienceDefinition definition; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; + + @SerializedName(SERIALIZED_NAME_CREATED_BY) + private String createdBy; + + public static final String SERIALIZED_NAME_UPDATED_BY = "updatedBy"; + + @SerializedName(SERIALIZED_NAME_UPDATED_BY) + private String updatedBy; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private String updatedAt; + + public AudienceSummaryWithAudienceTypeAndLookback() {} + + public AudienceSummaryWithAudienceTypeAndLookback audienceType(AudienceTypeEnum audienceType) { + + this.audienceType = audienceType; + return this; + } + + /** + * Discriminator denoting the audience's product type. + * + * @return audienceType + */ + @javax.annotation.Nonnull + public AudienceTypeEnum getAudienceType() { + return audienceType; + } + + public void setAudienceType(AudienceTypeEnum audienceType) { + this.audienceType = audienceType; + } + + public AudienceSummaryWithAudienceTypeAndLookback computeCadence( + AudienceComputeCadence computeCadence) { + + this.computeCadence = computeCadence; + return this; + } + + /** + * Get computeCadence + * + * @return computeCadence + */ + @javax.annotation.Nonnull + public AudienceComputeCadence getComputeCadence() { + return computeCadence; + } + + public void setComputeCadence(AudienceComputeCadence computeCadence) { + this.computeCadence = computeCadence; + } + + public AudienceSummaryWithAudienceTypeAndLookback size(AudienceSize size) { + + this.size = size; + return this; + } + + /** + * Get size + * + * @return size + */ + @javax.annotation.Nullable + public AudienceSize getSize() { + return size; + } + + public void setSize(AudienceSize size) { + this.size = size; + } + + public AudienceSummaryWithAudienceTypeAndLookback options(AudienceOptionsWithLookback options) { + + this.options = options; + return this; + } + + /** + * Get options + * + * @return options + */ + @javax.annotation.Nullable + public AudienceOptionsWithLookback getOptions() { + return options; + } + + public void setOptions(AudienceOptionsWithLookback options) { + this.options = options; + } + + public AudienceSummaryWithAudienceTypeAndLookback schedules(List schedules) { + + this.schedules = schedules; + return this; + } + + public AudienceSummaryWithAudienceTypeAndLookback addSchedulesItem( + AudienceSchedule schedulesItem) { + if (this.schedules == null) { + this.schedules = new ArrayList<>(); + } + this.schedules.add(schedulesItem); + return this; + } + + /** + * List of schedules for the audience. + * + * @return schedules + */ + @javax.annotation.Nullable + public List getSchedules() { + return schedules; + } + + public void setSchedules(List schedules) { + this.schedules = schedules; + } + + public AudienceSummaryWithAudienceTypeAndLookback id(String id) { + + this.id = id; + return this; + } + + /** + * Audience id. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AudienceSummaryWithAudienceTypeAndLookback spaceId(String spaceId) { + + this.spaceId = spaceId; + return this; + } + + /** + * Space id for the audience. + * + * @return spaceId + */ + @javax.annotation.Nonnull + public String getSpaceId() { + return spaceId; + } + + public void setSpaceId(String spaceId) { + this.spaceId = spaceId; + } + + public AudienceSummaryWithAudienceTypeAndLookback name(String name) { + + this.name = name; + return this; + } + + /** + * Name of the audience. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public AudienceSummaryWithAudienceTypeAndLookback description(String description) { + + this.description = description; + return this; + } + + /** + * Description of the audience. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public AudienceSummaryWithAudienceTypeAndLookback key(String key) { + + this.key = key; + return this; + } + + /** + * Key for the audience. + * + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public AudienceSummaryWithAudienceTypeAndLookback enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Enabled/disabled status for the audience. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public AudienceSummaryWithAudienceTypeAndLookback definition(AudienceDefinition definition) { + + this.definition = definition; + return this; + } + + /** + * Get definition + * + * @return definition + */ + @javax.annotation.Nullable + public AudienceDefinition getDefinition() { + return definition; + } + + public void setDefinition(AudienceDefinition definition) { + this.definition = definition; + } + + public AudienceSummaryWithAudienceTypeAndLookback status(String status) { + + this.status = status; + return this; + } + + /** + * Status for the audience. Possible values: Backfilling, Computing, Failed, Live, Awaiting + * Destinations, Disabled. + * + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public AudienceSummaryWithAudienceTypeAndLookback createdBy(String createdBy) { + + this.createdBy = createdBy; + return this; + } + + /** + * User id who created the audience. + * + * @return createdBy + */ + @javax.annotation.Nonnull + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public AudienceSummaryWithAudienceTypeAndLookback updatedBy(String updatedBy) { + + this.updatedBy = updatedBy; + return this; + } + + /** + * User id who last updated the audience. + * + * @return updatedBy + */ + @javax.annotation.Nonnull + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public AudienceSummaryWithAudienceTypeAndLookback createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Date the audience was created. + * + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public AudienceSummaryWithAudienceTypeAndLookback updatedAt(String updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Date the audience was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nonnull + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AudienceSummaryWithAudienceTypeAndLookback audienceSummaryWithAudienceTypeAndLookback = + (AudienceSummaryWithAudienceTypeAndLookback) o; + return Objects.equals( + this.audienceType, audienceSummaryWithAudienceTypeAndLookback.audienceType) + && Objects.equals( + this.computeCadence, + audienceSummaryWithAudienceTypeAndLookback.computeCadence) + && Objects.equals(this.size, audienceSummaryWithAudienceTypeAndLookback.size) + && Objects.equals(this.options, audienceSummaryWithAudienceTypeAndLookback.options) + && Objects.equals( + this.schedules, audienceSummaryWithAudienceTypeAndLookback.schedules) + && Objects.equals(this.id, audienceSummaryWithAudienceTypeAndLookback.id) + && Objects.equals(this.spaceId, audienceSummaryWithAudienceTypeAndLookback.spaceId) + && Objects.equals(this.name, audienceSummaryWithAudienceTypeAndLookback.name) + && Objects.equals( + this.description, audienceSummaryWithAudienceTypeAndLookback.description) + && Objects.equals(this.key, audienceSummaryWithAudienceTypeAndLookback.key) + && Objects.equals(this.enabled, audienceSummaryWithAudienceTypeAndLookback.enabled) + && Objects.equals( + this.definition, audienceSummaryWithAudienceTypeAndLookback.definition) + && Objects.equals(this.status, audienceSummaryWithAudienceTypeAndLookback.status) + && Objects.equals( + this.createdBy, audienceSummaryWithAudienceTypeAndLookback.createdBy) + && Objects.equals( + this.updatedBy, audienceSummaryWithAudienceTypeAndLookback.updatedBy) + && Objects.equals( + this.createdAt, audienceSummaryWithAudienceTypeAndLookback.createdAt) + && Objects.equals( + this.updatedAt, audienceSummaryWithAudienceTypeAndLookback.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash( + audienceType, + computeCadence, + size, + options, + schedules, + id, + spaceId, + name, + description, + key, + enabled, + definition, + status, + createdBy, + updatedBy, + createdAt, + updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AudienceSummaryWithAudienceTypeAndLookback {\n"); + sb.append(" audienceType: ").append(toIndentedString(audienceType)).append("\n"); + sb.append(" computeCadence: ").append(toIndentedString(computeCadence)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append(" schedules: ").append(toIndentedString(schedules)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" spaceId: ").append(toIndentedString(spaceId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).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("audienceType"); + openapiFields.add("computeCadence"); + openapiFields.add("size"); + openapiFields.add("options"); + openapiFields.add("schedules"); + openapiFields.add("id"); + openapiFields.add("spaceId"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("key"); + openapiFields.add("enabled"); + openapiFields.add("definition"); + openapiFields.add("status"); + openapiFields.add("createdBy"); + openapiFields.add("updatedBy"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("audienceType"); + openapiRequiredFields.add("computeCadence"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("spaceId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("definition"); + openapiRequiredFields.add("createdBy"); + openapiRequiredFields.add("updatedBy"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * AudienceSummaryWithAudienceTypeAndLookback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AudienceSummaryWithAudienceTypeAndLookback.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " AudienceSummaryWithAudienceTypeAndLookback is not found in" + + " the empty JSON string", + AudienceSummaryWithAudienceTypeAndLookback.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AudienceSummaryWithAudienceTypeAndLookback.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AudienceSummaryWithAudienceTypeAndLookback` properties." + + " JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + AudienceSummaryWithAudienceTypeAndLookback.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("audienceType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `audienceType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("audienceType").toString())); + } + // validate the required field `computeCadence` + AudienceComputeCadence.validateJsonElement(jsonObj.get("computeCadence")); + // validate the optional field `size` + if (jsonObj.get("size") != null && !jsonObj.get("size").isJsonNull()) { + AudienceSize.validateJsonElement(jsonObj.get("size")); + } + // validate the optional field `options` + if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull()) { + AudienceOptionsWithLookback.validateJsonElement(jsonObj.get("options")); + } + if (jsonObj.get("schedules") != null && !jsonObj.get("schedules").isJsonNull()) { + JsonArray jsonArrayschedules = jsonObj.getAsJsonArray("schedules"); + if (jsonArrayschedules != null) { + // ensure the json data is an array + if (!jsonObj.get("schedules").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `schedules` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("schedules").toString())); + } + + // validate the optional field `schedules` (array) + for (int i = 0; i < jsonArrayschedules.size(); i++) { + AudienceSchedule.validateJsonElement(jsonArrayschedules.get(i)); + } + ; + } + } + 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("spaceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spaceId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("spaceId").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("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("key").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `key` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("key").toString())); + } + // validate the required field `definition` + AudienceDefinition.validateJsonElement(jsonObj.get("definition")); + 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("createdBy").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdBy` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdBy").toString())); + } + if (!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())); + } + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdAt").toString())); + } + if (!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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AudienceSummaryWithAudienceTypeAndLookback.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'AudienceSummaryWithAudienceTypeAndLookback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AudienceSummaryWithAudienceTypeAndLookback.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, AudienceSummaryWithAudienceTypeAndLookback value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AudienceSummaryWithAudienceTypeAndLookback read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of AudienceSummaryWithAudienceTypeAndLookback given an JSON string + * + * @param jsonString JSON string + * @return An instance of AudienceSummaryWithAudienceTypeAndLookback + * @throws IOException if the JSON string is invalid with respect to + * AudienceSummaryWithAudienceTypeAndLookback + */ + public static AudienceSummaryWithAudienceTypeAndLookback fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, AudienceSummaryWithAudienceTypeAndLookback.class); + } + + /** + * Convert an instance of AudienceSummaryWithAudienceTypeAndLookback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/AuditEventV1.java b/src/main/java/com/segment/publicapi/models/AuditEventV1.java index 16edb041..fa32cba4 100644 --- a/src/main/java/com/segment/publicapi/models/AuditEventV1.java +++ b/src/main/java/com/segment/publicapi/models/AuditEventV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,412 +9,451 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Represents an Audit Trail event. */ +public class AuditEventV1 { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * Represents an Audit Trail event. - */ -@ApiModel(description = "Represents an Audit Trail event.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class AuditEventV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + private String timestamp; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ACTOR = "actor"; + + @SerializedName(SERIALIZED_NAME_ACTOR) + private String actor; + + public static final String SERIALIZED_NAME_ACTOR_EMAIL = "actorEmail"; + + @SerializedName(SERIALIZED_NAME_ACTOR_EMAIL) + private String actorEmail; + + public static final String SERIALIZED_NAME_RESOURCE_ID = "resourceId"; + + @SerializedName(SERIALIZED_NAME_RESOURCE_ID) + private String resourceId; + + public static final String SERIALIZED_NAME_RESOURCE_TYPE = "resourceType"; + + @SerializedName(SERIALIZED_NAME_RESOURCE_TYPE) + private String resourceType; + + public static final String SERIALIZED_NAME_RESOURCE_NAME = "resourceName"; + + @SerializedName(SERIALIZED_NAME_RESOURCE_NAME) + private String resourceName; + + public AuditEventV1() {} + + public AuditEventV1 id(String id) { + + this.id = id; + return this; + } + + /** + * Unique identifier for this audit trail event. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AuditEventV1 timestamp(String timestamp) { + + this.timestamp = timestamp; + return this; + } + + /** + * The timestamp of this event in ISO-8601 format. + * + * @return timestamp + */ + @javax.annotation.Nonnull + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } - public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; - @SerializedName(SERIALIZED_NAME_TIMESTAMP) - private String timestamp; + public AuditEventV1 type(String type) { - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - private String type; - - public static final String SERIALIZED_NAME_ACTOR = "actor"; - @SerializedName(SERIALIZED_NAME_ACTOR) - private String actor; - - public static final String SERIALIZED_NAME_RESOURCE_ID = "resourceId"; - @SerializedName(SERIALIZED_NAME_RESOURCE_ID) - private String resourceId; + this.type = type; + return this; + } - public static final String SERIALIZED_NAME_RESOURCE_TYPE = "resourceType"; - @SerializedName(SERIALIZED_NAME_RESOURCE_TYPE) - private String resourceType; + /** + * The type of this event. + * + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } - public static final String SERIALIZED_NAME_RESOURCE_NAME = "resourceName"; - @SerializedName(SERIALIZED_NAME_RESOURCE_NAME) - private String resourceName; + public void setType(String type) { + this.type = type; + } - public AuditEventV1() { - } + public AuditEventV1 actor(String actor) { - public AuditEventV1 id(String id) { - - this.id = id; - return this; - } + this.actor = actor; + return this; + } - /** - * Unique identifier for this audit trail event. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Unique identifier for this audit trail event.") + /** + * The user or API token that triggered this event. + * + * @return actor + */ + @javax.annotation.Nonnull + public String getActor() { + return actor; + } - public String getId() { - return id; - } + public void setActor(String actor) { + this.actor = actor; + } + public AuditEventV1 actorEmail(String actorEmail) { - public void setId(String id) { - this.id = id; - } + this.actorEmail = actorEmail; + return this; + } + /** + * The email of the user that triggered this event. + * + * @return actorEmail + */ + @javax.annotation.Nullable + public String getActorEmail() { + return actorEmail; + } - public AuditEventV1 timestamp(String timestamp) { - - this.timestamp = timestamp; - return this; - } + public void setActorEmail(String actorEmail) { + this.actorEmail = actorEmail; + } - /** - * The timestamp of this event in ISO-8601 format. - * @return timestamp - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The timestamp of this event in ISO-8601 format.") + public AuditEventV1 resourceId(String resourceId) { - public String getTimestamp() { - return timestamp; - } + this.resourceId = resourceId; + return this; + } + /** + * The identifier of the resource affected by this event. + * + * @return resourceId + */ + @javax.annotation.Nonnull + public String getResourceId() { + return resourceId; + } - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + public AuditEventV1 resourceType(String resourceType) { - public AuditEventV1 type(String type) { - - this.type = type; - return this; - } + this.resourceType = resourceType; + return this; + } - /** - * The type of this event. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type of this event.") + /** + * The kind of resource affected by this event. + * + * @return resourceType + */ + @javax.annotation.Nonnull + public String getResourceType() { + return resourceType; + } - public String getType() { - return type; - } + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + public AuditEventV1 resourceName(String resourceName) { - public void setType(String type) { - this.type = type; - } + this.resourceName = resourceName; + return this; + } + /** + * The name of the resource affected by this event. + * + * @return resourceName + */ + @javax.annotation.Nonnull + public String getResourceName() { + return resourceName; + } - public AuditEventV1 actor(String actor) { - - this.actor = actor; - return this; - } + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } - /** - * The user or API token that triggered this event. - * @return actor - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The user or API token that triggered this event.") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuditEventV1 auditEventV1 = (AuditEventV1) o; + return Objects.equals(this.id, auditEventV1.id) + && Objects.equals(this.timestamp, auditEventV1.timestamp) + && Objects.equals(this.type, auditEventV1.type) + && Objects.equals(this.actor, auditEventV1.actor) + && Objects.equals(this.actorEmail, auditEventV1.actorEmail) + && Objects.equals(this.resourceId, auditEventV1.resourceId) + && Objects.equals(this.resourceType, auditEventV1.resourceType) + && Objects.equals(this.resourceName, auditEventV1.resourceName); + } - public String getActor() { - return actor; - } + @Override + public int hashCode() { + return Objects.hash( + id, timestamp, type, actor, actorEmail, resourceId, resourceType, resourceName); + } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuditEventV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" actor: ").append(toIndentedString(actor)).append("\n"); + sb.append(" actorEmail: ").append(toIndentedString(actorEmail)).append("\n"); + sb.append(" resourceId: ").append(toIndentedString(resourceId)).append("\n"); + sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); + sb.append(" resourceName: ").append(toIndentedString(resourceName)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public void setActor(String actor) { - this.actor = actor; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("timestamp"); + openapiFields.add("type"); + openapiFields.add("actor"); + openapiFields.add("actorEmail"); + openapiFields.add("resourceId"); + openapiFields.add("resourceType"); + openapiFields.add("resourceName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("timestamp"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("actor"); + openapiRequiredFields.add("resourceId"); + openapiRequiredFields.add("resourceType"); + openapiRequiredFields.add("resourceName"); + } - public AuditEventV1 resourceId(String resourceId) { - - this.resourceId = resourceId; - return this; - } - - /** - * The identifier of the resource affected by this event. - * @return resourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The identifier of the resource affected by this event.") - - public String getResourceId() { - return resourceId; - } - - - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuditEventV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuditEventV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in AuditEventV1 is not found in the empty" + + " JSON string", + AuditEventV1.openapiRequiredFields.toString())); + } + } - public AuditEventV1 resourceType(String resourceType) { - - this.resourceType = resourceType; - return this; - } - - /** - * The kind of resource affected by this event. - * @return resourceType - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The kind of resource affected by this event.") - - public String getResourceType() { - return resourceType; - } - - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - - public AuditEventV1 resourceName(String resourceName) { - - this.resourceName = resourceName; - return this; - } - - /** - * The name of the resource affected by this event. - * @return resourceName - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the resource affected by this event.") - - public String getResourceName() { - return resourceName; - } - - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AuditEventV1 auditEventV1 = (AuditEventV1) o; - return Objects.equals(this.id, auditEventV1.id) && - Objects.equals(this.timestamp, auditEventV1.timestamp) && - Objects.equals(this.type, auditEventV1.type) && - Objects.equals(this.actor, auditEventV1.actor) && - Objects.equals(this.resourceId, auditEventV1.resourceId) && - Objects.equals(this.resourceType, auditEventV1.resourceType) && - Objects.equals(this.resourceName, auditEventV1.resourceName); - } - - @Override - public int hashCode() { - return Objects.hash(id, timestamp, type, actor, resourceId, resourceType, resourceName); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AuditEventV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" actor: ").append(toIndentedString(actor)).append("\n"); - sb.append(" resourceId: ").append(toIndentedString(resourceId)).append("\n"); - sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); - sb.append(" resourceName: ").append(toIndentedString(resourceName)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("timestamp"); - openapiFields.add("type"); - openapiFields.add("actor"); - openapiFields.add("resourceId"); - openapiFields.add("resourceType"); - openapiFields.add("resourceName"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("timestamp"); - openapiRequiredFields.add("type"); - openapiRequiredFields.add("actor"); - openapiRequiredFields.add("resourceId"); - openapiRequiredFields.add("resourceType"); - openapiRequiredFields.add("resourceName"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to AuditEventV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!AuditEventV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in AuditEventV1 is not found in the empty JSON string", AuditEventV1.openapiRequiredFields.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuditEventV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `AuditEventV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!AuditEventV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuditEventV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuditEventV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("timestamp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `timestamp` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("timestamp").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("actor").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `actor` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("actor").toString())); + } + if ((jsonObj.get("actorEmail") != null && !jsonObj.get("actorEmail").isJsonNull()) + && !jsonObj.get("actorEmail").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `actorEmail` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("actorEmail").toString())); } - } + if (!jsonObj.get("resourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `resourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("resourceId").toString())); + } + if (!jsonObj.get("resourceType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `resourceType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("resourceType").toString())); + } + if (!jsonObj.get("resourceName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `resourceName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("resourceName").toString())); + } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AuditEventV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuditEventV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuditEventV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AuditEventV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AuditEventV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuditEventV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("timestamp").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `timestamp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timestamp").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("actor").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `actor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actor").toString())); - } - if (!jsonObj.get("resourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `resourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resourceId").toString())); - } - if (!jsonObj.get("resourceType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `resourceType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resourceType").toString())); - } - if (!jsonObj.get("resourceName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `resourceName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resourceName").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AuditEventV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AuditEventV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AuditEventV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AuditEventV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AuditEventV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of AuditEventV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of AuditEventV1 - * @throws IOException if the JSON string is invalid with respect to AuditEventV1 - */ - public static AuditEventV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AuditEventV1.class); - } - - /** - * Convert an instance of AuditEventV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + } + + /** + * Create an instance of AuditEventV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuditEventV1 + * @throws IOException if the JSON string is invalid with respect to AuditEventV1 + */ + public static AuditEventV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuditEventV1.class); + } + /** + * Convert an instance of AuditEventV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/BatchQueryMessagingSubscriptionsForSpace200Response.java b/src/main/java/com/segment/publicapi/models/BatchQueryMessagingSubscriptionsForSpace200Response.java index 85e5b6f3..2e768a1b 100644 --- a/src/main/java/com/segment/publicapi/models/BatchQueryMessagingSubscriptionsForSpace200Response.java +++ b/src/main/java/com/segment/publicapi/models/BatchQueryMessagingSubscriptionsForSpace200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,208 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.BatchQueryMessagingSubscriptionsForSpaceAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * BatchQueryMessagingSubscriptionsForSpace200Response - */ - +/** BatchQueryMessagingSubscriptionsForSpace200Response */ public class BatchQueryMessagingSubscriptionsForSpace200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private BatchQueryMessagingSubscriptionsForSpaceAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public BatchQueryMessagingSubscriptionsForSpace200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private BatchQueryMessagingSubscriptionsForSpaceAlphaOutput data; - public BatchQueryMessagingSubscriptionsForSpace200Response data(BatchQueryMessagingSubscriptionsForSpaceAlphaOutput data) { - - this.data = data; - return this; - } + public BatchQueryMessagingSubscriptionsForSpace200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public BatchQueryMessagingSubscriptionsForSpace200Response data( + BatchQueryMessagingSubscriptionsForSpaceAlphaOutput data) { - public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput getData() { + return data; + } - public void setData(BatchQueryMessagingSubscriptionsForSpaceAlphaOutput data) { - this.data = data; - } + public void setData(BatchQueryMessagingSubscriptionsForSpaceAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BatchQueryMessagingSubscriptionsForSpace200Response + batchQueryMessagingSubscriptionsForSpace200Response = + (BatchQueryMessagingSubscriptionsForSpace200Response) o; + return Objects.equals(this.data, batchQueryMessagingSubscriptionsForSpace200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchQueryMessagingSubscriptionsForSpace200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - BatchQueryMessagingSubscriptionsForSpace200Response batchQueryMessagingSubscriptionsForSpace200Response = (BatchQueryMessagingSubscriptionsForSpace200Response) o; - return Objects.equals(this.data, batchQueryMessagingSubscriptionsForSpace200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BatchQueryMessagingSubscriptionsForSpace200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to BatchQueryMessagingSubscriptionsForSpace200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!BatchQueryMessagingSubscriptionsForSpace200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in BatchQueryMessagingSubscriptionsForSpace200Response is not found in the empty JSON string", BatchQueryMessagingSubscriptionsForSpace200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BatchQueryMessagingSubscriptionsForSpace200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BatchQueryMessagingSubscriptionsForSpace200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " BatchQueryMessagingSubscriptionsForSpace200Response is not" + + " found in the empty JSON string", + BatchQueryMessagingSubscriptionsForSpace200Response + .openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!BatchQueryMessagingSubscriptionsForSpace200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BatchQueryMessagingSubscriptionsForSpace200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BatchQueryMessagingSubscriptionsForSpace200Response.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `BatchQueryMessagingSubscriptionsForSpace200Response`" + + " 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()) { + BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.validateJsonElement( + jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!BatchQueryMessagingSubscriptionsForSpace200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BatchQueryMessagingSubscriptionsForSpace200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BatchQueryMessagingSubscriptionsForSpace200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, BatchQueryMessagingSubscriptionsForSpace200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public BatchQueryMessagingSubscriptionsForSpace200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchQueryMessagingSubscriptionsForSpace200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'BatchQueryMessagingSubscriptionsForSpace200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + BatchQueryMessagingSubscriptionsForSpace200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + BatchQueryMessagingSubscriptionsForSpace200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BatchQueryMessagingSubscriptionsForSpace200Response read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BatchQueryMessagingSubscriptionsForSpace200Response given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of BatchQueryMessagingSubscriptionsForSpace200Response + * @throws IOException if the JSON string is invalid with respect to + * BatchQueryMessagingSubscriptionsForSpace200Response + */ + public static BatchQueryMessagingSubscriptionsForSpace200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, BatchQueryMessagingSubscriptionsForSpace200Response.class); } - } - - /** - * Create an instance of BatchQueryMessagingSubscriptionsForSpace200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of BatchQueryMessagingSubscriptionsForSpace200Response - * @throws IOException if the JSON string is invalid with respect to BatchQueryMessagingSubscriptionsForSpace200Response - */ - public static BatchQueryMessagingSubscriptionsForSpace200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BatchQueryMessagingSubscriptionsForSpace200Response.class); - } - - /** - * Convert an instance of BatchQueryMessagingSubscriptionsForSpace200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of BatchQueryMessagingSubscriptionsForSpace200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/BatchQueryMessagingSubscriptionsForSpaceAlphaInput.java b/src/main/java/com/segment/publicapi/models/BatchQueryMessagingSubscriptionsForSpaceAlphaInput.java index 2fe8625e..fbbbbdd6 100644 --- a/src/main/java/com/segment/publicapi/models/BatchQueryMessagingSubscriptionsForSpaceAlphaInput.java +++ b/src/main/java/com/segment/publicapi/models/BatchQueryMessagingSubscriptionsForSpaceAlphaInput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,219 +9,243 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetSubscriptionRequest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Batch get request. - */ -@ApiModel(description = "Batch get request.") - +/** Batch get request. */ public class BatchQueryMessagingSubscriptionsForSpaceAlphaInput { - public static final String SERIALIZED_NAME_SUBSCRIPTIONS = "subscriptions"; - @SerializedName(SERIALIZED_NAME_SUBSCRIPTIONS) - private List subscriptions = new ArrayList<>(); + public static final String SERIALIZED_NAME_SUBSCRIPTIONS = "subscriptions"; - public BatchQueryMessagingSubscriptionsForSpaceAlphaInput() { - } + @SerializedName(SERIALIZED_NAME_SUBSCRIPTIONS) + private List subscriptions = new ArrayList<>(); - public BatchQueryMessagingSubscriptionsForSpaceAlphaInput subscriptions(List subscriptions) { - - this.subscriptions = subscriptions; - return this; - } + public BatchQueryMessagingSubscriptionsForSpaceAlphaInput() {} - public BatchQueryMessagingSubscriptionsForSpaceAlphaInput addSubscriptionsItem(GetSubscriptionRequest subscriptionsItem) { - this.subscriptions.add(subscriptionsItem); - return this; - } + public BatchQueryMessagingSubscriptionsForSpaceAlphaInput subscriptions( + List subscriptions) { - /** - * A list of subscriptions to retrieve subscription status. - * @return subscriptions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of subscriptions to retrieve subscription status.") + this.subscriptions = subscriptions; + return this; + } - public List getSubscriptions() { - return subscriptions; - } + public BatchQueryMessagingSubscriptionsForSpaceAlphaInput addSubscriptionsItem( + GetSubscriptionRequest subscriptionsItem) { + if (this.subscriptions == null) { + this.subscriptions = new ArrayList<>(); + } + this.subscriptions.add(subscriptionsItem); + return this; + } + /** + * A list of subscriptions to retrieve subscription status. + * + * @return subscriptions + */ + @javax.annotation.Nonnull + public List getSubscriptions() { + return subscriptions; + } - public void setSubscriptions(List subscriptions) { - this.subscriptions = subscriptions; - } + public void setSubscriptions(List subscriptions) { + this.subscriptions = subscriptions; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BatchQueryMessagingSubscriptionsForSpaceAlphaInput + batchQueryMessagingSubscriptionsForSpaceAlphaInput = + (BatchQueryMessagingSubscriptionsForSpaceAlphaInput) o; + return Objects.equals( + this.subscriptions, + batchQueryMessagingSubscriptionsForSpaceAlphaInput.subscriptions); + } + @Override + public int hashCode() { + return Objects.hash(subscriptions); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchQueryMessagingSubscriptionsForSpaceAlphaInput {\n"); + sb.append(" subscriptions: ").append(toIndentedString(subscriptions)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - BatchQueryMessagingSubscriptionsForSpaceAlphaInput batchQueryMessagingSubscriptionsForSpaceAlphaInput = (BatchQueryMessagingSubscriptionsForSpaceAlphaInput) o; - return Objects.equals(this.subscriptions, batchQueryMessagingSubscriptionsForSpaceAlphaInput.subscriptions); - } - - @Override - public int hashCode() { - return Objects.hash(subscriptions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BatchQueryMessagingSubscriptionsForSpaceAlphaInput {\n"); - sb.append(" subscriptions: ").append(toIndentedString(subscriptions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("subscriptions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("subscriptions"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("subscriptions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("subscriptions"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to BatchQueryMessagingSubscriptionsForSpaceAlphaInput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!BatchQueryMessagingSubscriptionsForSpaceAlphaInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in BatchQueryMessagingSubscriptionsForSpaceAlphaInput is not found in the empty JSON string", BatchQueryMessagingSubscriptionsForSpaceAlphaInput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BatchQueryMessagingSubscriptionsForSpaceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BatchQueryMessagingSubscriptionsForSpaceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " BatchQueryMessagingSubscriptionsForSpaceAlphaInput is not" + + " found in the empty JSON string", + BatchQueryMessagingSubscriptionsForSpaceAlphaInput + .openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!BatchQueryMessagingSubscriptionsForSpaceAlphaInput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BatchQueryMessagingSubscriptionsForSpaceAlphaInput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BatchQueryMessagingSubscriptionsForSpaceAlphaInput.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `BatchQueryMessagingSubscriptionsForSpaceAlphaInput`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : BatchQueryMessagingSubscriptionsForSpaceAlphaInput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + BatchQueryMessagingSubscriptionsForSpaceAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("subscriptions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `subscriptions` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("subscriptions").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("subscriptions").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `subscriptions` to be an array in the JSON string but got `%s`", jsonObj.get("subscriptions").toString())); - } - JsonArray jsonArraysubscriptions = jsonObj.getAsJsonArray("subscriptions"); - } + JsonArray jsonArraysubscriptions = jsonObj.getAsJsonArray("subscriptions"); + // validate the required field `subscriptions` (array) + for (int i = 0; i < jsonArraysubscriptions.size(); i++) { + GetSubscriptionRequest.validateJsonElement(jsonArraysubscriptions.get(i)); + } + ; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!BatchQueryMessagingSubscriptionsForSpaceAlphaInput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BatchQueryMessagingSubscriptionsForSpaceAlphaInput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BatchQueryMessagingSubscriptionsForSpaceAlphaInput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, BatchQueryMessagingSubscriptionsForSpaceAlphaInput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public BatchQueryMessagingSubscriptionsForSpaceAlphaInput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchQueryMessagingSubscriptionsForSpaceAlphaInput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'BatchQueryMessagingSubscriptionsForSpaceAlphaInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + BatchQueryMessagingSubscriptionsForSpaceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + BatchQueryMessagingSubscriptionsForSpaceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BatchQueryMessagingSubscriptionsForSpaceAlphaInput read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BatchQueryMessagingSubscriptionsForSpaceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of BatchQueryMessagingSubscriptionsForSpaceAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * BatchQueryMessagingSubscriptionsForSpaceAlphaInput + */ + public static BatchQueryMessagingSubscriptionsForSpaceAlphaInput fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, BatchQueryMessagingSubscriptionsForSpaceAlphaInput.class); } - } - - /** - * Create an instance of BatchQueryMessagingSubscriptionsForSpaceAlphaInput given an JSON string - * - * @param jsonString JSON string - * @return An instance of BatchQueryMessagingSubscriptionsForSpaceAlphaInput - * @throws IOException if the JSON string is invalid with respect to BatchQueryMessagingSubscriptionsForSpaceAlphaInput - */ - public static BatchQueryMessagingSubscriptionsForSpaceAlphaInput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BatchQueryMessagingSubscriptionsForSpaceAlphaInput.class); - } - - /** - * Convert an instance of BatchQueryMessagingSubscriptionsForSpaceAlphaInput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of BatchQueryMessagingSubscriptionsForSpaceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.java index 02b4b234..43bfebe2 100644 --- a/src/main/java/com/segment/publicapi/models/BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,336 +9,389 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetMessagingSubscriptionFailureResponse; -import com.segment.publicapi.models.GetMessagingSubscriptionSuccessResponse; -import com.segment.publicapi.models.MessageSubscriptionResponseError; -import com.segment.publicapi.models.Pagination; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Batch get response. - */ -@ApiModel(description = "Batch get response.") - +/** Batch get response. */ public class BatchQueryMessagingSubscriptionsForSpaceAlphaOutput { - public static final String SERIALIZED_NAME_SUCCESSES = "successes"; - @SerializedName(SERIALIZED_NAME_SUCCESSES) - private List successes = new ArrayList<>(); + public static final String SERIALIZED_NAME_SUCCESSES = "successes"; - public static final String SERIALIZED_NAME_FAILURES = "failures"; - @SerializedName(SERIALIZED_NAME_FAILURES) - private List failures = new ArrayList<>(); - - public static final String SERIALIZED_NAME_ERRORS = "errors"; - @SerializedName(SERIALIZED_NAME_ERRORS) - private List errors = new ArrayList<>(); - - public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - @SerializedName(SERIALIZED_NAME_PAGINATION) - private Pagination pagination; - - public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput() { - } - - public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput successes(List successes) { - - this.successes = successes; - return this; - } + @SerializedName(SERIALIZED_NAME_SUCCESSES) + private List successes = new ArrayList<>(); - public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput addSuccessesItem(GetMessagingSubscriptionSuccessResponse successesItem) { - this.successes.add(successesItem); - return this; - } + public static final String SERIALIZED_NAME_FAILURES = "failures"; - /** - * Array of successful subscription status. - * @return successes - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Array of successful subscription status.") + @SerializedName(SERIALIZED_NAME_FAILURES) + private List failures = new ArrayList<>(); - public List getSuccesses() { - return successes; - } + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + private List errors = new ArrayList<>(); - public void setSuccesses(List successes) { - this.successes = successes; - } + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; + @SerializedName(SERIALIZED_NAME_PAGINATION) + private PaginationOutput pagination; - public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput failures(List failures) { - - this.failures = failures; - return this; - } + public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput() {} - public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput addFailuresItem(GetMessagingSubscriptionFailureResponse failuresItem) { - this.failures.add(failuresItem); - return this; - } + public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput successes( + List successes) { - /** - * Validation errors due to invalid types or email/phone numbers. - * @return failures - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Validation errors due to invalid types or email/phone numbers.") + this.successes = successes; + return this; + } + + public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput addSuccessesItem( + GetMessagingSubscriptionSuccessResponse successesItem) { + if (this.successes == null) { + this.successes = new ArrayList<>(); + } + this.successes.add(successesItem); + return this; + } - public List getFailures() { - return failures; - } + /** + * Array of successful subscription status. + * + * @return successes + */ + @javax.annotation.Nonnull + public List getSuccesses() { + return successes; + } + public void setSuccesses(List successes) { + this.successes = successes; + } - public void setFailures(List failures) { - this.failures = failures; - } + public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput failures( + List failures) { + this.failures = failures; + return this; + } - public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput errors(List errors) { - - this.errors = errors; - return this; - } + public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput addFailuresItem( + GetMessagingSubscriptionFailureResponse failuresItem) { + if (this.failures == null) { + this.failures = new ArrayList<>(); + } + this.failures.add(failuresItem); + return this; + } - public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput addErrorsItem(MessageSubscriptionResponseError errorsItem) { - this.errors.add(errorsItem); - return this; - } + /** + * Validation errors due to invalid types or email/phone numbers. + * + * @return failures + */ + @javax.annotation.Nonnull + public List getFailures() { + return failures; + } - /** - * General errors when making the request such as invalid payload or wrong http method errors. - * @return errors - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "General errors when making the request such as invalid payload or wrong http method errors.") + public void setFailures(List failures) { + this.failures = failures; + } - public List getErrors() { - return errors; - } + public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput errors( + List errors) { + this.errors = errors; + return this; + } - public void setErrors(List errors) { - this.errors = errors; - } + public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput addErrorsItem( + MessageSubscriptionResponseError errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + /** + * General errors when making the request such as invalid payload or wrong http method errors. + * + * @return errors + */ + @javax.annotation.Nonnull + public List getErrors() { + return errors; + } - public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput pagination(Pagination pagination) { - - this.pagination = pagination; - return this; - } + public void setErrors(List errors) { + this.errors = errors; + } - /** - * Get pagination - * @return pagination - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput pagination( + PaginationOutput pagination) { - public Pagination getPagination() { - return pagination; - } + this.pagination = pagination; + return this; + } + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nullable + public PaginationOutput getPagination() { + return pagination; + } - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } + public void setPagination(PaginationOutput pagination) { + this.pagination = pagination; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BatchQueryMessagingSubscriptionsForSpaceAlphaOutput + batchQueryMessagingSubscriptionsForSpaceAlphaOutput = + (BatchQueryMessagingSubscriptionsForSpaceAlphaOutput) o; + return Objects.equals( + this.successes, + batchQueryMessagingSubscriptionsForSpaceAlphaOutput.successes) + && Objects.equals( + this.failures, batchQueryMessagingSubscriptionsForSpaceAlphaOutput.failures) + && Objects.equals( + this.errors, batchQueryMessagingSubscriptionsForSpaceAlphaOutput.errors) + && Objects.equals( + this.pagination, + batchQueryMessagingSubscriptionsForSpaceAlphaOutput.pagination); + } + @Override + public int hashCode() { + return Objects.hash(successes, failures, errors, pagination); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchQueryMessagingSubscriptionsForSpaceAlphaOutput {\n"); + sb.append(" successes: ").append(toIndentedString(successes)).append("\n"); + sb.append(" failures: ").append(toIndentedString(failures)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - BatchQueryMessagingSubscriptionsForSpaceAlphaOutput batchQueryMessagingSubscriptionsForSpaceAlphaOutput = (BatchQueryMessagingSubscriptionsForSpaceAlphaOutput) o; - return Objects.equals(this.successes, batchQueryMessagingSubscriptionsForSpaceAlphaOutput.successes) && - Objects.equals(this.failures, batchQueryMessagingSubscriptionsForSpaceAlphaOutput.failures) && - Objects.equals(this.errors, batchQueryMessagingSubscriptionsForSpaceAlphaOutput.errors) && - Objects.equals(this.pagination, batchQueryMessagingSubscriptionsForSpaceAlphaOutput.pagination); - } - - @Override - public int hashCode() { - return Objects.hash(successes, failures, errors, pagination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BatchQueryMessagingSubscriptionsForSpaceAlphaOutput {\n"); - sb.append(" successes: ").append(toIndentedString(successes)).append("\n"); - sb.append(" failures: ").append(toIndentedString(failures)).append("\n"); - sb.append(" errors: ").append(toIndentedString(errors)).append("\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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("successes"); + openapiFields.add("failures"); + openapiFields.add("errors"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("successes"); + openapiRequiredFields.add("failures"); + openapiRequiredFields.add("errors"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("successes"); - openapiFields.add("failures"); - openapiFields.add("errors"); - openapiFields.add("pagination"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("successes"); - openapiRequiredFields.add("failures"); - openapiRequiredFields.add("errors"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to BatchQueryMessagingSubscriptionsForSpaceAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in BatchQueryMessagingSubscriptionsForSpaceAlphaOutput is not found in the empty JSON string", BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * BatchQueryMessagingSubscriptionsForSpaceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " BatchQueryMessagingSubscriptionsForSpaceAlphaOutput is not" + + " found in the empty JSON string", + BatchQueryMessagingSubscriptionsForSpaceAlphaOutput + .openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BatchQueryMessagingSubscriptionsForSpaceAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `BatchQueryMessagingSubscriptionsForSpaceAlphaOutput`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("successes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `successes` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("successes").toString())); + } + + JsonArray jsonArraysuccesses = jsonObj.getAsJsonArray("successes"); + // validate the required field `successes` (array) + for (int i = 0; i < jsonArraysuccesses.size(); i++) { + GetMessagingSubscriptionSuccessResponse.validateJsonElement(jsonArraysuccesses.get(i)); + } + ; + // ensure the json data is an array + if (!jsonObj.get("failures").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `failures` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("failures").toString())); + } + + JsonArray jsonArrayfailures = jsonObj.getAsJsonArray("failures"); + // validate the required field `failures` (array) + for (int i = 0; i < jsonArrayfailures.size(); i++) { + GetMessagingSubscriptionFailureResponse.validateJsonElement(jsonArrayfailures.get(i)); + } + ; + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errors` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("errors").toString())); + } + + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + // validate the required field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + MessageSubscriptionResponseError.validateJsonElement(jsonArrayerrors.get(i)); + } + ; + // validate the optional field `pagination` + if (jsonObj.get("pagination") != null && !jsonObj.get("pagination").isJsonNull()) { + PaginationOutput.validateJsonElement(jsonObj.get("pagination")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'BatchQueryMessagingSubscriptionsForSpaceAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + BatchQueryMessagingSubscriptionsForSpaceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - // ensure the json data is an array - if (!jsonObj.get("successes").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `successes` to be an array in the JSON string but got `%s`", jsonObj.get("successes").toString())); - } - - JsonArray jsonArraysuccesses = jsonObj.getAsJsonArray("successes"); - // ensure the json data is an array - if (!jsonObj.get("failures").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `failures` to be an array in the JSON string but got `%s`", jsonObj.get("failures").toString())); - } - - JsonArray jsonArrayfailures = jsonObj.getAsJsonArray("failures"); - // ensure the json data is an array - if (!jsonObj.get("errors").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); - } - - JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BatchQueryMessagingSubscriptionsForSpaceAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, BatchQueryMessagingSubscriptionsForSpaceAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public BatchQueryMessagingSubscriptionsForSpaceAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of BatchQueryMessagingSubscriptionsForSpaceAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of BatchQueryMessagingSubscriptionsForSpaceAlphaOutput - * @throws IOException if the JSON string is invalid with respect to BatchQueryMessagingSubscriptionsForSpaceAlphaOutput - */ - public static BatchQueryMessagingSubscriptionsForSpaceAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.class); - } - - /** - * Convert an instance of BatchQueryMessagingSubscriptionsForSpaceAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of BatchQueryMessagingSubscriptionsForSpaceAlphaOutput given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of BatchQueryMessagingSubscriptionsForSpaceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * BatchQueryMessagingSubscriptionsForSpaceAlphaOutput + */ + public static BatchQueryMessagingSubscriptionsForSpaceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, BatchQueryMessagingSubscriptionsForSpaceAlphaOutput.class); + } + + /** + * Convert an instance of BatchQueryMessagingSubscriptionsForSpaceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/BreakdownBeta.java b/src/main/java/com/segment/publicapi/models/BreakdownBeta.java index 222f51f3..f281e03d 100644 --- a/src/main/java/com/segment/publicapi/models/BreakdownBeta.java +++ b/src/main/java/com/segment/publicapi/models/BreakdownBeta.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,240 +9,228 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The breakdown of a metric. - */ -@ApiModel(description = "The breakdown of a metric.") - +/** The breakdown of a metric. */ public class BreakdownBeta { - public static final String SERIALIZED_NAME_METRIC_NAME = "metricName"; - @SerializedName(SERIALIZED_NAME_METRIC_NAME) - private String metricName; - - public static final String SERIALIZED_NAME_VALUE = "value"; - @SerializedName(SERIALIZED_NAME_VALUE) - private BigDecimal value; + public static final String SERIALIZED_NAME_METRIC_NAME = "metricName"; - public BreakdownBeta() { - } + @SerializedName(SERIALIZED_NAME_METRIC_NAME) + private String metricName; - public BreakdownBeta metricName(String metricName) { - - this.metricName = metricName; - return this; - } + public static final String SERIALIZED_NAME_VALUE = "value"; - /** - * The name of the metric. - * @return metricName - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the metric.") + @SerializedName(SERIALIZED_NAME_VALUE) + private BigDecimal value; - public String getMetricName() { - return metricName; - } + public BreakdownBeta() {} + public BreakdownBeta metricName(String metricName) { - public void setMetricName(String metricName) { - this.metricName = metricName; - } + this.metricName = metricName; + return this; + } + /** + * The name of the metric. + * + * @return metricName + */ + @javax.annotation.Nonnull + public String getMetricName() { + return metricName; + } - public BreakdownBeta value(BigDecimal value) { - - this.value = value; - return this; - } + public void setMetricName(String metricName) { + this.metricName = metricName; + } - /** - * Number of occurrences of the metric. - * @return value - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Number of occurrences of the metric.") + public BreakdownBeta value(BigDecimal value) { - public BigDecimal getValue() { - return value; - } + this.value = value; + return this; + } + /** + * Number of occurrences of the metric. + * + * @return value + */ + @javax.annotation.Nonnull + public BigDecimal getValue() { + return value; + } - public void setValue(BigDecimal value) { - this.value = value; - } + public void setValue(BigDecimal value) { + this.value = value; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BreakdownBeta breakdownBeta = (BreakdownBeta) o; + return Objects.equals(this.metricName, breakdownBeta.metricName) + && Objects.equals(this.value, breakdownBeta.value); + } + @Override + public int hashCode() { + return Objects.hash(metricName, value); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BreakdownBeta {\n"); + sb.append(" metricName: ").append(toIndentedString(metricName)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - BreakdownBeta breakdownBeta = (BreakdownBeta) o; - return Objects.equals(this.metricName, breakdownBeta.metricName) && - Objects.equals(this.value, breakdownBeta.value); - } - - @Override - public int hashCode() { - return Objects.hash(metricName, value); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BreakdownBeta {\n"); - sb.append(" metricName: ").append(toIndentedString(metricName)).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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("metricName"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("metricName"); + openapiRequiredFields.add("value"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("metricName"); - openapiFields.add("value"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("metricName"); - openapiRequiredFields.add("value"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to BreakdownBeta - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!BreakdownBeta.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in BreakdownBeta is not found in the empty JSON string", BreakdownBeta.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BreakdownBeta + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BreakdownBeta.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in BreakdownBeta is not found in the" + + " empty JSON string", + BreakdownBeta.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!BreakdownBeta.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BreakdownBeta` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BreakdownBeta.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `BreakdownBeta` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : BreakdownBeta.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BreakdownBeta.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("metricName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `metricName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("metricName").toString())); } - } - if (!jsonObj.get("metricName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `metricName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metricName").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!BreakdownBeta.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BreakdownBeta' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BreakdownBeta.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, BreakdownBeta value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public BreakdownBeta read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of BreakdownBeta given an JSON string - * - * @param jsonString JSON string - * @return An instance of BreakdownBeta - * @throws IOException if the JSON string is invalid with respect to BreakdownBeta - */ - public static BreakdownBeta fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BreakdownBeta.class); - } - - /** - * Convert an instance of BreakdownBeta to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BreakdownBeta.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BreakdownBeta' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BreakdownBeta.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BreakdownBeta value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BreakdownBeta read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of BreakdownBeta given an JSON string + * + * @param jsonString JSON string + * @return An instance of BreakdownBeta + * @throws IOException if the JSON string is invalid with respect to BreakdownBeta + */ + public static BreakdownBeta fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BreakdownBeta.class); + } + + /** + * Convert an instance of BreakdownBeta to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CancelReverseETLSyncForModel200Response.java b/src/main/java/com/segment/publicapi/models/CancelReverseETLSyncForModel200Response.java new file mode 100644 index 00000000..0bcd926f --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CancelReverseETLSyncForModel200Response.java @@ -0,0 +1,205 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CancelReverseETLSyncForModel200Response */ +public class CancelReverseETLSyncForModel200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CancelReverseETLSyncForModelOutput data; + + public CancelReverseETLSyncForModel200Response() {} + + public CancelReverseETLSyncForModel200Response data(CancelReverseETLSyncForModelOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CancelReverseETLSyncForModelOutput getData() { + return data; + } + + public void setData(CancelReverseETLSyncForModelOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CancelReverseETLSyncForModel200Response cancelReverseETLSyncForModel200Response = + (CancelReverseETLSyncForModel200Response) o; + return Objects.equals(this.data, cancelReverseETLSyncForModel200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CancelReverseETLSyncForModel200Response {\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 + * CancelReverseETLSyncForModel200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CancelReverseETLSyncForModel200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " CancelReverseETLSyncForModel200Response is not found in the" + + " empty JSON string", + CancelReverseETLSyncForModel200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CancelReverseETLSyncForModel200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CancelReverseETLSyncForModel200Response` 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()) { + CancelReverseETLSyncForModelOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CancelReverseETLSyncForModel200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'CancelReverseETLSyncForModel200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CancelReverseETLSyncForModel200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CancelReverseETLSyncForModel200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CancelReverseETLSyncForModel200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CancelReverseETLSyncForModel200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CancelReverseETLSyncForModel200Response + * @throws IOException if the JSON string is invalid with respect to + * CancelReverseETLSyncForModel200Response + */ + public static CancelReverseETLSyncForModel200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CancelReverseETLSyncForModel200Response.class); + } + + /** + * Convert an instance of CancelReverseETLSyncForModel200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CancelReverseETLSyncForModelInput.java b/src/main/java/com/segment/publicapi/models/CancelReverseETLSyncForModelInput.java new file mode 100644 index 00000000..72500575 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CancelReverseETLSyncForModelInput.java @@ -0,0 +1,201 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Defines the parameters needed to cancel a sync for a RETL connection. */ +public class CancelReverseETLSyncForModelInput { + public static final String SERIALIZED_NAME_REASON_FOR_CANCELING = "reasonForCanceling"; + + @SerializedName(SERIALIZED_NAME_REASON_FOR_CANCELING) + private BigDecimal reasonForCanceling; + + public CancelReverseETLSyncForModelInput() {} + + public CancelReverseETLSyncForModelInput reasonForCanceling(BigDecimal reasonForCanceling) { + + this.reasonForCanceling = reasonForCanceling; + return this; + } + + /** + * The reason for canceling the sync. - IncorrectModel = 0 - IncorrectDest = 1 - + * IncorrectKeys = 2 - IncorrectMapping = 3 - Other = 4 + * + * @return reasonForCanceling + */ + @javax.annotation.Nullable + public BigDecimal getReasonForCanceling() { + return reasonForCanceling; + } + + public void setReasonForCanceling(BigDecimal reasonForCanceling) { + this.reasonForCanceling = reasonForCanceling; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CancelReverseETLSyncForModelInput cancelReverseETLSyncForModelInput = + (CancelReverseETLSyncForModelInput) o; + return Objects.equals( + this.reasonForCanceling, cancelReverseETLSyncForModelInput.reasonForCanceling); + } + + @Override + public int hashCode() { + return Objects.hash(reasonForCanceling); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CancelReverseETLSyncForModelInput {\n"); + sb.append(" reasonForCanceling: ") + .append(toIndentedString(reasonForCanceling)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reasonForCanceling"); + + // 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 + * CancelReverseETLSyncForModelInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CancelReverseETLSyncForModelInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CancelReverseETLSyncForModelInput is" + + " not found in the empty JSON string", + CancelReverseETLSyncForModelInput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CancelReverseETLSyncForModelInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CancelReverseETLSyncForModelInput` 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 (!CancelReverseETLSyncForModelInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CancelReverseETLSyncForModelInput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CancelReverseETLSyncForModelInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CancelReverseETLSyncForModelInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CancelReverseETLSyncForModelInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CancelReverseETLSyncForModelInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CancelReverseETLSyncForModelInput + * @throws IOException if the JSON string is invalid with respect to + * CancelReverseETLSyncForModelInput + */ + public static CancelReverseETLSyncForModelInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CancelReverseETLSyncForModelInput.class); + } + + /** + * Convert an instance of CancelReverseETLSyncForModelInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CancelReverseETLSyncForModelOutput.java b/src/main/java/com/segment/publicapi/models/CancelReverseETLSyncForModelOutput.java new file mode 100644 index 00000000..161f07cb --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CancelReverseETLSyncForModelOutput.java @@ -0,0 +1,365 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * CancelReverseETLSyncForModelOutput either will return an error or a \"CANCELLING\" + * status. + */ +public class CancelReverseETLSyncForModelOutput { + public static final String SERIALIZED_NAME_MODEL_ID = "modelId"; + + @SerializedName(SERIALIZED_NAME_MODEL_ID) + private String modelId; + + public static final String SERIALIZED_NAME_SYNC_ID = "syncId"; + + @SerializedName(SERIALIZED_NAME_SYNC_ID) + private String syncId; + + public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; + + @SerializedName(SERIALIZED_NAME_ERROR_CODE) + private String errorCode; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + private String errorMessage; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public CancelReverseETLSyncForModelOutput() {} + + public CancelReverseETLSyncForModelOutput modelId(String modelId) { + + this.modelId = modelId; + return this; + } + + /** + * The id of the Model. + * + * @return modelId + */ + @javax.annotation.Nonnull + public String getModelId() { + return modelId; + } + + public void setModelId(String modelId) { + this.modelId = modelId; + } + + public CancelReverseETLSyncForModelOutput syncId(String syncId) { + + this.syncId = syncId; + return this; + } + + /** + * The id of the Sync. + * + * @return syncId + */ + @javax.annotation.Nonnull + public String getSyncId() { + return syncId; + } + + public void setSyncId(String syncId) { + this.syncId = syncId; + } + + public CancelReverseETLSyncForModelOutput errorCode(String errorCode) { + + this.errorCode = errorCode; + return this; + } + + /** + * A place holder for a machine-friendly category for an error, if applicable. - + * \"SyncAlreadyCanceled\" - \"SyncFinishedCannotCancel\" + * + * @return errorCode + */ + @javax.annotation.Nullable + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public CancelReverseETLSyncForModelOutput errorMessage(String errorMessage) { + + this.errorMessage = errorMessage; + return this; + } + + /** + * A place holder for a human-readable description of the error, if applicable. - \"sync + * already canceled\" - \"sync already finished\". + * + * @return errorMessage + */ + @javax.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public CancelReverseETLSyncForModelOutput status(String status) { + + this.status = status; + return this; + } + + /** + * If no error, status will be CANCELLING, as the extract/load might take some time to cancel. + * + * @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; + } + CancelReverseETLSyncForModelOutput cancelReverseETLSyncForModelOutput = + (CancelReverseETLSyncForModelOutput) o; + return Objects.equals(this.modelId, cancelReverseETLSyncForModelOutput.modelId) + && Objects.equals(this.syncId, cancelReverseETLSyncForModelOutput.syncId) + && Objects.equals(this.errorCode, cancelReverseETLSyncForModelOutput.errorCode) + && Objects.equals( + this.errorMessage, cancelReverseETLSyncForModelOutput.errorMessage) + && Objects.equals(this.status, cancelReverseETLSyncForModelOutput.status); + } + + @Override + public int hashCode() { + return Objects.hash(modelId, syncId, errorCode, errorMessage, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CancelReverseETLSyncForModelOutput {\n"); + sb.append(" modelId: ").append(toIndentedString(modelId)).append("\n"); + sb.append(" syncId: ").append(toIndentedString(syncId)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).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("modelId"); + openapiFields.add("syncId"); + openapiFields.add("errorCode"); + openapiFields.add("errorMessage"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("modelId"); + openapiRequiredFields.add("syncId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CancelReverseETLSyncForModelOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CancelReverseETLSyncForModelOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CancelReverseETLSyncForModelOutput is" + + " not found in the empty JSON string", + CancelReverseETLSyncForModelOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CancelReverseETLSyncForModelOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CancelReverseETLSyncForModelOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CancelReverseETLSyncForModelOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("modelId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `modelId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("modelId").toString())); + } + if (!jsonObj.get("syncId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `syncId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("syncId").toString())); + } + if ((jsonObj.get("errorCode") != null && !jsonObj.get("errorCode").isJsonNull()) + && !jsonObj.get("errorCode").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorCode` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorCode").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorMessage` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorMessage").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 (!CancelReverseETLSyncForModelOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CancelReverseETLSyncForModelOutput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CancelReverseETLSyncForModelOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CancelReverseETLSyncForModelOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CancelReverseETLSyncForModelOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CancelReverseETLSyncForModelOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CancelReverseETLSyncForModelOutput + * @throws IOException if the JSON string is invalid with respect to + * CancelReverseETLSyncForModelOutput + */ + public static CancelReverseETLSyncForModelOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CancelReverseETLSyncForModelOutput.class); + } + + /** + * Convert an instance of CancelReverseETLSyncForModelOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CommonSourceSettingsV1.java b/src/main/java/com/segment/publicapi/models/CommonSourceSettingsV1.java index 15ee36ef..11899966 100644 --- a/src/main/java/com/segment/publicapi/models/CommonSourceSettingsV1.java +++ b/src/main/java/com/segment/publicapi/models/CommonSourceSettingsV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,325 +9,332 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Group; -import com.segment.publicapi.models.Identify; -import com.segment.publicapi.models.Track; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** CommonSourceSettingsV1 */ +public class CommonSourceSettingsV1 { + public static final String SERIALIZED_NAME_TRACK = "track"; -/** - * CommonSourceSettingsV1 - */ + @SerializedName(SERIALIZED_NAME_TRACK) + private TrackSourceSettingsV1 track; -public class CommonSourceSettingsV1 { - public static final String SERIALIZED_NAME_TRACK = "track"; - @SerializedName(SERIALIZED_NAME_TRACK) - private Track track; - - public static final String SERIALIZED_NAME_IDENTIFY = "identify"; - @SerializedName(SERIALIZED_NAME_IDENTIFY) - private Identify identify; - - public static final String SERIALIZED_NAME_GROUP = "group"; - @SerializedName(SERIALIZED_NAME_GROUP) - private Group group; + public static final String SERIALIZED_NAME_IDENTIFY = "identify"; - public static final String SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO = "forwardingViolationsTo"; - @SerializedName(SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO) - private String forwardingViolationsTo; + @SerializedName(SERIALIZED_NAME_IDENTIFY) + private IdentifySourceSettingsV1 identify; - public static final String SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO = "forwardingBlockedEventsTo"; - @SerializedName(SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO) - private String forwardingBlockedEventsTo; + public static final String SERIALIZED_NAME_GROUP = "group"; - public CommonSourceSettingsV1() { - } + @SerializedName(SERIALIZED_NAME_GROUP) + private GroupSourceSettingsV1 group; - public CommonSourceSettingsV1 track(Track track) { - - this.track = track; - return this; - } + public static final String SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO = "forwardingViolationsTo"; - /** - * Get track - * @return track - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + @SerializedName(SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO) + private String forwardingViolationsTo; - public Track getTrack() { - return track; - } + public static final String SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO = + "forwardingBlockedEventsTo"; + @SerializedName(SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO) + private String forwardingBlockedEventsTo; - public void setTrack(Track track) { - this.track = track; - } + public CommonSourceSettingsV1() {} + public CommonSourceSettingsV1 track(TrackSourceSettingsV1 track) { - public CommonSourceSettingsV1 identify(Identify identify) { - - this.identify = identify; - return this; - } + this.track = track; + return this; + } - /** - * Get identify - * @return identify - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + /** + * Get track + * + * @return track + */ + @javax.annotation.Nullable + public TrackSourceSettingsV1 getTrack() { + return track; + } - public Identify getIdentify() { - return identify; - } + public void setTrack(TrackSourceSettingsV1 track) { + this.track = track; + } + public CommonSourceSettingsV1 identify(IdentifySourceSettingsV1 identify) { - public void setIdentify(Identify identify) { - this.identify = identify; - } + this.identify = identify; + return this; + } + /** + * Get identify + * + * @return identify + */ + @javax.annotation.Nullable + public IdentifySourceSettingsV1 getIdentify() { + return identify; + } + + public void setIdentify(IdentifySourceSettingsV1 identify) { + this.identify = identify; + } - public CommonSourceSettingsV1 group(Group group) { - - this.group = group; - return this; - } + public CommonSourceSettingsV1 group(GroupSourceSettingsV1 group) { - /** - * Get group - * @return group - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + this.group = group; + return this; + } - public Group getGroup() { - return group; - } + /** + * Get group + * + * @return group + */ + @javax.annotation.Nullable + public GroupSourceSettingsV1 getGroup() { + return group; + } + + public void setGroup(GroupSourceSettingsV1 group) { + this.group = group; + } + public CommonSourceSettingsV1 forwardingViolationsTo(String forwardingViolationsTo) { - public void setGroup(Group group) { - this.group = group; - } + this.forwardingViolationsTo = forwardingViolationsTo; + return this; + } + /** + * SourceId to forward violations to. + * + * @return forwardingViolationsTo + */ + @javax.annotation.Nullable + public String getForwardingViolationsTo() { + return forwardingViolationsTo; + } - public CommonSourceSettingsV1 forwardingViolationsTo(String forwardingViolationsTo) { - - this.forwardingViolationsTo = forwardingViolationsTo; - return this; - } + public void setForwardingViolationsTo(String forwardingViolationsTo) { + this.forwardingViolationsTo = forwardingViolationsTo; + } - /** - * SourceId to forward violations to. - * @return forwardingViolationsTo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "SourceId to forward violations to.") + public CommonSourceSettingsV1 forwardingBlockedEventsTo(String forwardingBlockedEventsTo) { - public String getForwardingViolationsTo() { - return forwardingViolationsTo; - } + this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; + return this; + } + /** + * SourceId to forward blocked events to. + * + * @return forwardingBlockedEventsTo + */ + @javax.annotation.Nullable + public String getForwardingBlockedEventsTo() { + return forwardingBlockedEventsTo; + } - public void setForwardingViolationsTo(String forwardingViolationsTo) { - this.forwardingViolationsTo = forwardingViolationsTo; - } + public void setForwardingBlockedEventsTo(String forwardingBlockedEventsTo) { + this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CommonSourceSettingsV1 commonSourceSettingsV1 = (CommonSourceSettingsV1) o; + return Objects.equals(this.track, commonSourceSettingsV1.track) + && Objects.equals(this.identify, commonSourceSettingsV1.identify) + && Objects.equals(this.group, commonSourceSettingsV1.group) + && Objects.equals( + this.forwardingViolationsTo, commonSourceSettingsV1.forwardingViolationsTo) + && Objects.equals( + this.forwardingBlockedEventsTo, + commonSourceSettingsV1.forwardingBlockedEventsTo); + } - public CommonSourceSettingsV1 forwardingBlockedEventsTo(String forwardingBlockedEventsTo) { - - this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; - return this; - } + @Override + public int hashCode() { + return Objects.hash( + track, identify, group, forwardingViolationsTo, forwardingBlockedEventsTo); + } - /** - * SourceId to forward blocked events to. - * @return forwardingBlockedEventsTo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "SourceId to forward blocked events to.") + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CommonSourceSettingsV1 {\n"); + sb.append(" track: ").append(toIndentedString(track)).append("\n"); + sb.append(" identify: ").append(toIndentedString(identify)).append("\n"); + sb.append(" group: ").append(toIndentedString(group)).append("\n"); + sb.append(" forwardingViolationsTo: ") + .append(toIndentedString(forwardingViolationsTo)) + .append("\n"); + sb.append(" forwardingBlockedEventsTo: ") + .append(toIndentedString(forwardingBlockedEventsTo)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } - public String getForwardingBlockedEventsTo() { - return forwardingBlockedEventsTo; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public void setForwardingBlockedEventsTo(String forwardingBlockedEventsTo) { - this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("track"); + openapiFields.add("identify"); + openapiFields.add("group"); + openapiFields.add("forwardingViolationsTo"); + openapiFields.add("forwardingBlockedEventsTo"); + // 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 CommonSourceSettingsV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CommonSourceSettingsV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CommonSourceSettingsV1 is not found in" + + " the empty JSON string", + CommonSourceSettingsV1.openapiRequiredFields.toString())); + } + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CommonSourceSettingsV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CommonSourceSettingsV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `track` + if (jsonObj.get("track") != null && !jsonObj.get("track").isJsonNull()) { + TrackSourceSettingsV1.validateJsonElement(jsonObj.get("track")); + } + // validate the optional field `identify` + if (jsonObj.get("identify") != null && !jsonObj.get("identify").isJsonNull()) { + IdentifySourceSettingsV1.validateJsonElement(jsonObj.get("identify")); + } + // validate the optional field `group` + if (jsonObj.get("group") != null && !jsonObj.get("group").isJsonNull()) { + GroupSourceSettingsV1.validateJsonElement(jsonObj.get("group")); + } + if ((jsonObj.get("forwardingViolationsTo") != null + && !jsonObj.get("forwardingViolationsTo").isJsonNull()) + && !jsonObj.get("forwardingViolationsTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `forwardingViolationsTo` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("forwardingViolationsTo").toString())); + } + if ((jsonObj.get("forwardingBlockedEventsTo") != null + && !jsonObj.get("forwardingBlockedEventsTo").isJsonNull()) + && !jsonObj.get("forwardingBlockedEventsTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `forwardingBlockedEventsTo` to be a primitive type" + + " in the JSON string but got `%s`", + jsonObj.get("forwardingBlockedEventsTo").toString())); + } } - if (o == null || getClass() != o.getClass()) { - return false; + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CommonSourceSettingsV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CommonSourceSettingsV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CommonSourceSettingsV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CommonSourceSettingsV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CommonSourceSettingsV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } } - CommonSourceSettingsV1 commonSourceSettingsV1 = (CommonSourceSettingsV1) o; - return Objects.equals(this.track, commonSourceSettingsV1.track) && - Objects.equals(this.identify, commonSourceSettingsV1.identify) && - Objects.equals(this.group, commonSourceSettingsV1.group) && - Objects.equals(this.forwardingViolationsTo, commonSourceSettingsV1.forwardingViolationsTo) && - Objects.equals(this.forwardingBlockedEventsTo, commonSourceSettingsV1.forwardingBlockedEventsTo); - } - - @Override - public int hashCode() { - return Objects.hash(track, identify, group, forwardingViolationsTo, forwardingBlockedEventsTo); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CommonSourceSettingsV1 {\n"); - sb.append(" track: ").append(toIndentedString(track)).append("\n"); - sb.append(" identify: ").append(toIndentedString(identify)).append("\n"); - sb.append(" group: ").append(toIndentedString(group)).append("\n"); - sb.append(" forwardingViolationsTo: ").append(toIndentedString(forwardingViolationsTo)).append("\n"); - sb.append(" forwardingBlockedEventsTo: ").append(toIndentedString(forwardingBlockedEventsTo)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + /** + * Create an instance of CommonSourceSettingsV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of CommonSourceSettingsV1 + * @throws IOException if the JSON string is invalid with respect to CommonSourceSettingsV1 + */ + public static CommonSourceSettingsV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CommonSourceSettingsV1.class); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("track"); - openapiFields.add("identify"); - openapiFields.add("group"); - openapiFields.add("forwardingViolationsTo"); - openapiFields.add("forwardingBlockedEventsTo"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CommonSourceSettingsV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CommonSourceSettingsV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CommonSourceSettingsV1 is not found in the empty JSON string", CommonSourceSettingsV1.openapiRequiredFields.toString())); - } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CommonSourceSettingsV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CommonSourceSettingsV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - if ((jsonObj.get("forwardingViolationsTo") != null && !jsonObj.get("forwardingViolationsTo").isJsonNull()) && !jsonObj.get("forwardingViolationsTo").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `forwardingViolationsTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("forwardingViolationsTo").toString())); - } - if ((jsonObj.get("forwardingBlockedEventsTo") != null && !jsonObj.get("forwardingBlockedEventsTo").isJsonNull()) && !jsonObj.get("forwardingBlockedEventsTo").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `forwardingBlockedEventsTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("forwardingBlockedEventsTo").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CommonSourceSettingsV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CommonSourceSettingsV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CommonSourceSettingsV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CommonSourceSettingsV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CommonSourceSettingsV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + /** + * Convert an instance of CommonSourceSettingsV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); } - } - - /** - * Create an instance of CommonSourceSettingsV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of CommonSourceSettingsV1 - * @throws IOException if the JSON string is invalid with respect to CommonSourceSettingsV1 - */ - public static CommonSourceSettingsV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CommonSourceSettingsV1.class); - } - - /** - * Convert an instance of CommonSourceSettingsV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } } - diff --git a/src/main/java/com/segment/publicapi/models/ComputedTraitSummary.java b/src/main/java/com/segment/publicapi/models/ComputedTraitSummary.java new file mode 100644 index 00000000..a7e67bca --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/ComputedTraitSummary.java @@ -0,0 +1,637 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Defines a Computed trait. */ +public class ComputedTraitSummary { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_SPACE_ID = "spaceId"; + + @SerializedName(SERIALIZED_NAME_SPACE_ID) + private String spaceId; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_KEY = "key"; + + @SerializedName(SERIALIZED_NAME_KEY) + private String key; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + + @SerializedName(SERIALIZED_NAME_DEFINITION) + private ComputedTraitsDefinition definition; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; + + @SerializedName(SERIALIZED_NAME_CREATED_BY) + private String createdBy; + + public static final String SERIALIZED_NAME_UPDATED_BY = "updatedBy"; + + @SerializedName(SERIALIZED_NAME_UPDATED_BY) + private String updatedBy; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private String updatedAt; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + + @SerializedName(SERIALIZED_NAME_OPTIONS) + private TraitOptions options; + + public ComputedTraitSummary() {} + + public ComputedTraitSummary id(String id) { + + this.id = id; + return this; + } + + /** + * Computed trait id. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ComputedTraitSummary spaceId(String spaceId) { + + this.spaceId = spaceId; + return this; + } + + /** + * Space id for the computed trait. + * + * @return spaceId + */ + @javax.annotation.Nonnull + public String getSpaceId() { + return spaceId; + } + + public void setSpaceId(String spaceId) { + this.spaceId = spaceId; + } + + public ComputedTraitSummary name(String name) { + + this.name = name; + return this; + } + + /** + * Name of the computed trait. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ComputedTraitSummary description(String description) { + + this.description = description; + return this; + } + + /** + * Description of the computed trait. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ComputedTraitSummary key(String key) { + + this.key = key; + return this; + } + + /** + * Key for the computed trait. + * + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public ComputedTraitSummary enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Enabled/disabled status for the computed trait. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public ComputedTraitSummary definition(ComputedTraitsDefinition definition) { + + this.definition = definition; + return this; + } + + /** + * Get definition + * + * @return definition + */ + @javax.annotation.Nullable + public ComputedTraitsDefinition getDefinition() { + return definition; + } + + public void setDefinition(ComputedTraitsDefinition definition) { + this.definition = definition; + } + + public ComputedTraitSummary status(String status) { + + this.status = status; + return this; + } + + /** + * Status for the computed trait. Possible values: Backfilling, Computing, Failed, Live, + * Awaiting Destinations, Disabled. + * + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public ComputedTraitSummary createdBy(String createdBy) { + + this.createdBy = createdBy; + return this; + } + + /** + * User id who created the computed trait. + * + * @return createdBy + */ + @javax.annotation.Nonnull + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public ComputedTraitSummary updatedBy(String updatedBy) { + + this.updatedBy = updatedBy; + return this; + } + + /** + * User id who last updated the computed trait. + * + * @return updatedBy + */ + @javax.annotation.Nonnull + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public ComputedTraitSummary createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp of the computed trait's creation. + * + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public ComputedTraitSummary updatedAt(String updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp of the computed trait's last change. + * + * @return updatedAt + */ + @javax.annotation.Nonnull + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + + public ComputedTraitSummary options(TraitOptions options) { + + this.options = options; + return this; + } + + /** + * Get options + * + * @return options + */ + @javax.annotation.Nullable + public TraitOptions getOptions() { + return options; + } + + public void setOptions(TraitOptions options) { + this.options = options; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ComputedTraitSummary computedTraitSummary = (ComputedTraitSummary) o; + return Objects.equals(this.id, computedTraitSummary.id) + && Objects.equals(this.spaceId, computedTraitSummary.spaceId) + && Objects.equals(this.name, computedTraitSummary.name) + && Objects.equals(this.description, computedTraitSummary.description) + && Objects.equals(this.key, computedTraitSummary.key) + && Objects.equals(this.enabled, computedTraitSummary.enabled) + && Objects.equals(this.definition, computedTraitSummary.definition) + && Objects.equals(this.status, computedTraitSummary.status) + && Objects.equals(this.createdBy, computedTraitSummary.createdBy) + && Objects.equals(this.updatedBy, computedTraitSummary.updatedBy) + && Objects.equals(this.createdAt, computedTraitSummary.createdAt) + && Objects.equals(this.updatedAt, computedTraitSummary.updatedAt) + && Objects.equals(this.options, computedTraitSummary.options); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + spaceId, + name, + description, + key, + enabled, + definition, + status, + createdBy, + updatedBy, + createdAt, + updatedAt, + options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ComputedTraitSummary {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" spaceId: ").append(toIndentedString(spaceId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("spaceId"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("key"); + openapiFields.add("enabled"); + openapiFields.add("definition"); + openapiFields.add("status"); + openapiFields.add("createdBy"); + openapiFields.add("updatedBy"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("options"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("spaceId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("definition"); + openapiRequiredFields.add("createdBy"); + openapiRequiredFields.add("updatedBy"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ComputedTraitSummary + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ComputedTraitSummary.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ComputedTraitSummary is not found in" + + " the empty JSON string", + ComputedTraitSummary.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ComputedTraitSummary.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ComputedTraitSummary` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ComputedTraitSummary.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("spaceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spaceId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("spaceId").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("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("key").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `key` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("key").toString())); + } + // validate the required field `definition` + ComputedTraitsDefinition.validateJsonElement(jsonObj.get("definition")); + 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("createdBy").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdBy` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdBy").toString())); + } + if (!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())); + } + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdAt").toString())); + } + if (!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())); + } + // validate the optional field `options` + if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull()) { + TraitOptions.validateJsonElement(jsonObj.get("options")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ComputedTraitSummary.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ComputedTraitSummary' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ComputedTraitSummary.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ComputedTraitSummary value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ComputedTraitSummary read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ComputedTraitSummary given an JSON string + * + * @param jsonString JSON string + * @return An instance of ComputedTraitSummary + * @throws IOException if the JSON string is invalid with respect to ComputedTraitSummary + */ + public static ComputedTraitSummary fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ComputedTraitSummary.class); + } + + /** + * Convert an instance of ComputedTraitSummary to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/ComputedTraitsDefinition.java b/src/main/java/com/segment/publicapi/models/ComputedTraitsDefinition.java new file mode 100644 index 00000000..6dc76f80 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/ComputedTraitsDefinition.java @@ -0,0 +1,297 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Defines an computed trait definition. */ +public class ComputedTraitsDefinition { + public static final String SERIALIZED_NAME_QUERY = "query"; + + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + + /** + * The underlying data type being aggregated for this computed trait. Possible values: users, + * accounts. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACCOUNTS("ACCOUNTS"), + + USERS("USERS"); + + 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 ComputedTraitsDefinition() {} + + public ComputedTraitsDefinition query(String query) { + + this.query = query; + return this; + } + + /** + * The query language string defining the computed trait aggregation criteria. For guidance on + * using the query language, see the [Segment documentation + * site](https://segment.com/docs/api/public-api/query-language). + * + * @return query + */ + @javax.annotation.Nonnull + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public ComputedTraitsDefinition type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * The underlying data type being aggregated for this computed trait. Possible values: users, + * accounts. + * + * @return type + */ + @javax.annotation.Nonnull + 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; + } + ComputedTraitsDefinition computedTraitsDefinition = (ComputedTraitsDefinition) o; + return Objects.equals(this.query, computedTraitsDefinition.query) + && Objects.equals(this.type, computedTraitsDefinition.type); + } + + @Override + public int hashCode() { + return Objects.hash(query, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ComputedTraitsDefinition {\n"); + sb.append(" query: ").append(toIndentedString(query)).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("query"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("query"); + 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 ComputedTraitsDefinition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ComputedTraitsDefinition.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ComputedTraitsDefinition is not found" + + " in the empty JSON string", + ComputedTraitsDefinition.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ComputedTraitsDefinition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ComputedTraitsDefinition` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ComputedTraitsDefinition.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("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 (!ComputedTraitsDefinition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ComputedTraitsDefinition' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ComputedTraitsDefinition.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ComputedTraitsDefinition value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ComputedTraitsDefinition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ComputedTraitsDefinition given an JSON string + * + * @param jsonString JSON string + * @return An instance of ComputedTraitsDefinition + * @throws IOException if the JSON string is invalid with respect to ComputedTraitsDefinition + */ + public static ComputedTraitsDefinition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ComputedTraitsDefinition.class); + } + + /** + * Convert an instance of ComputedTraitsDefinition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Config.java b/src/main/java/com/segment/publicapi/models/Config.java new file mode 100644 index 00000000..8327f000 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/Config.java @@ -0,0 +1,279 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class Config extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Config.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Config.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Config' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPeriodicConfig = + gson.getDelegateAdapter(this, TypeToken.get(PeriodicConfig.class)); + final TypeAdapter adapterSpecificDaysConfig = + gson.getDelegateAdapter(this, TypeToken.get(SpecificDaysConfig.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Config value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PeriodicConfig` + if (value.getActualInstance() instanceof PeriodicConfig) { + JsonElement element = + adapterPeriodicConfig.toJsonTree( + (PeriodicConfig) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SpecificDaysConfig` + if (value.getActualInstance() instanceof SpecificDaysConfig) { + JsonElement element = + adapterSpecificDaysConfig.toJsonTree( + (SpecificDaysConfig) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match anyOf schemae:" + + " PeriodicConfig, SpecificDaysConfig"); + } + + @Override + public Config read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize PeriodicConfig + try { + // validate the JSON object to see if any exception is thrown + PeriodicConfig.validateJsonElement(jsonElement); + actualAdapter = adapterPeriodicConfig; + Config ret = new Config(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for PeriodicConfig failed with" + + " `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'PeriodicConfig'", + e); + } + // deserialize SpecificDaysConfig + try { + // validate the JSON object to see if any exception is thrown + SpecificDaysConfig.validateJsonElement(jsonElement); + actualAdapter = adapterSpecificDaysConfig; + Config ret = new Config(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for SpecificDaysConfig failed with" + + " `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'SpecificDaysConfig'", + e); + } + + throw new IOException( + String.format( + "Failed deserialization for Config: no class matches" + + " result, expected at least 1. Detailed failure" + + " message for anyOf schemas: %s. JSON: %s", + errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public Config() { + super("anyOf", Boolean.TRUE); + } + + public Config(PeriodicConfig o) { + super("anyOf", Boolean.TRUE); + setActualInstance(o); + } + + public Config(SpecificDaysConfig o) { + super("anyOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("PeriodicConfig", PeriodicConfig.class); + schemas.put("SpecificDaysConfig", SpecificDaysConfig.class); + } + + @Override + public Map> getSchemas() { + return Config.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check the instance parameter is valid + * against the anyOf child schemas: PeriodicConfig, SpecificDaysConfig + * + *

It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PeriodicConfig) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SpecificDaysConfig) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be PeriodicConfig, SpecificDaysConfig"); + } + + /** + * Get the actual instance, which can be the following: PeriodicConfig, SpecificDaysConfig + * + * @return The actual instance (PeriodicConfig, SpecificDaysConfig) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PeriodicConfig`. If the actual instance is not `PeriodicConfig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PeriodicConfig` + * @throws ClassCastException if the instance is not `PeriodicConfig` + */ + public PeriodicConfig getPeriodicConfig() throws ClassCastException { + return (PeriodicConfig) super.getActualInstance(); + } + + /** + * Get the actual instance of `SpecificDaysConfig`. If the actual instance is not + * `SpecificDaysConfig`, the ClassCastException will be thrown. + * + * @return The actual instance of `SpecificDaysConfig` + * @throws ClassCastException if the instance is not `SpecificDaysConfig` + */ + public SpecificDaysConfig getSpecificDaysConfig() throws ClassCastException { + return (SpecificDaysConfig) 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 Config + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with PeriodicConfig + try { + PeriodicConfig.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for PeriodicConfig failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with SpecificDaysConfig + try { + SpecificDaysConfig.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for SpecificDaysConfig failed with `%s`.", + e.getMessage())); + // continue to the next one + } + throw new IOException( + String.format( + "The JSON string is invalid for Config with anyOf schemas: PeriodicConfig," + + " SpecificDaysConfig. no class match the result, expected at least 1." + + " Detailed failure message for anyOf schemas: %s. JSON: %s", + errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of Config given an JSON string + * + * @param jsonString JSON string + * @return An instance of Config + * @throws IOException if the JSON string is invalid with respect to Config + */ + public static Config fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Config.class); + } + + /** + * Convert an instance of Config to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Config1.java b/src/main/java/com/segment/publicapi/models/Config1.java new file mode 100644 index 00000000..873f79bd --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/Config1.java @@ -0,0 +1,453 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class Config1 extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Config1.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Config1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Config1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter + adapterReverseEtlPeriodicScheduleConfig = + gson.getDelegateAdapter( + this, TypeToken.get(ReverseEtlPeriodicScheduleConfig.class)); + final TypeAdapter + adapterReverseEtlSpecificTimeScheduleConfig = + gson.getDelegateAdapter( + this, + TypeToken.get(ReverseEtlSpecificTimeScheduleConfig.class)); + final TypeAdapter adapterReverseEtlCronScheduleConfig = + gson.getDelegateAdapter( + this, TypeToken.get(ReverseEtlCronScheduleConfig.class)); + final TypeAdapter + adapterReverseEtlDbtCloudScheduleConfig = + gson.getDelegateAdapter( + this, TypeToken.get(ReverseEtlDbtCloudScheduleConfig.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Config1 value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type + // `ReverseEtlPeriodicScheduleConfig` + if (value.getActualInstance() + instanceof ReverseEtlPeriodicScheduleConfig) { + JsonElement element = + adapterReverseEtlPeriodicScheduleConfig.toJsonTree( + (ReverseEtlPeriodicScheduleConfig) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `ReverseEtlSpecificTimeScheduleConfig` + if (value.getActualInstance() + instanceof ReverseEtlSpecificTimeScheduleConfig) { + JsonElement element = + adapterReverseEtlSpecificTimeScheduleConfig.toJsonTree( + (ReverseEtlSpecificTimeScheduleConfig) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `ReverseEtlCronScheduleConfig` + if (value.getActualInstance() instanceof ReverseEtlCronScheduleConfig) { + JsonElement element = + adapterReverseEtlCronScheduleConfig.toJsonTree( + (ReverseEtlCronScheduleConfig) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `ReverseEtlDbtCloudScheduleConfig` + if (value.getActualInstance() + instanceof ReverseEtlDbtCloudScheduleConfig) { + JsonElement element = + adapterReverseEtlDbtCloudScheduleConfig.toJsonTree( + (ReverseEtlDbtCloudScheduleConfig) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match anyOf schemae:" + + " ReverseEtlCronScheduleConfig," + + " ReverseEtlDbtCloudScheduleConfig," + + " ReverseEtlPeriodicScheduleConfig," + + " ReverseEtlSpecificTimeScheduleConfig"); + } + + @Override + public Config1 read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize ReverseEtlPeriodicScheduleConfig + try { + // validate the JSON object to see if any exception is thrown + ReverseEtlPeriodicScheduleConfig.validateJsonElement(jsonElement); + actualAdapter = adapterReverseEtlPeriodicScheduleConfig; + Config1 ret = new Config1(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for" + + " ReverseEtlPeriodicScheduleConfig failed" + + " with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'ReverseEtlPeriodicScheduleConfig'", + e); + } + // deserialize ReverseEtlSpecificTimeScheduleConfig + try { + // validate the JSON object to see if any exception is thrown + ReverseEtlSpecificTimeScheduleConfig.validateJsonElement( + jsonElement); + actualAdapter = adapterReverseEtlSpecificTimeScheduleConfig; + Config1 ret = new Config1(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for" + + " ReverseEtlSpecificTimeScheduleConfig failed" + + " with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'ReverseEtlSpecificTimeScheduleConfig'", + e); + } + // deserialize ReverseEtlCronScheduleConfig + try { + // validate the JSON object to see if any exception is thrown + ReverseEtlCronScheduleConfig.validateJsonElement(jsonElement); + actualAdapter = adapterReverseEtlCronScheduleConfig; + Config1 ret = new Config1(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for ReverseEtlCronScheduleConfig" + + " failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'ReverseEtlCronScheduleConfig'", + e); + } + // deserialize ReverseEtlDbtCloudScheduleConfig + try { + // validate the JSON object to see if any exception is thrown + ReverseEtlDbtCloudScheduleConfig.validateJsonElement(jsonElement); + actualAdapter = adapterReverseEtlDbtCloudScheduleConfig; + Config1 ret = new Config1(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for" + + " ReverseEtlDbtCloudScheduleConfig failed" + + " with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema" + + " 'ReverseEtlDbtCloudScheduleConfig'", + e); + } + + throw new IOException( + String.format( + "Failed deserialization for Config1: no class matches" + + " result, expected at least 1. Detailed failure" + + " message for anyOf schemas: %s. JSON: %s", + errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public Config1() { + super("anyOf", Boolean.TRUE); + } + + public Config1(ReverseEtlCronScheduleConfig o) { + super("anyOf", Boolean.TRUE); + setActualInstance(o); + } + + public Config1(ReverseEtlDbtCloudScheduleConfig o) { + super("anyOf", Boolean.TRUE); + setActualInstance(o); + } + + public Config1(ReverseEtlPeriodicScheduleConfig o) { + super("anyOf", Boolean.TRUE); + setActualInstance(o); + } + + public Config1(ReverseEtlSpecificTimeScheduleConfig o) { + super("anyOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("ReverseEtlPeriodicScheduleConfig", ReverseEtlPeriodicScheduleConfig.class); + schemas.put( + "ReverseEtlSpecificTimeScheduleConfig", ReverseEtlSpecificTimeScheduleConfig.class); + schemas.put("ReverseEtlCronScheduleConfig", ReverseEtlCronScheduleConfig.class); + schemas.put("ReverseEtlDbtCloudScheduleConfig", ReverseEtlDbtCloudScheduleConfig.class); + } + + @Override + public Map> getSchemas() { + return Config1.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check the instance parameter is valid + * against the anyOf child schemas: ReverseEtlCronScheduleConfig, + * ReverseEtlDbtCloudScheduleConfig, ReverseEtlPeriodicScheduleConfig, + * ReverseEtlSpecificTimeScheduleConfig + * + *

It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ReverseEtlPeriodicScheduleConfig) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ReverseEtlSpecificTimeScheduleConfig) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ReverseEtlCronScheduleConfig) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ReverseEtlDbtCloudScheduleConfig) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be ReverseEtlCronScheduleConfig," + + " ReverseEtlDbtCloudScheduleConfig, ReverseEtlPeriodicScheduleConfig," + + " ReverseEtlSpecificTimeScheduleConfig"); + } + + /** + * Get the actual instance, which can be the following: ReverseEtlCronScheduleConfig, + * ReverseEtlDbtCloudScheduleConfig, ReverseEtlPeriodicScheduleConfig, + * ReverseEtlSpecificTimeScheduleConfig + * + * @return The actual instance (ReverseEtlCronScheduleConfig, ReverseEtlDbtCloudScheduleConfig, + * ReverseEtlPeriodicScheduleConfig, ReverseEtlSpecificTimeScheduleConfig) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ReverseEtlPeriodicScheduleConfig`. If the actual instance is not + * `ReverseEtlPeriodicScheduleConfig`, the ClassCastException will be thrown. + * + * @return The actual instance of `ReverseEtlPeriodicScheduleConfig` + * @throws ClassCastException if the instance is not `ReverseEtlPeriodicScheduleConfig` + */ + public ReverseEtlPeriodicScheduleConfig getReverseEtlPeriodicScheduleConfig() + throws ClassCastException { + return (ReverseEtlPeriodicScheduleConfig) super.getActualInstance(); + } + + /** + * Get the actual instance of `ReverseEtlSpecificTimeScheduleConfig`. If the actual instance is + * not `ReverseEtlSpecificTimeScheduleConfig`, the ClassCastException will be thrown. + * + * @return The actual instance of `ReverseEtlSpecificTimeScheduleConfig` + * @throws ClassCastException if the instance is not `ReverseEtlSpecificTimeScheduleConfig` + */ + public ReverseEtlSpecificTimeScheduleConfig getReverseEtlSpecificTimeScheduleConfig() + throws ClassCastException { + return (ReverseEtlSpecificTimeScheduleConfig) super.getActualInstance(); + } + + /** + * Get the actual instance of `ReverseEtlCronScheduleConfig`. If the actual instance is not + * `ReverseEtlCronScheduleConfig`, the ClassCastException will be thrown. + * + * @return The actual instance of `ReverseEtlCronScheduleConfig` + * @throws ClassCastException if the instance is not `ReverseEtlCronScheduleConfig` + */ + public ReverseEtlCronScheduleConfig getReverseEtlCronScheduleConfig() + throws ClassCastException { + return (ReverseEtlCronScheduleConfig) super.getActualInstance(); + } + + /** + * Get the actual instance of `ReverseEtlDbtCloudScheduleConfig`. If the actual instance is not + * `ReverseEtlDbtCloudScheduleConfig`, the ClassCastException will be thrown. + * + * @return The actual instance of `ReverseEtlDbtCloudScheduleConfig` + * @throws ClassCastException if the instance is not `ReverseEtlDbtCloudScheduleConfig` + */ + public ReverseEtlDbtCloudScheduleConfig getReverseEtlDbtCloudScheduleConfig() + throws ClassCastException { + return (ReverseEtlDbtCloudScheduleConfig) 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 Config1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with ReverseEtlPeriodicScheduleConfig + try { + ReverseEtlPeriodicScheduleConfig.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for ReverseEtlPeriodicScheduleConfig failed with" + + " `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with ReverseEtlSpecificTimeScheduleConfig + try { + ReverseEtlSpecificTimeScheduleConfig.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for ReverseEtlSpecificTimeScheduleConfig failed with" + + " `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with ReverseEtlCronScheduleConfig + try { + ReverseEtlCronScheduleConfig.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for ReverseEtlCronScheduleConfig failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with ReverseEtlDbtCloudScheduleConfig + try { + ReverseEtlDbtCloudScheduleConfig.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for ReverseEtlDbtCloudScheduleConfig failed with" + + " `%s`.", + e.getMessage())); + // continue to the next one + } + throw new IOException( + String.format( + "The JSON string is invalid for Config1 with anyOf schemas:" + + " ReverseEtlCronScheduleConfig, ReverseEtlDbtCloudScheduleConfig," + + " ReverseEtlPeriodicScheduleConfig," + + " ReverseEtlSpecificTimeScheduleConfig. no class match the result," + + " expected at least 1. Detailed failure message for anyOf schemas:" + + " %s. JSON: %s", + errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of Config1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Config1 + * @throws IOException if the JSON string is invalid with respect to Config1 + */ + public static Config1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Config1.class); + } + + /** + * Convert an instance of Config1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Connection.java b/src/main/java/com/segment/publicapi/models/Connection.java new file mode 100644 index 00000000..7837ec7b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/Connection.java @@ -0,0 +1,206 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** The connection that was created. */ +public class Connection { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public Connection() {} + + public Connection id(String id) { + + this.id = id; + return this; + } + + /** + * The id of the connection that was created. + * + * @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; + } + Connection connection = (Connection) o; + return Objects.equals(this.id, connection.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Connection {\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("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + 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 Connection + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Connection.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Connection is not found in the empty" + + " JSON string", + Connection.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Connection.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `Connection` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Connection.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Connection.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Connection' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Connection.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Connection value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Connection read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of Connection given an JSON string + * + * @param jsonString JSON string + * @return An instance of Connection + * @throws IOException if the JSON string is invalid with respect to Connection + */ + public static Connection fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Connection.class); + } + + /** + * Convert an instance of Connection to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Contact.java b/src/main/java/com/segment/publicapi/models/Contact.java index ac8852b7..0fa802d8 100644 --- a/src/main/java/com/segment/publicapi/models/Contact.java +++ b/src/main/java/com/segment/publicapi/models/Contact.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,307 +9,298 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** The contact info for Integration Owners. */ +public class Contact { + public static final String SERIALIZED_NAME_NAME = "name"; -/** - * The contact info for Integration Owners. - */ -@ApiModel(description = "The contact info for Integration Owners.") + @SerializedName(SERIALIZED_NAME_NAME) + private String name; -public class Contact { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_EMAIL = "email"; - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; + public static final String SERIALIZED_NAME_EMAIL = "email"; - public static final String SERIALIZED_NAME_ROLE = "role"; - @SerializedName(SERIALIZED_NAME_ROLE) - private String role; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; - public static final String SERIALIZED_NAME_IS_PRIMARY = "isPrimary"; - @SerializedName(SERIALIZED_NAME_IS_PRIMARY) - private Boolean isPrimary; + public static final String SERIALIZED_NAME_ROLE = "role"; - public Contact() { - } + @SerializedName(SERIALIZED_NAME_ROLE) + private String role; - public Contact name(String name) { - - this.name = name; - return this; - } + public static final String SERIALIZED_NAME_IS_PRIMARY = "isPrimary"; - /** - * Name of this contact. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Name of this contact.") + @SerializedName(SERIALIZED_NAME_IS_PRIMARY) + private Boolean isPrimary; - public String getName() { - return name; - } + public Contact() {} + public Contact name(String name) { - public void setName(String name) { - this.name = name; - } + this.name = name; + return this; + } + /** + * Name of this contact. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - public Contact email(String email) { - - this.email = email; - return this; - } + public void setName(String name) { + this.name = name; + } - /** - * Email of this contact. - * @return email - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Email of this contact.") + public Contact email(String email) { - public String getEmail() { - return email; - } + this.email = email; + return this; + } + /** + * Email of this contact. + * + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } - public void setEmail(String email) { - this.email = email; - } + public void setEmail(String email) { + this.email = email; + } + public Contact role(String role) { - public Contact role(String role) { - - this.role = role; - return this; - } + this.role = role; + return this; + } - /** - * Role of this contact. - * @return role - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Role of this contact.") + /** + * Role of this contact. + * + * @return role + */ + @javax.annotation.Nullable + public String getRole() { + return role; + } - public String getRole() { - return role; - } + public void setRole(String role) { + this.role = role; + } + public Contact isPrimary(Boolean isPrimary) { - public void setRole(String role) { - this.role = role; - } + this.isPrimary = isPrimary; + return this; + } + /** + * Whether this is a primary contact. + * + * @return isPrimary + */ + @javax.annotation.Nullable + public Boolean getIsPrimary() { + return isPrimary; + } - public Contact isPrimary(Boolean isPrimary) { - - this.isPrimary = isPrimary; - return this; - } + public void setIsPrimary(Boolean isPrimary) { + this.isPrimary = isPrimary; + } - /** - * Whether this is a primary contact. - * @return isPrimary - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether this is a primary contact.") + @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.name, contact.name) + && Objects.equals(this.email, contact.email) + && Objects.equals(this.role, contact.role) + && Objects.equals(this.isPrimary, contact.isPrimary); + } - public Boolean getIsPrimary() { - return isPrimary; - } + @Override + public int hashCode() { + return Objects.hash(name, email, role, isPrimary); + } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Contact {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" isPrimary: ").append(toIndentedString(isPrimary)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public void setIsPrimary(Boolean isPrimary) { - this.isPrimary = isPrimary; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("email"); + openapiFields.add("role"); + openapiFields.add("isPrimary"); - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("email"); } - Contact contact = (Contact) o; - return Objects.equals(this.name, contact.name) && - Objects.equals(this.email, contact.email) && - Objects.equals(this.role, contact.role) && - Objects.equals(this.isPrimary, contact.isPrimary); - } - - @Override - public int hashCode() { - return Objects.hash(name, email, role, isPrimary); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Contact {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" role: ").append(toIndentedString(role)).append("\n"); - sb.append(" isPrimary: ").append(toIndentedString(isPrimary)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("email"); - openapiFields.add("role"); - openapiFields.add("isPrimary"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("email"); - openapiRequiredFields.add("role"); - openapiRequiredFields.add("isPrimary"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Contact - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Contact.openapiRequiredFields.isEmpty()) { // has required fields but JSON object 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())); + + /** + * Validates the 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 = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (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(), jsonObj.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())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Contact.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Contact.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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") != 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("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("role") != null && !jsonObj.get("role").isJsonNull()) + && !jsonObj.get("role").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `role` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("role").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("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("role").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `role` to be a primitive type in the JSON string but got `%s`", jsonObj.get("role").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 { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.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); - } -} + 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/com/segment/publicapi/models/CreateAudience200Response.java b/src/main/java/com/segment/publicapi/models/CreateAudience200Response.java new file mode 100644 index 00000000..df82f639 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateAudience200Response.java @@ -0,0 +1,194 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateAudience200Response */ +public class CreateAudience200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateAudienceAlphaOutput data; + + public CreateAudience200Response() {} + + public CreateAudience200Response data(CreateAudienceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateAudienceAlphaOutput getData() { + return data; + } + + public void setData(CreateAudienceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAudience200Response createAudience200Response = (CreateAudience200Response) o; + return Objects.equals(this.data, createAudience200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAudience200Response {\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 CreateAudience200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAudience200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateAudience200Response is not found" + + " in the empty JSON string", + CreateAudience200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAudience200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateAudience200Response` 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()) { + CreateAudienceAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAudience200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAudience200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateAudience200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAudience200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAudience200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAudience200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAudience200Response + * @throws IOException if the JSON string is invalid with respect to CreateAudience200Response + */ + public static CreateAudience200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAudience200Response.class); + } + + /** + * Convert an instance of CreateAudience200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateAudienceAlphaInput.java b/src/main/java/com/segment/publicapi/models/CreateAudienceAlphaInput.java new file mode 100644 index 00000000..ed7e8906 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateAudienceAlphaInput.java @@ -0,0 +1,335 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Input to create an audience. */ +public class CreateAudienceAlphaInput { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + + @SerializedName(SERIALIZED_NAME_DEFINITION) + private AudienceDefinition definition; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + + @SerializedName(SERIALIZED_NAME_OPTIONS) + private AudienceOptions options; + + public CreateAudienceAlphaInput() {} + + public CreateAudienceAlphaInput name(String name) { + + this.name = name; + return this; + } + + /** + * Name of the audience. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreateAudienceAlphaInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Determines whether a computation is enabled. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public CreateAudienceAlphaInput description(String description) { + + this.description = description; + return this; + } + + /** + * Description of the audience. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CreateAudienceAlphaInput definition(AudienceDefinition definition) { + + this.definition = definition; + return this; + } + + /** + * Get definition + * + * @return definition + */ + @javax.annotation.Nonnull + public AudienceDefinition getDefinition() { + return definition; + } + + public void setDefinition(AudienceDefinition definition) { + this.definition = definition; + } + + public CreateAudienceAlphaInput options(AudienceOptions options) { + + this.options = options; + return this; + } + + /** + * Get options + * + * @return options + */ + @javax.annotation.Nullable + public AudienceOptions getOptions() { + return options; + } + + public void setOptions(AudienceOptions options) { + this.options = options; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAudienceAlphaInput createAudienceAlphaInput = (CreateAudienceAlphaInput) o; + return Objects.equals(this.name, createAudienceAlphaInput.name) + && Objects.equals(this.enabled, createAudienceAlphaInput.enabled) + && Objects.equals(this.description, createAudienceAlphaInput.description) + && Objects.equals(this.definition, createAudienceAlphaInput.definition) + && Objects.equals(this.options, createAudienceAlphaInput.options); + } + + @Override + public int hashCode() { + return Objects.hash(name, enabled, description, definition, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAudienceAlphaInput {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("enabled"); + openapiFields.add("description"); + openapiFields.add("definition"); + openapiFields.add("options"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("definition"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAudienceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAudienceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateAudienceAlphaInput is not found" + + " in the empty JSON string", + CreateAudienceAlphaInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAudienceAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateAudienceAlphaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAudienceAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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())); + } + // validate the required field `definition` + AudienceDefinition.validateJsonElement(jsonObj.get("definition")); + // validate the optional field `options` + if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull()) { + AudienceOptions.validateJsonElement(jsonObj.get("options")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAudienceAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAudienceAlphaInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateAudienceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAudienceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAudienceAlphaInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAudienceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAudienceAlphaInput + * @throws IOException if the JSON string is invalid with respect to CreateAudienceAlphaInput + */ + public static CreateAudienceAlphaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAudienceAlphaInput.class); + } + + /** + * Convert an instance of CreateAudienceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateAudienceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/CreateAudienceAlphaOutput.java new file mode 100644 index 00000000..f0a87b16 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateAudienceAlphaOutput.java @@ -0,0 +1,203 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Audience output for create. */ +public class CreateAudienceAlphaOutput { + public static final String SERIALIZED_NAME_AUDIENCE = "audience"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE) + private AudienceSummary audience; + + public CreateAudienceAlphaOutput() {} + + public CreateAudienceAlphaOutput audience(AudienceSummary audience) { + + this.audience = audience; + return this; + } + + /** + * Get audience + * + * @return audience + */ + @javax.annotation.Nonnull + public AudienceSummary getAudience() { + return audience; + } + + public void setAudience(AudienceSummary audience) { + this.audience = audience; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAudienceAlphaOutput createAudienceAlphaOutput = (CreateAudienceAlphaOutput) o; + return Objects.equals(this.audience, createAudienceAlphaOutput.audience); + } + + @Override + public int hashCode() { + return Objects.hash(audience); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAudienceAlphaOutput {\n"); + sb.append(" audience: ").append(toIndentedString(audience)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("audience"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("audience"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAudienceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAudienceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateAudienceAlphaOutput is not found" + + " in the empty JSON string", + CreateAudienceAlphaOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAudienceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateAudienceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAudienceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `audience` + AudienceSummary.validateJsonElement(jsonObj.get("audience")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAudienceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAudienceAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateAudienceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAudienceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAudienceAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAudienceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAudienceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to CreateAudienceAlphaOutput + */ + public static CreateAudienceAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAudienceAlphaOutput.class); + } + + /** + * Convert an instance of CreateAudienceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateAudiencePreview200Response.java b/src/main/java/com/segment/publicapi/models/CreateAudiencePreview200Response.java new file mode 100644 index 00000000..bdbd349b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateAudiencePreview200Response.java @@ -0,0 +1,199 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateAudiencePreview200Response */ +public class CreateAudiencePreview200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateAudiencePreviewAlphaOutput data; + + public CreateAudiencePreview200Response() {} + + public CreateAudiencePreview200Response data(CreateAudiencePreviewAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateAudiencePreviewAlphaOutput getData() { + return data; + } + + public void setData(CreateAudiencePreviewAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAudiencePreview200Response createAudiencePreview200Response = + (CreateAudiencePreview200Response) o; + return Objects.equals(this.data, createAudiencePreview200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAudiencePreview200Response {\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 + * CreateAudiencePreview200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAudiencePreview200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateAudiencePreview200Response is" + + " not found in the empty JSON string", + CreateAudiencePreview200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAudiencePreview200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateAudiencePreview200Response` 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()) { + CreateAudiencePreviewAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAudiencePreview200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAudiencePreview200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateAudiencePreview200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAudiencePreview200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAudiencePreview200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAudiencePreview200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAudiencePreview200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateAudiencePreview200Response + */ + public static CreateAudiencePreview200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAudiencePreview200Response.class); + } + + /** + * Convert an instance of CreateAudiencePreview200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateAudiencePreviewAlphaInput.java b/src/main/java/com/segment/publicapi/models/CreateAudiencePreviewAlphaInput.java new file mode 100644 index 00000000..ea591663 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateAudiencePreviewAlphaInput.java @@ -0,0 +1,329 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Input to create an audience preview. */ +public class CreateAudiencePreviewAlphaInput { + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + + @SerializedName(SERIALIZED_NAME_DEFINITION) + private AudienceDefinitionWithoutType definition; + + /** + * Discriminator denoting the audience's product type. Possible values: USERS, ACCOUNTS, + * LINKED. + */ + @JsonAdapter(AudienceTypeEnum.Adapter.class) + public enum AudienceTypeEnum { + ACCOUNTS("ACCOUNTS"), + + LINKED("LINKED"), + + USERS("USERS"); + + private String value; + + AudienceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AudienceTypeEnum fromValue(String value) { + for (AudienceTypeEnum b : AudienceTypeEnum.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 AudienceTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AudienceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AudienceTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_AUDIENCE_TYPE = "audienceType"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE_TYPE) + private AudienceTypeEnum audienceType; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + + @SerializedName(SERIALIZED_NAME_OPTIONS) + private CreateAudiencePreviewOptions options; + + public CreateAudiencePreviewAlphaInput() {} + + public CreateAudiencePreviewAlphaInput definition(AudienceDefinitionWithoutType definition) { + + this.definition = definition; + return this; + } + + /** + * Get definition + * + * @return definition + */ + @javax.annotation.Nonnull + public AudienceDefinitionWithoutType getDefinition() { + return definition; + } + + public void setDefinition(AudienceDefinitionWithoutType definition) { + this.definition = definition; + } + + public CreateAudiencePreviewAlphaInput audienceType(AudienceTypeEnum audienceType) { + + this.audienceType = audienceType; + return this; + } + + /** + * Discriminator denoting the audience's product type. Possible values: USERS, ACCOUNTS, + * LINKED. + * + * @return audienceType + */ + @javax.annotation.Nonnull + public AudienceTypeEnum getAudienceType() { + return audienceType; + } + + public void setAudienceType(AudienceTypeEnum audienceType) { + this.audienceType = audienceType; + } + + public CreateAudiencePreviewAlphaInput options(CreateAudiencePreviewOptions options) { + + this.options = options; + return this; + } + + /** + * Get options + * + * @return options + */ + @javax.annotation.Nullable + public CreateAudiencePreviewOptions getOptions() { + return options; + } + + public void setOptions(CreateAudiencePreviewOptions options) { + this.options = options; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAudiencePreviewAlphaInput createAudiencePreviewAlphaInput = + (CreateAudiencePreviewAlphaInput) o; + return Objects.equals(this.definition, createAudiencePreviewAlphaInput.definition) + && Objects.equals(this.audienceType, createAudiencePreviewAlphaInput.audienceType) + && Objects.equals(this.options, createAudiencePreviewAlphaInput.options); + } + + @Override + public int hashCode() { + return Objects.hash(definition, audienceType, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAudiencePreviewAlphaInput {\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" audienceType: ").append(toIndentedString(audienceType)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("definition"); + openapiFields.add("audienceType"); + openapiFields.add("options"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("definition"); + openapiRequiredFields.add("audienceType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateAudiencePreviewAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAudiencePreviewAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateAudiencePreviewAlphaInput is not" + + " found in the empty JSON string", + CreateAudiencePreviewAlphaInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAudiencePreviewAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateAudiencePreviewAlphaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAudiencePreviewAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `definition` + AudienceDefinitionWithoutType.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("audienceType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `audienceType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("audienceType").toString())); + } + // validate the optional field `options` + if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull()) { + CreateAudiencePreviewOptions.validateJsonElement(jsonObj.get("options")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAudiencePreviewAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAudiencePreviewAlphaInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateAudiencePreviewAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAudiencePreviewAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAudiencePreviewAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAudiencePreviewAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAudiencePreviewAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * CreateAudiencePreviewAlphaInput + */ + public static CreateAudiencePreviewAlphaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAudiencePreviewAlphaInput.class); + } + + /** + * Convert an instance of CreateAudiencePreviewAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateAudiencePreviewAlphaOutput.java b/src/main/java/com/segment/publicapi/models/CreateAudiencePreviewAlphaOutput.java new file mode 100644 index 00000000..efae7afe --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateAudiencePreviewAlphaOutput.java @@ -0,0 +1,210 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output when creating an audience preview. */ +public class CreateAudiencePreviewAlphaOutput { + public static final String SERIALIZED_NAME_AUDIENCE_PREVIEW = "audiencePreview"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE_PREVIEW) + private AudiencePreviewIdentifier audiencePreview; + + public CreateAudiencePreviewAlphaOutput() {} + + public CreateAudiencePreviewAlphaOutput audiencePreview( + AudiencePreviewIdentifier audiencePreview) { + + this.audiencePreview = audiencePreview; + return this; + } + + /** + * Get audiencePreview + * + * @return audiencePreview + */ + @javax.annotation.Nonnull + public AudiencePreviewIdentifier getAudiencePreview() { + return audiencePreview; + } + + public void setAudiencePreview(AudiencePreviewIdentifier audiencePreview) { + this.audiencePreview = audiencePreview; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAudiencePreviewAlphaOutput createAudiencePreviewAlphaOutput = + (CreateAudiencePreviewAlphaOutput) o; + return Objects.equals( + this.audiencePreview, createAudiencePreviewAlphaOutput.audiencePreview); + } + + @Override + public int hashCode() { + return Objects.hash(audiencePreview); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAudiencePreviewAlphaOutput {\n"); + sb.append(" audiencePreview: ").append(toIndentedString(audiencePreview)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("audiencePreview"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("audiencePreview"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateAudiencePreviewAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAudiencePreviewAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateAudiencePreviewAlphaOutput is" + + " not found in the empty JSON string", + CreateAudiencePreviewAlphaOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAudiencePreviewAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateAudiencePreviewAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAudiencePreviewAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `audiencePreview` + AudiencePreviewIdentifier.validateJsonElement(jsonObj.get("audiencePreview")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAudiencePreviewAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAudiencePreviewAlphaOutput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateAudiencePreviewAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAudiencePreviewAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAudiencePreviewAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAudiencePreviewAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAudiencePreviewAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * CreateAudiencePreviewAlphaOutput + */ + public static CreateAudiencePreviewAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAudiencePreviewAlphaOutput.class); + } + + /** + * Convert an instance of CreateAudiencePreviewAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateAudiencePreviewOptions.java b/src/main/java/com/segment/publicapi/models/CreateAudiencePreviewOptions.java new file mode 100644 index 00000000..fbaee4a4 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateAudiencePreviewOptions.java @@ -0,0 +1,259 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Options which should be applied when segmenting audience previews. */ +public class CreateAudiencePreviewOptions { + public static final String SERIALIZED_NAME_FILTER_BY_EXTERNAL_IDS = "filterByExternalIds"; + + @SerializedName(SERIALIZED_NAME_FILTER_BY_EXTERNAL_IDS) + private List filterByExternalIds; + + public static final String SERIALIZED_NAME_BACKFILL_EVENT_DATA_DAYS = "backfillEventDataDays"; + + @SerializedName(SERIALIZED_NAME_BACKFILL_EVENT_DATA_DAYS) + private BigDecimal backfillEventDataDays; + + public CreateAudiencePreviewOptions() {} + + public CreateAudiencePreviewOptions filterByExternalIds(List filterByExternalIds) { + + this.filterByExternalIds = filterByExternalIds; + return this; + } + + public CreateAudiencePreviewOptions addFilterByExternalIdsItem(String filterByExternalIdsItem) { + if (this.filterByExternalIds == null) { + this.filterByExternalIds = new ArrayList<>(); + } + this.filterByExternalIds.add(filterByExternalIdsItem); + return this; + } + + /** + * The set of profile external identifiers being used to determine audience preview membership. + * Profiles will only be considered for audience preview membership if the profile has at least + * one external id whose key matches a value in this set. If unspecified, a default set of + * external identifiers will be used: `['user_id', 'email', + * 'android.idfa', 'ios.idfa']`. + * + * @return filterByExternalIds + */ + @javax.annotation.Nullable + public List getFilterByExternalIds() { + return filterByExternalIds; + } + + public void setFilterByExternalIds(List filterByExternalIds) { + this.filterByExternalIds = filterByExternalIds; + } + + public CreateAudiencePreviewOptions backfillEventDataDays(BigDecimal backfillEventDataDays) { + + this.backfillEventDataDays = backfillEventDataDays; + return this; + } + + /** + * If specified, the value of this field indicates the number of days (specified from the date + * the audience preview was created) that event data will be included from when determining + * audience preview membership. If not specified, the default is set to the maximum event window + * size, or 7 days if no window condition is defined. Note that this is applied on a best-effort + * basis and may not always be applicable. In such cases, the response will not return a + * backfillEventDataDays value, and all available data will be taken into account. + * + * @return backfillEventDataDays + */ + @javax.annotation.Nullable + public BigDecimal getBackfillEventDataDays() { + return backfillEventDataDays; + } + + public void setBackfillEventDataDays(BigDecimal backfillEventDataDays) { + this.backfillEventDataDays = backfillEventDataDays; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAudiencePreviewOptions createAudiencePreviewOptions = + (CreateAudiencePreviewOptions) o; + return Objects.equals( + this.filterByExternalIds, createAudiencePreviewOptions.filterByExternalIds) + && Objects.equals( + this.backfillEventDataDays, + createAudiencePreviewOptions.backfillEventDataDays); + } + + @Override + public int hashCode() { + return Objects.hash(filterByExternalIds, backfillEventDataDays); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAudiencePreviewOptions {\n"); + sb.append(" filterByExternalIds: ") + .append(toIndentedString(filterByExternalIds)) + .append("\n"); + sb.append(" backfillEventDataDays: ") + .append(toIndentedString(backfillEventDataDays)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("filterByExternalIds"); + openapiFields.add("backfillEventDataDays"); + + // 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 + * CreateAudiencePreviewOptions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAudiencePreviewOptions.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateAudiencePreviewOptions is not" + + " found in the empty JSON string", + CreateAudiencePreviewOptions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAudiencePreviewOptions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateAudiencePreviewOptions` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("filterByExternalIds") != null + && !jsonObj.get("filterByExternalIds").isJsonNull() + && !jsonObj.get("filterByExternalIds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `filterByExternalIds` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("filterByExternalIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAudiencePreviewOptions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAudiencePreviewOptions' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateAudiencePreviewOptions.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAudiencePreviewOptions value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAudiencePreviewOptions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAudiencePreviewOptions given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAudiencePreviewOptions + * @throws IOException if the JSON string is invalid with respect to + * CreateAudiencePreviewOptions + */ + public static CreateAudiencePreviewOptions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAudiencePreviewOptions.class); + } + + /** + * Convert an instance of CreateAudiencePreviewOptions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateCloudSourceRegulation200Response.java b/src/main/java/com/segment/publicapi/models/CreateCloudSourceRegulation200Response.java index 5beed2b2..c6dabfcf 100644 --- a/src/main/java/com/segment/publicapi/models/CreateCloudSourceRegulation200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateCloudSourceRegulation200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateCloudSourceRegulationV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateCloudSourceRegulation200Response - */ - +/** CreateCloudSourceRegulation200Response */ public class CreateCloudSourceRegulation200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateCloudSourceRegulationV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateCloudSourceRegulation200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateCloudSourceRegulationV1Output data; - public CreateCloudSourceRegulation200Response data(CreateCloudSourceRegulationV1Output data) { - - this.data = data; - return this; - } + public CreateCloudSourceRegulation200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateCloudSourceRegulation200Response data(CreateCloudSourceRegulationV1Output data) { - public CreateCloudSourceRegulationV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateCloudSourceRegulationV1Output getData() { + return data; + } - public void setData(CreateCloudSourceRegulationV1Output data) { - this.data = data; - } + public void setData(CreateCloudSourceRegulationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCloudSourceRegulation200Response createCloudSourceRegulation200Response = + (CreateCloudSourceRegulation200Response) o; + return Objects.equals(this.data, createCloudSourceRegulation200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCloudSourceRegulation200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateCloudSourceRegulation200Response createCloudSourceRegulation200Response = (CreateCloudSourceRegulation200Response) o; - return Objects.equals(this.data, createCloudSourceRegulation200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateCloudSourceRegulation200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateCloudSourceRegulation200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateCloudSourceRegulation200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCloudSourceRegulation200Response is not found in the empty JSON string", CreateCloudSourceRegulation200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateCloudSourceRegulation200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCloudSourceRegulation200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateCloudSourceRegulation200Response" + + " is not found in the empty JSON string", + CreateCloudSourceRegulation200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateCloudSourceRegulation200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCloudSourceRegulation200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCloudSourceRegulation200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateCloudSourceRegulation200Response` 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()) { + CreateCloudSourceRegulationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateCloudSourceRegulation200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateCloudSourceRegulation200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateCloudSourceRegulation200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateCloudSourceRegulation200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateCloudSourceRegulation200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCloudSourceRegulation200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCloudSourceRegulation200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateCloudSourceRegulation200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CreateCloudSourceRegulation200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCloudSourceRegulation200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCloudSourceRegulation200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCloudSourceRegulation200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateCloudSourceRegulation200Response + */ + public static CreateCloudSourceRegulation200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCloudSourceRegulation200Response.class); } - } - - /** - * Create an instance of CreateCloudSourceRegulation200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateCloudSourceRegulation200Response - * @throws IOException if the JSON string is invalid with respect to CreateCloudSourceRegulation200Response - */ - public static CreateCloudSourceRegulation200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateCloudSourceRegulation200Response.class); - } - - /** - * Convert an instance of CreateCloudSourceRegulation200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateCloudSourceRegulation200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateCloudSourceRegulationV1Input.java b/src/main/java/com/segment/publicapi/models/CreateCloudSourceRegulationV1Input.java index 07fb6c1b..91a65190 100644 --- a/src/main/java/com/segment/publicapi/models/CreateCloudSourceRegulationV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateCloudSourceRegulationV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,419 +9,431 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The input to create a Cloud Source-scoped regulation. - */ -@ApiModel(description = "The input to create a Cloud Source-scoped regulation.") - +/** The input to create a Cloud Source-scoped regulation. */ public class CreateCloudSourceRegulationV1Input { - /** - * The regulation type to create. - */ - @JsonAdapter(RegulationTypeEnum.Adapter.class) - public enum RegulationTypeEnum { - BULK_DELETE_ONLY("BULK_DELETE_ONLY"), - - DELETE_INTERNAL("DELETE_INTERNAL"), - - DELETE_ONLY("DELETE_ONLY"), - - SUPPRESS_ONLY("SUPPRESS_ONLY"), - - SUPPRESS_WITH_DELETE("SUPPRESS_WITH_DELETE"), - - UNSUPPRESS("UNSUPPRESS"); - - private String value; - - RegulationTypeEnum(String value) { - this.value = value; - } + /** The regulation type to create. */ + @JsonAdapter(RegulationTypeEnum.Adapter.class) + public enum RegulationTypeEnum { + DELETE_INTERNAL("DELETE_INTERNAL"), - public String getValue() { - return value; - } + DELETE_ONLY("DELETE_ONLY"), - @Override - public String toString() { - return String.valueOf(value); - } + SUPPRESS_ONLY("SUPPRESS_ONLY"), - public static RegulationTypeEnum fromValue(String value) { - for (RegulationTypeEnum b : RegulationTypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } + SUPPRESS_WITH_DELETE("SUPPRESS_WITH_DELETE"), - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final RegulationTypeEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RegulationTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return RegulationTypeEnum.fromValue(value); - } - } - } + SUPPRESS_WITH_DELETE_INTERNAL("SUPPRESS_WITH_DELETE_INTERNAL"), - public static final String SERIALIZED_NAME_REGULATION_TYPE = "regulationType"; - @SerializedName(SERIALIZED_NAME_REGULATION_TYPE) - private RegulationTypeEnum regulationType; + UNSUPPRESS("UNSUPPRESS"); - /** - * The subject type. Must be `objectId` for Cloud Sources. - */ - @JsonAdapter(SubjectTypeEnum.Adapter.class) - public enum SubjectTypeEnum { - OBJECT_ID("OBJECT_ID"); + private String value; - private String value; + RegulationTypeEnum(String value) { + this.value = value; + } - SubjectTypeEnum(String value) { - this.value = value; - } + public String getValue() { + return value; + } - public String getValue() { - return value; - } + @Override + public String toString() { + return String.valueOf(value); + } - @Override - public String toString() { - return String.valueOf(value); - } + public static RegulationTypeEnum fromValue(String value) { + for (RegulationTypeEnum b : RegulationTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public static SubjectTypeEnum fromValue(String value) { - for (SubjectTypeEnum b : SubjectTypeEnum.values()) { - if (b.value.equals(value)) { - return b; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RegulationTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RegulationTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RegulationTypeEnum.fromValue(value); + } } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final SubjectTypeEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public SubjectTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return SubjectTypeEnum.fromValue(value); - } - } - } + public static final String SERIALIZED_NAME_REGULATION_TYPE = "regulationType"; - public static final String SERIALIZED_NAME_SUBJECT_TYPE = "subjectType"; - @SerializedName(SERIALIZED_NAME_SUBJECT_TYPE) - private SubjectTypeEnum subjectType; + @SerializedName(SERIALIZED_NAME_REGULATION_TYPE) + private RegulationTypeEnum regulationType; - public static final String SERIALIZED_NAME_SUBJECT_IDS = "subjectIds"; - @SerializedName(SERIALIZED_NAME_SUBJECT_IDS) - private List subjectIds = null; + /** The subject type. Must be `objectId` for Cloud Sources. */ + @JsonAdapter(SubjectTypeEnum.Adapter.class) + public enum SubjectTypeEnum { + OBJECT_ID("OBJECT_ID"); - public static final String SERIALIZED_NAME_COLLECTION = "collection"; - @SerializedName(SERIALIZED_NAME_COLLECTION) - private String collection; + private String value; - public CreateCloudSourceRegulationV1Input() { - } + SubjectTypeEnum(String value) { + this.value = value; + } - public CreateCloudSourceRegulationV1Input regulationType(RegulationTypeEnum regulationType) { - - this.regulationType = regulationType; - return this; - } + public String getValue() { + return value; + } - /** - * The regulation type to create. - * @return regulationType - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The regulation type to create.") + @Override + public String toString() { + return String.valueOf(value); + } - public RegulationTypeEnum getRegulationType() { - return regulationType; - } + public static SubjectTypeEnum fromValue(String value) { + for (SubjectTypeEnum b : SubjectTypeEnum.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 SubjectTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SubjectTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SubjectTypeEnum.fromValue(value); + } + } + } - public void setRegulationType(RegulationTypeEnum regulationType) { - this.regulationType = regulationType; - } + public static final String SERIALIZED_NAME_SUBJECT_TYPE = "subjectType"; + @SerializedName(SERIALIZED_NAME_SUBJECT_TYPE) + private SubjectTypeEnum subjectType; - public CreateCloudSourceRegulationV1Input subjectType(SubjectTypeEnum subjectType) { - - this.subjectType = subjectType; - return this; - } + public static final String SERIALIZED_NAME_SUBJECT_IDS = "subjectIds"; - /** - * The subject type. Must be `objectId` for Cloud Sources. - * @return subjectType - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The subject type. Must be `objectId` for Cloud Sources.") + @SerializedName(SERIALIZED_NAME_SUBJECT_IDS) + private List subjectIds = new ArrayList<>(); - public SubjectTypeEnum getSubjectType() { - return subjectType; - } + public static final String SERIALIZED_NAME_COLLECTION = "collection"; + @SerializedName(SERIALIZED_NAME_COLLECTION) + private String collection; - public void setSubjectType(SubjectTypeEnum subjectType) { - this.subjectType = subjectType; - } + public CreateCloudSourceRegulationV1Input() {} + public CreateCloudSourceRegulationV1Input regulationType(RegulationTypeEnum regulationType) { - public CreateCloudSourceRegulationV1Input subjectIds(List subjectIds) { - - this.subjectIds = subjectIds; - return this; - } + this.regulationType = regulationType; + return this; + } - public CreateCloudSourceRegulationV1Input addSubjectIdsItem(String subjectIdsItem) { - if (this.subjectIds == null) { - this.subjectIds = new ArrayList<>(); + /** + * The regulation type to create. + * + * @return regulationType + */ + @javax.annotation.Nonnull + public RegulationTypeEnum getRegulationType() { + return regulationType; } - this.subjectIds.add(subjectIdsItem); - return this; - } - /** - * The user or object ids of the subjects to regulate. Config API note: equal to `parent` but allows an array. - * @return subjectIds - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The user or object ids of the subjects to regulate. Config API note: equal to `parent` but allows an array.") + public void setRegulationType(RegulationTypeEnum regulationType) { + this.regulationType = regulationType; + } - public List getSubjectIds() { - return subjectIds; - } + public CreateCloudSourceRegulationV1Input subjectType(SubjectTypeEnum subjectType) { + this.subjectType = subjectType; + return this; + } - public void setSubjectIds(List subjectIds) { - this.subjectIds = subjectIds; - } + /** + * The subject type. Must be `objectId` for Cloud Sources. + * + * @return subjectType + */ + @javax.annotation.Nonnull + public SubjectTypeEnum getSubjectType() { + return subjectType; + } + public void setSubjectType(SubjectTypeEnum subjectType) { + this.subjectType = subjectType; + } - public CreateCloudSourceRegulationV1Input collection(String collection) { - - this.collection = collection; - return this; - } + public CreateCloudSourceRegulationV1Input subjectIds(List subjectIds) { - /** - * The Cloud Source collection to regulate. - * @return collection - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Cloud Source collection to regulate.") + this.subjectIds = subjectIds; + return this; + } - public String getCollection() { - return collection; - } + public CreateCloudSourceRegulationV1Input addSubjectIdsItem(String subjectIdsItem) { + if (this.subjectIds == null) { + this.subjectIds = new ArrayList<>(); + } + this.subjectIds.add(subjectIdsItem); + return this; + } + + /** + * The list of `userId` or `objectId` values of the subjects to regulate. + * Config API note: equal to `parent` but allows an array. + * + * @return subjectIds + */ + @javax.annotation.Nonnull + public List getSubjectIds() { + return subjectIds; + } + public void setSubjectIds(List subjectIds) { + this.subjectIds = subjectIds; + } - public void setCollection(String collection) { - this.collection = collection; - } + public CreateCloudSourceRegulationV1Input collection(String collection) { + this.collection = collection; + return this; + } + /** + * The Cloud Source collection to regulate. + * + * @return collection + */ + @javax.annotation.Nonnull + public String getCollection() { + return collection; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + public void setCollection(String collection) { + this.collection = collection; } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input = + (CreateCloudSourceRegulationV1Input) o; + return Objects.equals( + this.regulationType, createCloudSourceRegulationV1Input.regulationType) + && Objects.equals(this.subjectType, createCloudSourceRegulationV1Input.subjectType) + && Objects.equals(this.subjectIds, createCloudSourceRegulationV1Input.subjectIds) + && Objects.equals(this.collection, createCloudSourceRegulationV1Input.collection); } - CreateCloudSourceRegulationV1Input createCloudSourceRegulationV1Input = (CreateCloudSourceRegulationV1Input) o; - return Objects.equals(this.regulationType, createCloudSourceRegulationV1Input.regulationType) && - Objects.equals(this.subjectType, createCloudSourceRegulationV1Input.subjectType) && - Objects.equals(this.subjectIds, createCloudSourceRegulationV1Input.subjectIds) && - Objects.equals(this.collection, createCloudSourceRegulationV1Input.collection); - } - - @Override - public int hashCode() { - return Objects.hash(regulationType, subjectType, subjectIds, collection); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateCloudSourceRegulationV1Input {\n"); - sb.append(" regulationType: ").append(toIndentedString(regulationType)).append("\n"); - sb.append(" subjectType: ").append(toIndentedString(subjectType)).append("\n"); - sb.append(" subjectIds: ").append(toIndentedString(subjectIds)).append("\n"); - sb.append(" collection: ").append(toIndentedString(collection)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + @Override + public int hashCode() { + return Objects.hash(regulationType, subjectType, subjectIds, collection); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("regulationType"); - openapiFields.add("subjectType"); - openapiFields.add("subjectIds"); - openapiFields.add("collection"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("regulationType"); - openapiRequiredFields.add("collection"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateCloudSourceRegulationV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateCloudSourceRegulationV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCloudSourceRegulationV1Input is not found in the empty JSON string", CreateCloudSourceRegulationV1Input.openapiRequiredFields.toString())); + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCloudSourceRegulationV1Input {\n"); + sb.append(" regulationType: ").append(toIndentedString(regulationType)).append("\n"); + sb.append(" subjectType: ").append(toIndentedString(subjectType)).append("\n"); + sb.append(" subjectIds: ").append(toIndentedString(subjectIds)).append("\n"); + sb.append(" collection: ").append(toIndentedString(collection)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("regulationType"); + openapiFields.add("subjectType"); + openapiFields.add("subjectIds"); + openapiFields.add("collection"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("regulationType"); + openapiRequiredFields.add("subjectType"); + openapiRequiredFields.add("subjectIds"); + openapiRequiredFields.add("collection"); + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateCloudSourceRegulationV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCloudSourceRegulationV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateCloudSourceRegulationV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCloudSourceRegulationV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateCloudSourceRegulationV1Input is" + + " not found in the empty JSON string", + CreateCloudSourceRegulationV1Input.openapiRequiredFields + .toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateCloudSourceRegulationV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCloudSourceRegulationV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateCloudSourceRegulationV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCloudSourceRegulationV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("regulationType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `regulationType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("regulationType").toString())); + } + if (!jsonObj.get("subjectType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `subjectType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("subjectType").toString())); + } + // ensure the required json array is present + if (jsonObj.get("subjectIds") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("subjectIds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `subjectIds` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("subjectIds").toString())); + } + if (!jsonObj.get("collection").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collection` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("collection").toString())); } - } - if (!jsonObj.get("regulationType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `regulationType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("regulationType").toString())); - } - if ((jsonObj.get("subjectType") != null && !jsonObj.get("subjectType").isJsonNull()) && !jsonObj.get("subjectType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `subjectType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subjectType").toString())); - } - // ensure the optional json data is an array if present - if (jsonObj.get("subjectIds") != null && !jsonObj.get("subjectIds").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `subjectIds` to be an array in the JSON string but got `%s`", jsonObj.get("subjectIds").toString())); - } - if (!jsonObj.get("collection").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `collection` to be a primitive type in the JSON string but got `%s`", jsonObj.get("collection").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateCloudSourceRegulationV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateCloudSourceRegulationV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateCloudSourceRegulationV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateCloudSourceRegulationV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateCloudSourceRegulationV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateCloudSourceRegulationV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateCloudSourceRegulationV1Input - * @throws IOException if the JSON string is invalid with respect to CreateCloudSourceRegulationV1Input - */ - public static CreateCloudSourceRegulationV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateCloudSourceRegulationV1Input.class); - } - - /** - * Convert an instance of CreateCloudSourceRegulationV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCloudSourceRegulationV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCloudSourceRegulationV1Input' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateCloudSourceRegulationV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCloudSourceRegulationV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCloudSourceRegulationV1Input read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCloudSourceRegulationV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCloudSourceRegulationV1Input + * @throws IOException if the JSON string is invalid with respect to + * CreateCloudSourceRegulationV1Input + */ + public static CreateCloudSourceRegulationV1Input fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCloudSourceRegulationV1Input.class); + } + + /** + * Convert an instance of CreateCloudSourceRegulationV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateCloudSourceRegulationV1Output.java b/src/main/java/com/segment/publicapi/models/CreateCloudSourceRegulationV1Output.java index 175d13c7..f272a640 100644 --- a/src/main/java/com/segment/publicapi/models/CreateCloudSourceRegulationV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateCloudSourceRegulationV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,208 +9,207 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The output of a create Cloud Source regulation call. - */ -@ApiModel(description = "The output of a create Cloud Source regulation call.") - +/** The output of a create Cloud Source regulation call. */ public class CreateCloudSourceRegulationV1Output { - public static final String SERIALIZED_NAME_REGULATE_ID = "regulateId"; - @SerializedName(SERIALIZED_NAME_REGULATE_ID) - private String regulateId; + public static final String SERIALIZED_NAME_REGULATE_ID = "regulateId"; - public CreateCloudSourceRegulationV1Output() { - } + @SerializedName(SERIALIZED_NAME_REGULATE_ID) + private String regulateId; - public CreateCloudSourceRegulationV1Output regulateId(String regulateId) { - - this.regulateId = regulateId; - return this; - } + public CreateCloudSourceRegulationV1Output() {} - /** - * The id of the created regulation. - * @return regulateId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the created regulation.") + public CreateCloudSourceRegulationV1Output regulateId(String regulateId) { - public String getRegulateId() { - return regulateId; - } + this.regulateId = regulateId; + return this; + } + /** + * The id of the created regulation. + * + * @return regulateId + */ + @javax.annotation.Nonnull + public String getRegulateId() { + return regulateId; + } - public void setRegulateId(String regulateId) { - this.regulateId = regulateId; - } + public void setRegulateId(String regulateId) { + this.regulateId = regulateId; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCloudSourceRegulationV1Output createCloudSourceRegulationV1Output = + (CreateCloudSourceRegulationV1Output) o; + return Objects.equals(this.regulateId, createCloudSourceRegulationV1Output.regulateId); + } + @Override + public int hashCode() { + return Objects.hash(regulateId); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCloudSourceRegulationV1Output {\n"); + sb.append(" regulateId: ").append(toIndentedString(regulateId)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateCloudSourceRegulationV1Output createCloudSourceRegulationV1Output = (CreateCloudSourceRegulationV1Output) o; - return Objects.equals(this.regulateId, createCloudSourceRegulationV1Output.regulateId); - } - - @Override - public int hashCode() { - return Objects.hash(regulateId); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateCloudSourceRegulationV1Output {\n"); - sb.append(" regulateId: ").append(toIndentedString(regulateId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("regulateId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("regulateId"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("regulateId"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("regulateId"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateCloudSourceRegulationV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateCloudSourceRegulationV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCloudSourceRegulationV1Output is not found in the empty JSON string", CreateCloudSourceRegulationV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateCloudSourceRegulationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCloudSourceRegulationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateCloudSourceRegulationV1Output is" + + " not found in the empty JSON string", + CreateCloudSourceRegulationV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateCloudSourceRegulationV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCloudSourceRegulationV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCloudSourceRegulationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateCloudSourceRegulationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateCloudSourceRegulationV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCloudSourceRegulationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("regulateId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `regulateId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("regulateId").toString())); } - } - if (!jsonObj.get("regulateId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `regulateId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("regulateId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateCloudSourceRegulationV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateCloudSourceRegulationV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateCloudSourceRegulationV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateCloudSourceRegulationV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateCloudSourceRegulationV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateCloudSourceRegulationV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateCloudSourceRegulationV1Output - * @throws IOException if the JSON string is invalid with respect to CreateCloudSourceRegulationV1Output - */ - public static CreateCloudSourceRegulationV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateCloudSourceRegulationV1Output.class); - } - - /** - * Convert an instance of CreateCloudSourceRegulationV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCloudSourceRegulationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCloudSourceRegulationV1Output' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateCloudSourceRegulationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCloudSourceRegulationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCloudSourceRegulationV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCloudSourceRegulationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCloudSourceRegulationV1Output + * @throws IOException if the JSON string is invalid with respect to + * CreateCloudSourceRegulationV1Output + */ + public static CreateCloudSourceRegulationV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCloudSourceRegulationV1Output.class); + } + + /** + * Convert an instance of CreateCloudSourceRegulationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateComputedTrait200Response.java b/src/main/java/com/segment/publicapi/models/CreateComputedTrait200Response.java new file mode 100644 index 00000000..4750d6aa --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateComputedTrait200Response.java @@ -0,0 +1,199 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateComputedTrait200Response */ +public class CreateComputedTrait200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateComputedTraitAlphaOutput data; + + public CreateComputedTrait200Response() {} + + public CreateComputedTrait200Response data(CreateComputedTraitAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateComputedTraitAlphaOutput getData() { + return data; + } + + public void setData(CreateComputedTraitAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateComputedTrait200Response createComputedTrait200Response = + (CreateComputedTrait200Response) o; + return Objects.equals(this.data, createComputedTrait200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateComputedTrait200Response {\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 + * CreateComputedTrait200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateComputedTrait200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateComputedTrait200Response is not" + + " found in the empty JSON string", + CreateComputedTrait200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateComputedTrait200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateComputedTrait200Response` 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()) { + CreateComputedTraitAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateComputedTrait200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateComputedTrait200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateComputedTrait200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateComputedTrait200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateComputedTrait200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateComputedTrait200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateComputedTrait200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateComputedTrait200Response + */ + public static CreateComputedTrait200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateComputedTrait200Response.class); + } + + /** + * Convert an instance of CreateComputedTrait200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateComputedTraitAlphaInput.java b/src/main/java/com/segment/publicapi/models/CreateComputedTraitAlphaInput.java new file mode 100644 index 00000000..ad2f23c7 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateComputedTraitAlphaInput.java @@ -0,0 +1,340 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Input to create a trait. */ +public class CreateComputedTraitAlphaInput { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + + @SerializedName(SERIALIZED_NAME_DEFINITION) + private TraitDefinition definition; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + + @SerializedName(SERIALIZED_NAME_OPTIONS) + private TraitOptions options; + + public CreateComputedTraitAlphaInput() {} + + public CreateComputedTraitAlphaInput name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the computation. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreateComputedTraitAlphaInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Determines whether a computation is enabled. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public CreateComputedTraitAlphaInput description(String description) { + + this.description = description; + return this; + } + + /** + * The description of the computation. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CreateComputedTraitAlphaInput definition(TraitDefinition definition) { + + this.definition = definition; + return this; + } + + /** + * Get definition + * + * @return definition + */ + @javax.annotation.Nonnull + public TraitDefinition getDefinition() { + return definition; + } + + public void setDefinition(TraitDefinition definition) { + this.definition = definition; + } + + public CreateComputedTraitAlphaInput options(TraitOptions options) { + + this.options = options; + return this; + } + + /** + * Get options + * + * @return options + */ + @javax.annotation.Nullable + public TraitOptions getOptions() { + return options; + } + + public void setOptions(TraitOptions options) { + this.options = options; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateComputedTraitAlphaInput createComputedTraitAlphaInput = + (CreateComputedTraitAlphaInput) o; + return Objects.equals(this.name, createComputedTraitAlphaInput.name) + && Objects.equals(this.enabled, createComputedTraitAlphaInput.enabled) + && Objects.equals(this.description, createComputedTraitAlphaInput.description) + && Objects.equals(this.definition, createComputedTraitAlphaInput.definition) + && Objects.equals(this.options, createComputedTraitAlphaInput.options); + } + + @Override + public int hashCode() { + return Objects.hash(name, enabled, description, definition, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateComputedTraitAlphaInput {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("enabled"); + openapiFields.add("description"); + openapiFields.add("definition"); + openapiFields.add("options"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("definition"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateComputedTraitAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateComputedTraitAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateComputedTraitAlphaInput is not" + + " found in the empty JSON string", + CreateComputedTraitAlphaInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateComputedTraitAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateComputedTraitAlphaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateComputedTraitAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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())); + } + // validate the required field `definition` + TraitDefinition.validateJsonElement(jsonObj.get("definition")); + // validate the optional field `options` + if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull()) { + TraitOptions.validateJsonElement(jsonObj.get("options")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateComputedTraitAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateComputedTraitAlphaInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateComputedTraitAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateComputedTraitAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateComputedTraitAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateComputedTraitAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateComputedTraitAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * CreateComputedTraitAlphaInput + */ + public static CreateComputedTraitAlphaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateComputedTraitAlphaInput.class); + } + + /** + * Convert an instance of CreateComputedTraitAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateComputedTraitAlphaOutput.java b/src/main/java/com/segment/publicapi/models/CreateComputedTraitAlphaOutput.java new file mode 100644 index 00000000..2e4cf1b3 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateComputedTraitAlphaOutput.java @@ -0,0 +1,208 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Computed Trait output for create. */ +public class CreateComputedTraitAlphaOutput { + public static final String SERIALIZED_NAME_COMPUTED_TRAIT = "computedTrait"; + + @SerializedName(SERIALIZED_NAME_COMPUTED_TRAIT) + private ComputedTraitSummary computedTrait; + + public CreateComputedTraitAlphaOutput() {} + + public CreateComputedTraitAlphaOutput computedTrait(ComputedTraitSummary computedTrait) { + + this.computedTrait = computedTrait; + return this; + } + + /** + * Get computedTrait + * + * @return computedTrait + */ + @javax.annotation.Nonnull + public ComputedTraitSummary getComputedTrait() { + return computedTrait; + } + + public void setComputedTrait(ComputedTraitSummary computedTrait) { + this.computedTrait = computedTrait; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateComputedTraitAlphaOutput createComputedTraitAlphaOutput = + (CreateComputedTraitAlphaOutput) o; + return Objects.equals(this.computedTrait, createComputedTraitAlphaOutput.computedTrait); + } + + @Override + public int hashCode() { + return Objects.hash(computedTrait); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateComputedTraitAlphaOutput {\n"); + sb.append(" computedTrait: ").append(toIndentedString(computedTrait)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("computedTrait"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("computedTrait"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateComputedTraitAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateComputedTraitAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateComputedTraitAlphaOutput is not" + + " found in the empty JSON string", + CreateComputedTraitAlphaOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateComputedTraitAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateComputedTraitAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateComputedTraitAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `computedTrait` + ComputedTraitSummary.validateJsonElement(jsonObj.get("computedTrait")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateComputedTraitAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateComputedTraitAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateComputedTraitAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateComputedTraitAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateComputedTraitAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateComputedTraitAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateComputedTraitAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * CreateComputedTraitAlphaOutput + */ + public static CreateComputedTraitAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateComputedTraitAlphaOutput.class); + } + + /** + * Convert an instance of CreateComputedTraitAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateDbtModelSyncTrigger200Response.java b/src/main/java/com/segment/publicapi/models/CreateDbtModelSyncTrigger200Response.java new file mode 100644 index 00000000..099dc651 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateDbtModelSyncTrigger200Response.java @@ -0,0 +1,203 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateDbtModelSyncTrigger200Response */ +public class CreateDbtModelSyncTrigger200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateDbtModelSyncTriggerOutput data; + + public CreateDbtModelSyncTrigger200Response() {} + + public CreateDbtModelSyncTrigger200Response data(CreateDbtModelSyncTriggerOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateDbtModelSyncTriggerOutput getData() { + return data; + } + + public void setData(CreateDbtModelSyncTriggerOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDbtModelSyncTrigger200Response createDbtModelSyncTrigger200Response = + (CreateDbtModelSyncTrigger200Response) o; + return Objects.equals(this.data, createDbtModelSyncTrigger200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDbtModelSyncTrigger200Response {\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 + * CreateDbtModelSyncTrigger200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDbtModelSyncTrigger200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateDbtModelSyncTrigger200Response" + + " is not found in the empty JSON string", + CreateDbtModelSyncTrigger200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDbtModelSyncTrigger200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateDbtModelSyncTrigger200Response` 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()) { + CreateDbtModelSyncTriggerOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDbtModelSyncTrigger200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDbtModelSyncTrigger200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateDbtModelSyncTrigger200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CreateDbtModelSyncTrigger200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDbtModelSyncTrigger200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDbtModelSyncTrigger200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDbtModelSyncTrigger200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateDbtModelSyncTrigger200Response + */ + public static CreateDbtModelSyncTrigger200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDbtModelSyncTrigger200Response.class); + } + + /** + * Convert an instance of CreateDbtModelSyncTrigger200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateDbtModelSyncTriggerInput.java b/src/main/java/com/segment/publicapi/models/CreateDbtModelSyncTriggerInput.java new file mode 100644 index 00000000..cd58fe70 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateDbtModelSyncTriggerInput.java @@ -0,0 +1,213 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Input for the createDbtModelSyncTriggerBySourceId endpoint. */ +public class CreateDbtModelSyncTriggerInput { + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; + + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; + + public CreateDbtModelSyncTriggerInput() {} + + public CreateDbtModelSyncTriggerInput sourceId(String sourceId) { + + this.sourceId = sourceId; + return this; + } + + /** + * The Source id to trigger a dbt model sync. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDbtModelSyncTriggerInput createDbtModelSyncTriggerInput = + (CreateDbtModelSyncTriggerInput) o; + return Objects.equals(this.sourceId, createDbtModelSyncTriggerInput.sourceId); + } + + @Override + public int hashCode() { + return Objects.hash(sourceId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDbtModelSyncTriggerInput {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateDbtModelSyncTriggerInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDbtModelSyncTriggerInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateDbtModelSyncTriggerInput is not" + + " found in the empty JSON string", + CreateDbtModelSyncTriggerInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDbtModelSyncTriggerInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateDbtModelSyncTriggerInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateDbtModelSyncTriggerInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDbtModelSyncTriggerInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDbtModelSyncTriggerInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateDbtModelSyncTriggerInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateDbtModelSyncTriggerInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDbtModelSyncTriggerInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDbtModelSyncTriggerInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDbtModelSyncTriggerInput + * @throws IOException if the JSON string is invalid with respect to + * CreateDbtModelSyncTriggerInput + */ + public static CreateDbtModelSyncTriggerInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDbtModelSyncTriggerInput.class); + } + + /** + * Convert an instance of CreateDbtModelSyncTriggerInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateDbtModelSyncTriggerOutput.java b/src/main/java/com/segment/publicapi/models/CreateDbtModelSyncTriggerOutput.java new file mode 100644 index 00000000..4ce68c9b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateDbtModelSyncTriggerOutput.java @@ -0,0 +1,212 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output for the createDbtModelSyncTriggerBySourceId endpoint. */ +public class CreateDbtModelSyncTriggerOutput { + public static final String SERIALIZED_NAME_DBT_MODEL_SYNC_TRIGGER = "dbtModelSyncTrigger"; + + @SerializedName(SERIALIZED_NAME_DBT_MODEL_SYNC_TRIGGER) + private DbtModelSyncTrigger dbtModelSyncTrigger; + + public CreateDbtModelSyncTriggerOutput() {} + + public CreateDbtModelSyncTriggerOutput dbtModelSyncTrigger( + DbtModelSyncTrigger dbtModelSyncTrigger) { + + this.dbtModelSyncTrigger = dbtModelSyncTrigger; + return this; + } + + /** + * Get dbtModelSyncTrigger + * + * @return dbtModelSyncTrigger + */ + @javax.annotation.Nonnull + public DbtModelSyncTrigger getDbtModelSyncTrigger() { + return dbtModelSyncTrigger; + } + + public void setDbtModelSyncTrigger(DbtModelSyncTrigger dbtModelSyncTrigger) { + this.dbtModelSyncTrigger = dbtModelSyncTrigger; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDbtModelSyncTriggerOutput createDbtModelSyncTriggerOutput = + (CreateDbtModelSyncTriggerOutput) o; + return Objects.equals( + this.dbtModelSyncTrigger, createDbtModelSyncTriggerOutput.dbtModelSyncTrigger); + } + + @Override + public int hashCode() { + return Objects.hash(dbtModelSyncTrigger); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDbtModelSyncTriggerOutput {\n"); + sb.append(" dbtModelSyncTrigger: ") + .append(toIndentedString(dbtModelSyncTrigger)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dbtModelSyncTrigger"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("dbtModelSyncTrigger"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateDbtModelSyncTriggerOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDbtModelSyncTriggerOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateDbtModelSyncTriggerOutput is not" + + " found in the empty JSON string", + CreateDbtModelSyncTriggerOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDbtModelSyncTriggerOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateDbtModelSyncTriggerOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateDbtModelSyncTriggerOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `dbtModelSyncTrigger` + DbtModelSyncTrigger.validateJsonElement(jsonObj.get("dbtModelSyncTrigger")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDbtModelSyncTriggerOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDbtModelSyncTriggerOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateDbtModelSyncTriggerOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateDbtModelSyncTriggerOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDbtModelSyncTriggerOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDbtModelSyncTriggerOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDbtModelSyncTriggerOutput + * @throws IOException if the JSON string is invalid with respect to + * CreateDbtModelSyncTriggerOutput + */ + public static CreateDbtModelSyncTriggerOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDbtModelSyncTriggerOutput.class); + } + + /** + * Convert an instance of CreateDbtModelSyncTriggerOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateDestination200Response.java b/src/main/java/com/segment/publicapi/models/CreateDestination200Response.java index 6599162c..b0b74587 100644 --- a/src/main/java/com/segment/publicapi/models/CreateDestination200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateDestination200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,190 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateDestinationV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateDestination200Response - */ - +/** CreateDestination200Response */ public class CreateDestination200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateDestinationV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateDestination200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateDestinationV1Output data; - public CreateDestination200Response data(CreateDestinationV1Output data) { - - this.data = data; - return this; - } + public CreateDestination200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateDestination200Response data(CreateDestinationV1Output data) { - public CreateDestinationV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateDestinationV1Output getData() { + return data; + } - public void setData(CreateDestinationV1Output data) { - this.data = data; - } + public void setData(CreateDestinationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDestination200Response createDestination200Response = + (CreateDestination200Response) o; + return Objects.equals(this.data, createDestination200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDestination200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateDestination200Response createDestination200Response = (CreateDestination200Response) o; - return Objects.equals(this.data, createDestination200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateDestination200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateDestination200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateDestination200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateDestination200Response is not found in the empty JSON string", CreateDestination200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateDestination200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDestination200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateDestination200Response is not" + + " found in the empty JSON string", + CreateDestination200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateDestination200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateDestination200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDestination200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateDestination200Response` 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()) { + CreateDestinationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateDestination200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateDestination200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateDestination200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateDestination200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateDestination200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDestination200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDestination200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateDestination200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateDestination200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDestination200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDestination200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDestination200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateDestination200Response + */ + public static CreateDestination200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDestination200Response.class); } - } - - /** - * Create an instance of CreateDestination200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateDestination200Response - * @throws IOException if the JSON string is invalid with respect to CreateDestination200Response - */ - public static CreateDestination200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateDestination200Response.class); - } - - /** - * Convert an instance of CreateDestination200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateDestination200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateDestinationSubscription200Response.java b/src/main/java/com/segment/publicapi/models/CreateDestinationSubscription200Response.java index 9877a221..115a2229 100644 --- a/src/main/java/com/segment/publicapi/models/CreateDestinationSubscription200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateDestinationSubscription200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,198 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateDestinationSubscriptionAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateDestinationSubscription200Response - */ - +/** CreateDestinationSubscription200Response */ public class CreateDestinationSubscription200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateDestinationSubscriptionAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateDestinationSubscription200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateDestinationSubscriptionAlphaOutput data; - public CreateDestinationSubscription200Response data(CreateDestinationSubscriptionAlphaOutput data) { - - this.data = data; - return this; - } + public CreateDestinationSubscription200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateDestinationSubscription200Response data( + CreateDestinationSubscriptionAlphaOutput data) { - public CreateDestinationSubscriptionAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateDestinationSubscriptionAlphaOutput getData() { + return data; + } - public void setData(CreateDestinationSubscriptionAlphaOutput data) { - this.data = data; - } + public void setData(CreateDestinationSubscriptionAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDestinationSubscription200Response createDestinationSubscription200Response = + (CreateDestinationSubscription200Response) o; + return Objects.equals(this.data, createDestinationSubscription200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDestinationSubscription200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateDestinationSubscription200Response createDestinationSubscription200Response = (CreateDestinationSubscription200Response) o; - return Objects.equals(this.data, createDestinationSubscription200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateDestinationSubscription200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateDestinationSubscription200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateDestinationSubscription200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateDestinationSubscription200Response is not found in the empty JSON string", CreateDestinationSubscription200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateDestinationSubscription200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDestinationSubscription200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " CreateDestinationSubscription200Response is not found in" + + " the empty JSON string", + CreateDestinationSubscription200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateDestinationSubscription200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateDestinationSubscription200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDestinationSubscription200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateDestinationSubscription200Response` 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()) { + CreateDestinationSubscriptionAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateDestinationSubscription200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateDestinationSubscription200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateDestinationSubscription200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateDestinationSubscription200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateDestinationSubscription200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDestinationSubscription200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'CreateDestinationSubscription200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateDestinationSubscription200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CreateDestinationSubscription200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDestinationSubscription200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDestinationSubscription200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDestinationSubscription200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateDestinationSubscription200Response + */ + public static CreateDestinationSubscription200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDestinationSubscription200Response.class); } - } - - /** - * Create an instance of CreateDestinationSubscription200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateDestinationSubscription200Response - * @throws IOException if the JSON string is invalid with respect to CreateDestinationSubscription200Response - */ - public static CreateDestinationSubscription200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateDestinationSubscription200Response.class); - } - - /** - * Convert an instance of CreateDestinationSubscription200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateDestinationSubscription200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateDestinationSubscriptionAlphaInput.java b/src/main/java/com/segment/publicapi/models/CreateDestinationSubscriptionAlphaInput.java index 8a6fece9..15829204 100644 --- a/src/main/java/com/segment/publicapi/models/CreateDestinationSubscriptionAlphaInput.java +++ b/src/main/java/com/segment/publicapi/models/CreateDestinationSubscriptionAlphaInput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,338 +9,386 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** The basic input parameters for creating a Destination subscription. */ +public class CreateDestinationSubscriptionAlphaInput { + public static final String SERIALIZED_NAME_NAME = "name"; -/** - * The basic input parameters for creating a Destination subscription. - */ -@ApiModel(description = "The basic input parameters for creating a Destination subscription.") + @SerializedName(SERIALIZED_NAME_NAME) + private String name; -public class CreateDestinationSubscriptionAlphaInput { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_ACTION_ID = "actionId"; - @SerializedName(SERIALIZED_NAME_ACTION_ID) - private String actionId; - - public static final String SERIALIZED_NAME_TRIGGER = "trigger"; - @SerializedName(SERIALIZED_NAME_TRIGGER) - private String trigger; + public static final String SERIALIZED_NAME_ACTION_ID = "actionId"; - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + @SerializedName(SERIALIZED_NAME_ACTION_ID) + private String actionId; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; + public static final String SERIALIZED_NAME_TRIGGER = "trigger"; - public CreateDestinationSubscriptionAlphaInput() { - } + @SerializedName(SERIALIZED_NAME_TRIGGER) + private String trigger; - public CreateDestinationSubscriptionAlphaInput name(String name) { - - this.name = name; - return this; - } + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - /** - * A user-defined name for the subscription. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A user-defined name for the subscription.") + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public String getName() { - return name; - } + public static final String SERIALIZED_NAME_SETTINGS = "settings"; + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; - public void setName(String name) { - this.name = name; - } + public static final String SERIALIZED_NAME_MODEL_ID = "modelId"; + @SerializedName(SERIALIZED_NAME_MODEL_ID) + private String modelId; - public CreateDestinationSubscriptionAlphaInput actionId(String actionId) { - - this.actionId = actionId; - return this; - } + public CreateDestinationSubscriptionAlphaInput() {} - /** - * The associated action id the subscription should trigger. - * @return actionId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The associated action id the subscription should trigger.") + public CreateDestinationSubscriptionAlphaInput name(String name) { - public String getActionId() { - return actionId; - } + this.name = name; + return this; + } + /** + * A user-defined name for the subscription. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public void setActionId(String actionId) { - this.actionId = actionId; - } + public void setName(String name) { + this.name = name; + } + public CreateDestinationSubscriptionAlphaInput actionId(String actionId) { - public CreateDestinationSubscriptionAlphaInput trigger(String trigger) { - - this.trigger = trigger; - return this; - } + this.actionId = actionId; + return this; + } - /** - * The FQL statement. - * @return trigger - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The FQL statement.") + /** + * The associated action id the subscription should trigger. + * + * @return actionId + */ + @javax.annotation.Nonnull + public String getActionId() { + return actionId; + } - public String getTrigger() { - return trigger; - } + public void setActionId(String actionId) { + this.actionId = actionId; + } + + public CreateDestinationSubscriptionAlphaInput trigger(String trigger) { + + this.trigger = trigger; + return this; + } + /** + * The FQL statement. + * + * @return trigger + */ + @javax.annotation.Nonnull + public String getTrigger() { + return trigger; + } + + public void setTrigger(String trigger) { + this.trigger = trigger; + } - public void setTrigger(String trigger) { - this.trigger = trigger; - } + public CreateDestinationSubscriptionAlphaInput enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } - public CreateDestinationSubscriptionAlphaInput enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + /** + * Is the subscription enabled. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } - /** - * Is the subscription enabled. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Is the subscription enabled.") + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public Boolean getEnabled() { - return enabled; - } + public CreateDestinationSubscriptionAlphaInput settings(Map settings) { + this.settings = settings; + return this; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public CreateDestinationSubscriptionAlphaInput putSettingsItem( + String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + /** + * Represents settings used to configure an action subscription. + * + * @return settings + */ + @javax.annotation.Nullable + public Map getSettings() { + return settings; + } - public CreateDestinationSubscriptionAlphaInput settings(Map settings) { - - this.settings = settings; - return this; - } + public void setSettings(Map settings) { + this.settings = settings; + } - /** - * The fields used for configuring this action. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The fields used for configuring this action.") + public CreateDestinationSubscriptionAlphaInput modelId(String modelId) { - public Map getSettings() { - return settings; - } + this.modelId = modelId; + return this; + } + /** + * When creating a Reverse ETL connection, indicates the Model being used to extract data. + * + * @return modelId + */ + @javax.annotation.Nullable + public String getModelId() { + return modelId; + } - public void setSettings(Map settings) { - this.settings = settings; - } + public void setModelId(String modelId) { + this.modelId = modelId; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput = + (CreateDestinationSubscriptionAlphaInput) o; + return Objects.equals(this.name, createDestinationSubscriptionAlphaInput.name) + && Objects.equals(this.actionId, createDestinationSubscriptionAlphaInput.actionId) + && Objects.equals(this.trigger, createDestinationSubscriptionAlphaInput.trigger) + && Objects.equals(this.enabled, createDestinationSubscriptionAlphaInput.enabled) + && Objects.equals(this.settings, createDestinationSubscriptionAlphaInput.settings) + && Objects.equals(this.modelId, createDestinationSubscriptionAlphaInput.modelId); + } + @Override + public int hashCode() { + return Objects.hash(name, actionId, trigger, enabled, settings, modelId); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDestinationSubscriptionAlphaInput {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" actionId: ").append(toIndentedString(actionId)).append("\n"); + sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" modelId: ").append(toIndentedString(modelId)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateDestinationSubscriptionAlphaInput createDestinationSubscriptionAlphaInput = (CreateDestinationSubscriptionAlphaInput) o; - return Objects.equals(this.name, createDestinationSubscriptionAlphaInput.name) && - Objects.equals(this.actionId, createDestinationSubscriptionAlphaInput.actionId) && - Objects.equals(this.trigger, createDestinationSubscriptionAlphaInput.trigger) && - Objects.equals(this.enabled, createDestinationSubscriptionAlphaInput.enabled) && - Objects.equals(this.settings, createDestinationSubscriptionAlphaInput.settings); - } - - @Override - public int hashCode() { - return Objects.hash(name, actionId, trigger, enabled, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateDestinationSubscriptionAlphaInput {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" actionId: ").append(toIndentedString(actionId)).append("\n"); - sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("actionId"); + openapiFields.add("trigger"); + openapiFields.add("enabled"); + openapiFields.add("settings"); + openapiFields.add("modelId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("actionId"); + openapiRequiredFields.add("trigger"); + openapiRequiredFields.add("enabled"); } - return o.toString().replace("\n", "\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("actionId"); - openapiFields.add("trigger"); - openapiFields.add("enabled"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("actionId"); - openapiRequiredFields.add("trigger"); - openapiRequiredFields.add("enabled"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateDestinationSubscriptionAlphaInput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateDestinationSubscriptionAlphaInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateDestinationSubscriptionAlphaInput is not found in the empty JSON string", CreateDestinationSubscriptionAlphaInput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateDestinationSubscriptionAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDestinationSubscriptionAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " CreateDestinationSubscriptionAlphaInput is not found in the" + + " empty JSON string", + CreateDestinationSubscriptionAlphaInput.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateDestinationSubscriptionAlphaInput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateDestinationSubscriptionAlphaInput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDestinationSubscriptionAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateDestinationSubscriptionAlphaInput` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateDestinationSubscriptionAlphaInput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateDestinationSubscriptionAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("actionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `actionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("actionId").toString())); + } + if (!jsonObj.get("trigger").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `trigger` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("trigger").toString())); + } + if ((jsonObj.get("modelId") != null && !jsonObj.get("modelId").isJsonNull()) + && !jsonObj.get("modelId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `modelId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("modelId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDestinationSubscriptionAlphaInput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'CreateDestinationSubscriptionAlphaInput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateDestinationSubscriptionAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CreateDestinationSubscriptionAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDestinationSubscriptionAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("actionId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `actionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actionId").toString())); - } - if (!jsonObj.get("trigger").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `trigger` to be a primitive type in the JSON string but got `%s`", jsonObj.get("trigger").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateDestinationSubscriptionAlphaInput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateDestinationSubscriptionAlphaInput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateDestinationSubscriptionAlphaInput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateDestinationSubscriptionAlphaInput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateDestinationSubscriptionAlphaInput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateDestinationSubscriptionAlphaInput given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateDestinationSubscriptionAlphaInput - * @throws IOException if the JSON string is invalid with respect to CreateDestinationSubscriptionAlphaInput - */ - public static CreateDestinationSubscriptionAlphaInput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateDestinationSubscriptionAlphaInput.class); - } - - /** - * Convert an instance of CreateDestinationSubscriptionAlphaInput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of CreateDestinationSubscriptionAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDestinationSubscriptionAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * CreateDestinationSubscriptionAlphaInput + */ + public static CreateDestinationSubscriptionAlphaInput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDestinationSubscriptionAlphaInput.class); + } + + /** + * Convert an instance of CreateDestinationSubscriptionAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateDestinationSubscriptionAlphaOutput.java b/src/main/java/com/segment/publicapi/models/CreateDestinationSubscriptionAlphaOutput.java index 4681d4df..fb96df89 100644 --- a/src/main/java/com/segment/publicapi/models/CreateDestinationSubscriptionAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/CreateDestinationSubscriptionAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,212 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DestinationSubscription; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a newly created Destination subscription. - */ -@ApiModel(description = "Returns a newly created Destination subscription.") - +/** Returns a newly created Destination subscription. */ public class CreateDestinationSubscriptionAlphaOutput { - public static final String SERIALIZED_NAME_DESTINATION_SUBSCRIPTION = "destinationSubscription"; - @SerializedName(SERIALIZED_NAME_DESTINATION_SUBSCRIPTION) - private DestinationSubscription destinationSubscription; + public static final String SERIALIZED_NAME_DESTINATION_SUBSCRIPTION = "destinationSubscription"; - public CreateDestinationSubscriptionAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_DESTINATION_SUBSCRIPTION) + private DestinationSubscription destinationSubscription; - public CreateDestinationSubscriptionAlphaOutput destinationSubscription(DestinationSubscription destinationSubscription) { - - this.destinationSubscription = destinationSubscription; - return this; - } + public CreateDestinationSubscriptionAlphaOutput() {} - /** - * Get destinationSubscription - * @return destinationSubscription - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateDestinationSubscriptionAlphaOutput destinationSubscription( + DestinationSubscription destinationSubscription) { - public DestinationSubscription getDestinationSubscription() { - return destinationSubscription; - } + this.destinationSubscription = destinationSubscription; + return this; + } + /** + * Get destinationSubscription + * + * @return destinationSubscription + */ + @javax.annotation.Nonnull + public DestinationSubscription getDestinationSubscription() { + return destinationSubscription; + } - public void setDestinationSubscription(DestinationSubscription destinationSubscription) { - this.destinationSubscription = destinationSubscription; - } + public void setDestinationSubscription(DestinationSubscription destinationSubscription) { + this.destinationSubscription = destinationSubscription; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDestinationSubscriptionAlphaOutput createDestinationSubscriptionAlphaOutput = + (CreateDestinationSubscriptionAlphaOutput) o; + return Objects.equals( + this.destinationSubscription, + createDestinationSubscriptionAlphaOutput.destinationSubscription); + } + @Override + public int hashCode() { + return Objects.hash(destinationSubscription); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDestinationSubscriptionAlphaOutput {\n"); + sb.append(" destinationSubscription: ") + .append(toIndentedString(destinationSubscription)) + .append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateDestinationSubscriptionAlphaOutput createDestinationSubscriptionAlphaOutput = (CreateDestinationSubscriptionAlphaOutput) o; - return Objects.equals(this.destinationSubscription, createDestinationSubscriptionAlphaOutput.destinationSubscription); - } - - @Override - public int hashCode() { - return Objects.hash(destinationSubscription); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateDestinationSubscriptionAlphaOutput {\n"); - sb.append(" destinationSubscription: ").append(toIndentedString(destinationSubscription)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("destinationSubscription"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("destinationSubscription"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("destinationSubscription"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("destinationSubscription"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateDestinationSubscriptionAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateDestinationSubscriptionAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateDestinationSubscriptionAlphaOutput is not found in the empty JSON string", CreateDestinationSubscriptionAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateDestinationSubscriptionAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDestinationSubscriptionAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " CreateDestinationSubscriptionAlphaOutput is not found in" + + " the empty JSON string", + CreateDestinationSubscriptionAlphaOutput.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateDestinationSubscriptionAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateDestinationSubscriptionAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDestinationSubscriptionAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateDestinationSubscriptionAlphaOutput` properties." + + " JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateDestinationSubscriptionAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + CreateDestinationSubscriptionAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `destinationSubscription` + DestinationSubscription.validateJsonElement(jsonObj.get("destinationSubscription")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateDestinationSubscriptionAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateDestinationSubscriptionAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateDestinationSubscriptionAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateDestinationSubscriptionAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateDestinationSubscriptionAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDestinationSubscriptionAlphaOutput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'CreateDestinationSubscriptionAlphaOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateDestinationSubscriptionAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CreateDestinationSubscriptionAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDestinationSubscriptionAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDestinationSubscriptionAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDestinationSubscriptionAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * CreateDestinationSubscriptionAlphaOutput + */ + public static CreateDestinationSubscriptionAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDestinationSubscriptionAlphaOutput.class); } - } - - /** - * Create an instance of CreateDestinationSubscriptionAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateDestinationSubscriptionAlphaOutput - * @throws IOException if the JSON string is invalid with respect to CreateDestinationSubscriptionAlphaOutput - */ - public static CreateDestinationSubscriptionAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateDestinationSubscriptionAlphaOutput.class); - } - - /** - * Convert an instance of CreateDestinationSubscriptionAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateDestinationSubscriptionAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateDestinationV1Input.java b/src/main/java/com/segment/publicapi/models/CreateDestinationV1Input.java index 9f950dce..05924763 100644 --- a/src/main/java/com/segment/publicapi/models/CreateDestinationV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateDestinationV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,343 +9,342 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.HashMap; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Creates a new Destination. - */ -@ApiModel(description = "Creates a new Destination.") - +/** Creates a new Destination. */ public class CreateDestinationV1Input { - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_METADATA_ID = "metadataId"; - @SerializedName(SERIALIZED_NAME_METADATA_ID) - private String metadataId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings = new HashMap<>(); + public static final String SERIALIZED_NAME_METADATA_ID = "metadataId"; - public CreateDestinationV1Input() { - } + @SerializedName(SERIALIZED_NAME_METADATA_ID) + private String metadataId; - public CreateDestinationV1Input sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - /** - * The id of the Source to connect to this Destination instance. Config API note: analogous to `parent`. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source to connect to this Destination instance. Config API note: analogous to `parent`.") - - public String getSourceId() { - return sourceId; - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + public static final String SERIALIZED_NAME_NAME = "name"; - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - public CreateDestinationV1Input metadataId(String metadataId) { - - this.metadataId = metadataId; - return this; - } + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings = new HashMap<>(); - /** - * The id of the metadata to link to the new Destination. - * @return metadataId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the metadata to link to the new Destination.") + public CreateDestinationV1Input() {} - public String getMetadataId() { - return metadataId; - } + public CreateDestinationV1Input sourceId(String sourceId) { + this.sourceId = sourceId; + return this; + } - public void setMetadataId(String metadataId) { - this.metadataId = metadataId; - } - + /** + * The id of the Source to connect to this Destination instance. Config API note: analogous to + * `parent`. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } - public CreateDestinationV1Input enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } - /** - * Whether this Destination should receive data. - * @return enabled - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination should receive data.") + public CreateDestinationV1Input metadataId(String metadataId) { - public Boolean getEnabled() { - return enabled; - } + this.metadataId = metadataId; + return this; + } + /** + * The id of the metadata to link to the new Destination. + * + * @return metadataId + */ + @javax.annotation.Nonnull + public String getMetadataId() { + return metadataId; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public void setMetadataId(String metadataId) { + this.metadataId = metadataId; + } + public CreateDestinationV1Input enabled(Boolean enabled) { - public CreateDestinationV1Input name(String name) { - - this.name = name; - return this; - } + this.enabled = enabled; + return this; + } - /** - * Defines the display name of the Destination. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Defines the display name of the Destination. Config API note: equal to `displayName`.") + /** + * Whether this Destination should receive data. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } - public String getName() { - return name; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + public CreateDestinationV1Input name(String name) { - public void setName(String name) { - this.name = name; - } + this.name = name; + return this; + } + /** + * Defines the display name of the Destination. Config API note: equal to + * `displayName`. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - public CreateDestinationV1Input settings(Map settings) { - - this.settings = settings; - return this; - } + public void setName(String name) { + this.name = name; + } - public CreateDestinationV1Input putSettingsItem(String key, Object settingsItem) { - this.settings.put(key, settingsItem); - return this; - } + public CreateDestinationV1Input settings(Map settings) { - /** - * An object that contains settings for the Destination based on the \"required\" and \"advanced\" settings present in the Destination metadata. Config API note: equal to `config`. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "An object that contains settings for the Destination based on the \"required\" and \"advanced\" settings present in the Destination metadata. Config API note: equal to `config`.") + this.settings = settings; + return this; + } - public Map getSettings() { - return settings; - } + public CreateDestinationV1Input putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + /** + * An object that contains settings for the Destination based on the \"required\" and + * \"advanced\" settings present in the Destination metadata. Config API note: equal + * to `config`. + * + * @return settings + */ + @javax.annotation.Nonnull + public Map getSettings() { + return settings; + } - public void setSettings(Map settings) { - this.settings = settings; - } + public void setSettings(Map settings) { + this.settings = settings; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDestinationV1Input createDestinationV1Input = (CreateDestinationV1Input) o; + return Objects.equals(this.sourceId, createDestinationV1Input.sourceId) + && Objects.equals(this.metadataId, createDestinationV1Input.metadataId) + && Objects.equals(this.enabled, createDestinationV1Input.enabled) + && Objects.equals(this.name, createDestinationV1Input.name) + && Objects.equals(this.settings, createDestinationV1Input.settings); + } + @Override + public int hashCode() { + return Objects.hash(sourceId, metadataId, enabled, name, settings); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDestinationV1Input {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" metadataId: ").append(toIndentedString(metadataId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateDestinationV1Input createDestinationV1Input = (CreateDestinationV1Input) o; - return Objects.equals(this.sourceId, createDestinationV1Input.sourceId) && - Objects.equals(this.metadataId, createDestinationV1Input.metadataId) && - Objects.equals(this.enabled, createDestinationV1Input.enabled) && - Objects.equals(this.name, createDestinationV1Input.name) && - Objects.equals(this.settings, createDestinationV1Input.settings); - } - - @Override - public int hashCode() { - return Objects.hash(sourceId, metadataId, enabled, name, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateDestinationV1Input {\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" metadataId: ").append(toIndentedString(metadataId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + openapiFields.add("metadataId"); + openapiFields.add("enabled"); + openapiFields.add("name"); + openapiFields.add("settings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("metadataId"); + openapiRequiredFields.add("settings"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourceId"); - openapiFields.add("metadataId"); - openapiFields.add("enabled"); - openapiFields.add("name"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("metadataId"); - openapiRequiredFields.add("settings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateDestinationV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateDestinationV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateDestinationV1Input is not found in the empty JSON string", CreateDestinationV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateDestinationV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDestinationV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateDestinationV1Input is not found" + + " in the empty JSON string", + CreateDestinationV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateDestinationV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateDestinationV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDestinationV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateDestinationV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateDestinationV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateDestinationV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if (!jsonObj.get("metadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `metadataId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("metadataId").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("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("metadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `metadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metadataId").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 (!CreateDestinationV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateDestinationV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateDestinationV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateDestinationV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateDestinationV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateDestinationV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateDestinationV1Input - * @throws IOException if the JSON string is invalid with respect to CreateDestinationV1Input - */ - public static CreateDestinationV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateDestinationV1Input.class); - } - - /** - * Convert an instance of CreateDestinationV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDestinationV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDestinationV1Input' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateDestinationV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateDestinationV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDestinationV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDestinationV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDestinationV1Input + * @throws IOException if the JSON string is invalid with respect to CreateDestinationV1Input + */ + public static CreateDestinationV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDestinationV1Input.class); + } + + /** + * Convert an instance of CreateDestinationV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateDestinationV1Output.java b/src/main/java/com/segment/publicapi/models/CreateDestinationV1Output.java index ad32f479..4554ec19 100644 --- a/src/main/java/com/segment/publicapi/models/CreateDestinationV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateDestinationV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Destination2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Creates a new Destination. - */ -@ApiModel(description = "Creates a new Destination.") - +/** Creates a new Destination. */ public class CreateDestinationV1Output { - public static final String SERIALIZED_NAME_DESTINATION = "destination"; - @SerializedName(SERIALIZED_NAME_DESTINATION) - private Destination2 destination; + public static final String SERIALIZED_NAME_DESTINATION = "destination"; - public CreateDestinationV1Output() { - } + @SerializedName(SERIALIZED_NAME_DESTINATION) + private DestinationV1 destination; - public CreateDestinationV1Output destination(Destination2 destination) { - - this.destination = destination; - return this; - } + public CreateDestinationV1Output() {} - /** - * Get destination - * @return destination - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateDestinationV1Output destination(DestinationV1 destination) { - public Destination2 getDestination() { - return destination; - } + this.destination = destination; + return this; + } + /** + * Get destination + * + * @return destination + */ + @javax.annotation.Nonnull + public DestinationV1 getDestination() { + return destination; + } - public void setDestination(Destination2 destination) { - this.destination = destination; - } + public void setDestination(DestinationV1 destination) { + this.destination = destination; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDestinationV1Output createDestinationV1Output = (CreateDestinationV1Output) o; + return Objects.equals(this.destination, createDestinationV1Output.destination); + } + @Override + public int hashCode() { + return Objects.hash(destination); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDestinationV1Output {\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateDestinationV1Output createDestinationV1Output = (CreateDestinationV1Output) o; - return Objects.equals(this.destination, createDestinationV1Output.destination); - } - - @Override - public int hashCode() { - return Objects.hash(destination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateDestinationV1Output {\n"); - sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("destination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("destination"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("destination"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("destination"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateDestinationV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateDestinationV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateDestinationV1Output is not found in the empty JSON string", CreateDestinationV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateDestinationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDestinationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateDestinationV1Output is not found" + + " in the empty JSON string", + CreateDestinationV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateDestinationV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateDestinationV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDestinationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateDestinationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateDestinationV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateDestinationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `destination` + DestinationV1.validateJsonElement(jsonObj.get("destination")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateDestinationV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateDestinationV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateDestinationV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateDestinationV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateDestinationV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDestinationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDestinationV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateDestinationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateDestinationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDestinationV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDestinationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDestinationV1Output + * @throws IOException if the JSON string is invalid with respect to CreateDestinationV1Output + */ + public static CreateDestinationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDestinationV1Output.class); } - } - - /** - * Create an instance of CreateDestinationV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateDestinationV1Output - * @throws IOException if the JSON string is invalid with respect to CreateDestinationV1Output - */ - public static CreateDestinationV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateDestinationV1Output.class); - } - - /** - * Convert an instance of CreateDestinationV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateDestinationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateDownload200Response.java b/src/main/java/com/segment/publicapi/models/CreateDownload200Response.java new file mode 100644 index 00000000..7911e721 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateDownload200Response.java @@ -0,0 +1,194 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateDownload200Response */ +public class CreateDownload200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateDownloadAlphaOutput data; + + public CreateDownload200Response() {} + + public CreateDownload200Response data(CreateDownloadAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateDownloadAlphaOutput getData() { + return data; + } + + public void setData(CreateDownloadAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDownload200Response createDownload200Response = (CreateDownload200Response) o; + return Objects.equals(this.data, createDownload200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDownload200Response {\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 CreateDownload200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDownload200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateDownload200Response is not found" + + " in the empty JSON string", + CreateDownload200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDownload200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateDownload200Response` 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()) { + CreateDownloadAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDownload200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDownload200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateDownload200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateDownload200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDownload200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDownload200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDownload200Response + * @throws IOException if the JSON string is invalid with respect to CreateDownload200Response + */ + public static CreateDownload200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDownload200Response.class); + } + + /** + * Convert an instance of CreateDownload200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateDownloadAlphaInput.java b/src/main/java/com/segment/publicapi/models/CreateDownloadAlphaInput.java new file mode 100644 index 00000000..d63c1a44 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateDownloadAlphaInput.java @@ -0,0 +1,245 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Input to create presigned URLs for Granular Observability Collection logs. */ +public class CreateDownloadAlphaInput { + public static final String SERIALIZED_NAME_COLLECTION_ID = "collectionId"; + + @SerializedName(SERIALIZED_NAME_COLLECTION_ID) + private String collectionId; + + public static final String SERIALIZED_NAME_HOUR = "hour"; + + @SerializedName(SERIALIZED_NAME_HOUR) + private String hour; + + public CreateDownloadAlphaInput() {} + + public CreateDownloadAlphaInput collectionId(String collectionId) { + + this.collectionId = collectionId; + return this; + } + + /** + * The collection's unique id. + * + * @return collectionId + */ + @javax.annotation.Nonnull + public String getCollectionId() { + return collectionId; + } + + public void setCollectionId(String collectionId) { + this.collectionId = collectionId; + } + + public CreateDownloadAlphaInput hour(String hour) { + + this.hour = hour; + return this; + } + + /** + * The ISO8601 formatted timestamp corresponding to a specific hour and day to retrieve data + * for. E.g.: 2025-05-07T23:00:00Z Objects are bucketed by hour and a month of data is retained. + * + * @return hour + */ + @javax.annotation.Nonnull + public String getHour() { + return hour; + } + + public void setHour(String hour) { + this.hour = hour; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDownloadAlphaInput createDownloadAlphaInput = (CreateDownloadAlphaInput) o; + return Objects.equals(this.collectionId, createDownloadAlphaInput.collectionId) + && Objects.equals(this.hour, createDownloadAlphaInput.hour); + } + + @Override + public int hashCode() { + return Objects.hash(collectionId, hour); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDownloadAlphaInput {\n"); + sb.append(" collectionId: ").append(toIndentedString(collectionId)).append("\n"); + sb.append(" hour: ").append(toIndentedString(hour)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("collectionId"); + openapiFields.add("hour"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("collectionId"); + openapiRequiredFields.add("hour"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateDownloadAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDownloadAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateDownloadAlphaInput is not found" + + " in the empty JSON string", + CreateDownloadAlphaInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDownloadAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateDownloadAlphaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateDownloadAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("collectionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collectionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("collectionId").toString())); + } + if (!jsonObj.get("hour").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `hour` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("hour").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDownloadAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDownloadAlphaInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateDownloadAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateDownloadAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDownloadAlphaInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDownloadAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDownloadAlphaInput + * @throws IOException if the JSON string is invalid with respect to CreateDownloadAlphaInput + */ + public static CreateDownloadAlphaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDownloadAlphaInput.class); + } + + /** + * Convert an instance of CreateDownloadAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateDownloadAlphaOutput.java b/src/main/java/com/segment/publicapi/models/CreateDownloadAlphaOutput.java new file mode 100644 index 00000000..520da262 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateDownloadAlphaOutput.java @@ -0,0 +1,203 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateDownloadAlphaOutput */ +public class CreateDownloadAlphaOutput { + public static final String SERIALIZED_NAME_DOWNLOAD = "download"; + + @SerializedName(SERIALIZED_NAME_DOWNLOAD) + private Download download; + + public CreateDownloadAlphaOutput() {} + + public CreateDownloadAlphaOutput download(Download download) { + + this.download = download; + return this; + } + + /** + * Get download + * + * @return download + */ + @javax.annotation.Nonnull + public Download getDownload() { + return download; + } + + public void setDownload(Download download) { + this.download = download; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDownloadAlphaOutput createDownloadAlphaOutput = (CreateDownloadAlphaOutput) o; + return Objects.equals(this.download, createDownloadAlphaOutput.download); + } + + @Override + public int hashCode() { + return Objects.hash(download); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDownloadAlphaOutput {\n"); + sb.append(" download: ").append(toIndentedString(download)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("download"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("download"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateDownloadAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDownloadAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateDownloadAlphaOutput is not found" + + " in the empty JSON string", + CreateDownloadAlphaOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDownloadAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateDownloadAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateDownloadAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `download` + Download.validateJsonElement(jsonObj.get("download")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDownloadAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDownloadAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateDownloadAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateDownloadAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDownloadAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDownloadAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDownloadAlphaOutput + * @throws IOException if the JSON string is invalid with respect to CreateDownloadAlphaOutput + */ + public static CreateDownloadAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDownloadAlphaOutput.class); + } + + /** + * Convert an instance of CreateDownloadAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateEdgeFunctions200Response.java b/src/main/java/com/segment/publicapi/models/CreateEdgeFunctions200Response.java index 46338e3e..97a7e912 100644 --- a/src/main/java/com/segment/publicapi/models/CreateEdgeFunctions200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateEdgeFunctions200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateEdgeFunctionsAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateEdgeFunctions200Response - */ - +/** CreateEdgeFunctions200Response */ public class CreateEdgeFunctions200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateEdgeFunctionsAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateEdgeFunctions200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateEdgeFunctionsAlphaOutput data; - public CreateEdgeFunctions200Response data(CreateEdgeFunctionsAlphaOutput data) { - - this.data = data; - return this; - } + public CreateEdgeFunctions200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateEdgeFunctions200Response data(CreateEdgeFunctionsAlphaOutput data) { - public CreateEdgeFunctionsAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateEdgeFunctionsAlphaOutput getData() { + return data; + } - public void setData(CreateEdgeFunctionsAlphaOutput data) { - this.data = data; - } + public void setData(CreateEdgeFunctionsAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateEdgeFunctions200Response createEdgeFunctions200Response = + (CreateEdgeFunctions200Response) o; + return Objects.equals(this.data, createEdgeFunctions200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateEdgeFunctions200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateEdgeFunctions200Response createEdgeFunctions200Response = (CreateEdgeFunctions200Response) o; - return Objects.equals(this.data, createEdgeFunctions200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateEdgeFunctions200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateEdgeFunctions200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateEdgeFunctions200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateEdgeFunctions200Response is not found in the empty JSON string", CreateEdgeFunctions200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateEdgeFunctions200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateEdgeFunctions200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateEdgeFunctions200Response is not" + + " found in the empty JSON string", + CreateEdgeFunctions200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateEdgeFunctions200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateEdgeFunctions200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateEdgeFunctions200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateEdgeFunctions200Response` 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()) { + CreateEdgeFunctionsAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateEdgeFunctions200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateEdgeFunctions200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateEdgeFunctions200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateEdgeFunctions200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateEdgeFunctions200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateEdgeFunctions200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateEdgeFunctions200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateEdgeFunctions200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateEdgeFunctions200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateEdgeFunctions200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateEdgeFunctions200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateEdgeFunctions200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateEdgeFunctions200Response + */ + public static CreateEdgeFunctions200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateEdgeFunctions200Response.class); } - } - - /** - * Create an instance of CreateEdgeFunctions200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateEdgeFunctions200Response - * @throws IOException if the JSON string is invalid with respect to CreateEdgeFunctions200Response - */ - public static CreateEdgeFunctions200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateEdgeFunctions200Response.class); - } - - /** - * Convert an instance of CreateEdgeFunctions200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateEdgeFunctions200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateEdgeFunctionsAlphaInput.java b/src/main/java/com/segment/publicapi/models/CreateEdgeFunctionsAlphaInput.java index 8d1345d1..d7956395 100644 --- a/src/main/java/com/segment/publicapi/models/CreateEdgeFunctionsAlphaInput.java +++ b/src/main/java/com/segment/publicapi/models/CreateEdgeFunctionsAlphaInput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,208 +9,205 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Input for CreateEdgeFunctions. - */ -@ApiModel(description = "Input for CreateEdgeFunctions.") - +/** Input for CreateEdgeFunctions. */ public class CreateEdgeFunctionsAlphaInput { - public static final String SERIALIZED_NAME_UPLOAD_U_R_L = "uploadURL"; - @SerializedName(SERIALIZED_NAME_UPLOAD_U_R_L) - private String uploadURL; + public static final String SERIALIZED_NAME_UPLOAD_U_R_L = "uploadURL"; - public CreateEdgeFunctionsAlphaInput() { - } + @SerializedName(SERIALIZED_NAME_UPLOAD_U_R_L) + private String uploadURL; - public CreateEdgeFunctionsAlphaInput uploadURL(String uploadURL) { - - this.uploadURL = uploadURL; - return this; - } + public CreateEdgeFunctionsAlphaInput() {} - /** - * The id of the Source associated with this Edge Function. - * @return uploadURL - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source associated with this Edge Function.") + public CreateEdgeFunctionsAlphaInput uploadURL(String uploadURL) { - public String getUploadURL() { - return uploadURL; - } + this.uploadURL = uploadURL; + return this; + } + /** + * The id of the Source associated with this Edge Function. + * + * @return uploadURL + */ + @javax.annotation.Nonnull + public String getUploadURL() { + return uploadURL; + } - public void setUploadURL(String uploadURL) { - this.uploadURL = uploadURL; - } + public void setUploadURL(String uploadURL) { + this.uploadURL = uploadURL; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput = + (CreateEdgeFunctionsAlphaInput) o; + return Objects.equals(this.uploadURL, createEdgeFunctionsAlphaInput.uploadURL); + } + @Override + public int hashCode() { + return Objects.hash(uploadURL); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateEdgeFunctionsAlphaInput {\n"); + sb.append(" uploadURL: ").append(toIndentedString(uploadURL)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateEdgeFunctionsAlphaInput createEdgeFunctionsAlphaInput = (CreateEdgeFunctionsAlphaInput) o; - return Objects.equals(this.uploadURL, createEdgeFunctionsAlphaInput.uploadURL); - } - - @Override - public int hashCode() { - return Objects.hash(uploadURL); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateEdgeFunctionsAlphaInput {\n"); - sb.append(" uploadURL: ").append(toIndentedString(uploadURL)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("uploadURL"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("uploadURL"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("uploadURL"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("uploadURL"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateEdgeFunctionsAlphaInput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateEdgeFunctionsAlphaInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateEdgeFunctionsAlphaInput is not found in the empty JSON string", CreateEdgeFunctionsAlphaInput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateEdgeFunctionsAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateEdgeFunctionsAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateEdgeFunctionsAlphaInput is not" + + " found in the empty JSON string", + CreateEdgeFunctionsAlphaInput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateEdgeFunctionsAlphaInput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateEdgeFunctionsAlphaInput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateEdgeFunctionsAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateEdgeFunctionsAlphaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateEdgeFunctionsAlphaInput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateEdgeFunctionsAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("uploadURL").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `uploadURL` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("uploadURL").toString())); } - } - if (!jsonObj.get("uploadURL").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `uploadURL` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uploadURL").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateEdgeFunctionsAlphaInput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateEdgeFunctionsAlphaInput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateEdgeFunctionsAlphaInput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateEdgeFunctionsAlphaInput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateEdgeFunctionsAlphaInput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateEdgeFunctionsAlphaInput given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateEdgeFunctionsAlphaInput - * @throws IOException if the JSON string is invalid with respect to CreateEdgeFunctionsAlphaInput - */ - public static CreateEdgeFunctionsAlphaInput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateEdgeFunctionsAlphaInput.class); - } - - /** - * Convert an instance of CreateEdgeFunctionsAlphaInput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateEdgeFunctionsAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateEdgeFunctionsAlphaInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateEdgeFunctionsAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateEdgeFunctionsAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateEdgeFunctionsAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateEdgeFunctionsAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateEdgeFunctionsAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * CreateEdgeFunctionsAlphaInput + */ + public static CreateEdgeFunctionsAlphaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateEdgeFunctionsAlphaInput.class); + } + + /** + * Convert an instance of CreateEdgeFunctionsAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateEdgeFunctionsAlphaOutput.java b/src/main/java/com/segment/publicapi/models/CreateEdgeFunctionsAlphaOutput.java index f3b3f9ea..287419d2 100644 --- a/src/main/java/com/segment/publicapi/models/CreateEdgeFunctionsAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/CreateEdgeFunctionsAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,200 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.EdgeFunctions; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Output for CreateEdgeFunctions. - */ -@ApiModel(description = "Output for CreateEdgeFunctions.") - +/** Output for CreateEdgeFunctions. */ public class CreateEdgeFunctionsAlphaOutput { - public static final String SERIALIZED_NAME_EDGE_FUNCTIONS = "edgeFunctions"; - @SerializedName(SERIALIZED_NAME_EDGE_FUNCTIONS) - private EdgeFunctions edgeFunctions; + public static final String SERIALIZED_NAME_EDGE_FUNCTIONS = "edgeFunctions"; - public CreateEdgeFunctionsAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_EDGE_FUNCTIONS) + private EdgeFunctionsAlpha edgeFunctions; - public CreateEdgeFunctionsAlphaOutput edgeFunctions(EdgeFunctions edgeFunctions) { - - this.edgeFunctions = edgeFunctions; - return this; - } + public CreateEdgeFunctionsAlphaOutput() {} - /** - * Get edgeFunctions - * @return edgeFunctions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateEdgeFunctionsAlphaOutput edgeFunctions(EdgeFunctionsAlpha edgeFunctions) { - public EdgeFunctions getEdgeFunctions() { - return edgeFunctions; - } + this.edgeFunctions = edgeFunctions; + return this; + } + /** + * Get edgeFunctions + * + * @return edgeFunctions + */ + @javax.annotation.Nonnull + public EdgeFunctionsAlpha getEdgeFunctions() { + return edgeFunctions; + } - public void setEdgeFunctions(EdgeFunctions edgeFunctions) { - this.edgeFunctions = edgeFunctions; - } + public void setEdgeFunctions(EdgeFunctionsAlpha edgeFunctions) { + this.edgeFunctions = edgeFunctions; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateEdgeFunctionsAlphaOutput createEdgeFunctionsAlphaOutput = + (CreateEdgeFunctionsAlphaOutput) o; + return Objects.equals(this.edgeFunctions, createEdgeFunctionsAlphaOutput.edgeFunctions); + } + @Override + public int hashCode() { + return Objects.hash(edgeFunctions); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateEdgeFunctionsAlphaOutput {\n"); + sb.append(" edgeFunctions: ").append(toIndentedString(edgeFunctions)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateEdgeFunctionsAlphaOutput createEdgeFunctionsAlphaOutput = (CreateEdgeFunctionsAlphaOutput) o; - return Objects.equals(this.edgeFunctions, createEdgeFunctionsAlphaOutput.edgeFunctions); - } - - @Override - public int hashCode() { - return Objects.hash(edgeFunctions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateEdgeFunctionsAlphaOutput {\n"); - sb.append(" edgeFunctions: ").append(toIndentedString(edgeFunctions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("edgeFunctions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("edgeFunctions"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("edgeFunctions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("edgeFunctions"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateEdgeFunctionsAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateEdgeFunctionsAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateEdgeFunctionsAlphaOutput is not found in the empty JSON string", CreateEdgeFunctionsAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateEdgeFunctionsAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateEdgeFunctionsAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateEdgeFunctionsAlphaOutput is not" + + " found in the empty JSON string", + CreateEdgeFunctionsAlphaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateEdgeFunctionsAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateEdgeFunctionsAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateEdgeFunctionsAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateEdgeFunctionsAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateEdgeFunctionsAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateEdgeFunctionsAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `edgeFunctions` + EdgeFunctionsAlpha.validateJsonElement(jsonObj.get("edgeFunctions")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateEdgeFunctionsAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateEdgeFunctionsAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateEdgeFunctionsAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateEdgeFunctionsAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateEdgeFunctionsAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateEdgeFunctionsAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateEdgeFunctionsAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateEdgeFunctionsAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateEdgeFunctionsAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateEdgeFunctionsAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateEdgeFunctionsAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateEdgeFunctionsAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * CreateEdgeFunctionsAlphaOutput + */ + public static CreateEdgeFunctionsAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateEdgeFunctionsAlphaOutput.class); } - } - - /** - * Create an instance of CreateEdgeFunctionsAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateEdgeFunctionsAlphaOutput - * @throws IOException if the JSON string is invalid with respect to CreateEdgeFunctionsAlphaOutput - */ - public static CreateEdgeFunctionsAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateEdgeFunctionsAlphaOutput.class); - } - - /** - * Convert an instance of CreateEdgeFunctionsAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateEdgeFunctionsAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateFilterForDestination200Response.java b/src/main/java/com/segment/publicapi/models/CreateFilterForDestination200Response.java index 816d2203..a2277425 100644 --- a/src/main/java/com/segment/publicapi/models/CreateFilterForDestination200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateFilterForDestination200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateFilterForDestinationV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateFilterForDestination200Response - */ - +/** CreateFilterForDestination200Response */ public class CreateFilterForDestination200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateFilterForDestinationV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateFilterForDestination200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateFilterForDestinationV1Output data; - public CreateFilterForDestination200Response data(CreateFilterForDestinationV1Output data) { - - this.data = data; - return this; - } + public CreateFilterForDestination200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateFilterForDestination200Response data(CreateFilterForDestinationV1Output data) { - public CreateFilterForDestinationV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateFilterForDestinationV1Output getData() { + return data; + } - public void setData(CreateFilterForDestinationV1Output data) { - this.data = data; - } + public void setData(CreateFilterForDestinationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFilterForDestination200Response createFilterForDestination200Response = + (CreateFilterForDestination200Response) o; + return Objects.equals(this.data, createFilterForDestination200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFilterForDestination200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateFilterForDestination200Response createFilterForDestination200Response = (CreateFilterForDestination200Response) o; - return Objects.equals(this.data, createFilterForDestination200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateFilterForDestination200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateFilterForDestination200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateFilterForDestination200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFilterForDestination200Response is not found in the empty JSON string", CreateFilterForDestination200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateFilterForDestination200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFilterForDestination200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateFilterForDestination200Response" + + " is not found in the empty JSON string", + CreateFilterForDestination200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateFilterForDestination200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFilterForDestination200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFilterForDestination200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateFilterForDestination200Response` 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()) { + CreateFilterForDestinationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateFilterForDestination200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateFilterForDestination200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateFilterForDestination200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateFilterForDestination200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateFilterForDestination200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFilterForDestination200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFilterForDestination200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateFilterForDestination200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CreateFilterForDestination200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFilterForDestination200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFilterForDestination200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFilterForDestination200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateFilterForDestination200Response + */ + public static CreateFilterForDestination200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFilterForDestination200Response.class); } - } - - /** - * Create an instance of CreateFilterForDestination200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateFilterForDestination200Response - * @throws IOException if the JSON string is invalid with respect to CreateFilterForDestination200Response - */ - public static CreateFilterForDestination200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateFilterForDestination200Response.class); - } - - /** - * Convert an instance of CreateFilterForDestination200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateFilterForDestination200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateFilterForDestinationV1Input.java b/src/main/java/com/segment/publicapi/models/CreateFilterForDestinationV1Input.java index 64ce9512..eab7a3e1 100644 --- a/src/main/java/com/segment/publicapi/models/CreateFilterForDestinationV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateFilterForDestinationV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,383 +9,398 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DestinationFilterActionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Input for CreateDestinationFilterV1. - */ -@ApiModel(description = "Input for CreateDestinationFilterV1.") - +/** Input for CreateDestinationFilterV1. */ public class CreateFilterForDestinationV1Input { - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; - public static final String SERIALIZED_NAME_ACTIONS = "actions"; - @SerializedName(SERIALIZED_NAME_ACTIONS) - private List actions = new ArrayList<>(); - - public static final String SERIALIZED_NAME_TITLE = "title"; - @SerializedName(SERIALIZED_NAME_TITLE) - private String title; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + public static final String SERIALIZED_NAME_IF = "if"; - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + @SerializedName(SERIALIZED_NAME_IF) + private String _if; - public CreateFilterForDestinationV1Input() { - } + public static final String SERIALIZED_NAME_ACTIONS = "actions"; - public CreateFilterForDestinationV1Input sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + @SerializedName(SERIALIZED_NAME_ACTIONS) + private List actions = new ArrayList<>(); - /** - * The id of the Source associated with this filter. - * @return sourceId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the Source associated with this filter.") - - public String getSourceId() { - return sourceId; - } + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + private String title; - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - public CreateFilterForDestinationV1Input _if(String _if) { - - this._if = _if; - return this; - } + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - /** - * The filter's condition. - * @return _if - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The filter's condition.") + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public String getIf() { - return _if; - } + public CreateFilterForDestinationV1Input() {} + public CreateFilterForDestinationV1Input sourceId(String sourceId) { - public void setIf(String _if) { - this._if = _if; - } - - - public CreateFilterForDestinationV1Input actions(List actions) { - - this.actions = actions; - return this; - } + this.sourceId = sourceId; + return this; + } - public CreateFilterForDestinationV1Input addActionsItem(DestinationFilterActionV1 actionsItem) { - this.actions.add(actionsItem); - return this; - } + /** + * The id of the Source associated with this filter. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } - /** - * Actions for the Destination filter. - * @return actions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Actions for the Destination filter.") + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } - public List getActions() { - return actions; - } + public CreateFilterForDestinationV1Input _if(String _if) { + this._if = _if; + return this; + } - public void setActions(List actions) { - this.actions = actions; - } + /** + * The filter's condition. + * + * @return _if + */ + @javax.annotation.Nonnull + public String getIf() { + return _if; + } + public void setIf(String _if) { + this._if = _if; + } - public CreateFilterForDestinationV1Input title(String title) { - - this.title = title; - return this; - } + public CreateFilterForDestinationV1Input actions(List actions) { - /** - * The title of the filter. - * @return title - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The title of the filter.") + this.actions = actions; + return this; + } - public String getTitle() { - return title; - } + public CreateFilterForDestinationV1Input addActionsItem(DestinationFilterActionV1 actionsItem) { + if (this.actions == null) { + this.actions = new ArrayList<>(); + } + this.actions.add(actionsItem); + return this; + } + /** + * Actions for the Destination filter. + * + * @return actions + */ + @javax.annotation.Nonnull + public List getActions() { + return actions; + } - public void setTitle(String title) { - this.title = title; - } + public void setActions(List actions) { + this.actions = actions; + } + public CreateFilterForDestinationV1Input title(String title) { - public CreateFilterForDestinationV1Input description(String description) { - - this.description = description; - return this; - } + this.title = title; + return this; + } - /** - * The description of the filter. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The description of the filter.") + /** + * The title of the filter. + * + * @return title + */ + @javax.annotation.Nonnull + public String getTitle() { + return title; + } - public String getDescription() { - return description; - } + public void setTitle(String title) { + this.title = title; + } + public CreateFilterForDestinationV1Input description(String description) { - public void setDescription(String description) { - this.description = description; - } + this.description = description; + return this; + } + /** + * The description of the filter. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } - public CreateFilterForDestinationV1Input enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public void setDescription(String description) { + this.description = description; + } - /** - * When set to true, the Destination filter is active. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "When set to true, the Destination filter is active.") + public CreateFilterForDestinationV1Input enabled(Boolean enabled) { - public Boolean getEnabled() { - return enabled; - } + this.enabled = enabled; + return this; + } + /** + * When set to true, the Destination filter is active. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFilterForDestinationV1Input createFilterForDestinationV1Input = + (CreateFilterForDestinationV1Input) o; + return Objects.equals(this.sourceId, createFilterForDestinationV1Input.sourceId) + && Objects.equals(this._if, createFilterForDestinationV1Input._if) + && Objects.equals(this.actions, createFilterForDestinationV1Input.actions) + && Objects.equals(this.title, createFilterForDestinationV1Input.title) + && Objects.equals(this.description, createFilterForDestinationV1Input.description) + && Objects.equals(this.enabled, createFilterForDestinationV1Input.enabled); + } + @Override + public int hashCode() { + return Objects.hash(sourceId, _if, actions, title, description, enabled); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFilterForDestinationV1Input {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateFilterForDestinationV1Input createFilterForDestinationV1Input = (CreateFilterForDestinationV1Input) o; - return Objects.equals(this.sourceId, createFilterForDestinationV1Input.sourceId) && - Objects.equals(this._if, createFilterForDestinationV1Input._if) && - Objects.equals(this.actions, createFilterForDestinationV1Input.actions) && - Objects.equals(this.title, createFilterForDestinationV1Input.title) && - Objects.equals(this.description, createFilterForDestinationV1Input.description) && - Objects.equals(this.enabled, createFilterForDestinationV1Input.enabled); - } - - @Override - public int hashCode() { - return Objects.hash(sourceId, _if, actions, title, description, enabled); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateFilterForDestinationV1Input {\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); - sb.append(" title: ").append(toIndentedString(title)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + openapiFields.add("if"); + openapiFields.add("actions"); + openapiFields.add("title"); + openapiFields.add("description"); + openapiFields.add("enabled"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("if"); + openapiRequiredFields.add("actions"); + openapiRequiredFields.add("title"); + openapiRequiredFields.add("enabled"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourceId"); - openapiFields.add("if"); - openapiFields.add("actions"); - openapiFields.add("title"); - openapiFields.add("description"); - openapiFields.add("enabled"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("if"); - openapiRequiredFields.add("actions"); - openapiRequiredFields.add("enabled"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateFilterForDestinationV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateFilterForDestinationV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFilterForDestinationV1Input is not found in the empty JSON string", CreateFilterForDestinationV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateFilterForDestinationV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFilterForDestinationV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateFilterForDestinationV1Input is" + + " not found in the empty JSON string", + CreateFilterForDestinationV1Input.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateFilterForDestinationV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFilterForDestinationV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFilterForDestinationV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateFilterForDestinationV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateFilterForDestinationV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFilterForDestinationV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if (!jsonObj.get("if").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `if` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("if").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("actions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `actions` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("actions").toString())); + } + + JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); + // validate the required field `actions` (array) + for (int i = 0; i < jsonArrayactions.size(); i++) { + DestinationFilterActionV1.validateJsonElement(jsonArrayactions.get(i)); + } + ; + if (!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("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 (!CreateFilterForDestinationV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFilterForDestinationV1Input' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateFilterForDestinationV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFilterForDestinationV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFilterForDestinationV1Input read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - if ((jsonObj.get("sourceId") != null && !jsonObj.get("sourceId").isJsonNull()) && !jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("actions").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `actions` to be an array in the JSON string but got `%s`", jsonObj.get("actions").toString())); - } - - JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); - 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("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 (!CreateFilterForDestinationV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateFilterForDestinationV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateFilterForDestinationV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateFilterForDestinationV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateFilterForDestinationV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateFilterForDestinationV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateFilterForDestinationV1Input - * @throws IOException if the JSON string is invalid with respect to CreateFilterForDestinationV1Input - */ - public static CreateFilterForDestinationV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateFilterForDestinationV1Input.class); - } - - /** - * Convert an instance of CreateFilterForDestinationV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of CreateFilterForDestinationV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFilterForDestinationV1Input + * @throws IOException if the JSON string is invalid with respect to + * CreateFilterForDestinationV1Input + */ + public static CreateFilterForDestinationV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFilterForDestinationV1Input.class); + } + + /** + * Convert an instance of CreateFilterForDestinationV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateFilterForDestinationV1Output.java b/src/main/java/com/segment/publicapi/models/CreateFilterForDestinationV1Output.java index 94977b50..139e4a86 100644 --- a/src/main/java/com/segment/publicapi/models/CreateFilterForDestinationV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateFilterForDestinationV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,202 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Filter2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Output for CreateDestinationFiltersV1. - */ -@ApiModel(description = "Output for CreateDestinationFiltersV1.") - +/** Output for CreateDestinationFiltersV1. */ public class CreateFilterForDestinationV1Output { - public static final String SERIALIZED_NAME_FILTER = "filter"; - @SerializedName(SERIALIZED_NAME_FILTER) - private Filter2 filter; + public static final String SERIALIZED_NAME_FILTER = "filter"; - public CreateFilterForDestinationV1Output() { - } + @SerializedName(SERIALIZED_NAME_FILTER) + private DestinationFilterV1 filter; - public CreateFilterForDestinationV1Output filter(Filter2 filter) { - - this.filter = filter; - return this; - } + public CreateFilterForDestinationV1Output() {} - /** - * Get filter - * @return filter - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateFilterForDestinationV1Output filter(DestinationFilterV1 filter) { - public Filter2 getFilter() { - return filter; - } + this.filter = filter; + return this; + } + /** + * Get filter + * + * @return filter + */ + @javax.annotation.Nonnull + public DestinationFilterV1 getFilter() { + return filter; + } - public void setFilter(Filter2 filter) { - this.filter = filter; - } + public void setFilter(DestinationFilterV1 filter) { + this.filter = filter; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFilterForDestinationV1Output createFilterForDestinationV1Output = + (CreateFilterForDestinationV1Output) o; + return Objects.equals(this.filter, createFilterForDestinationV1Output.filter); + } + @Override + public int hashCode() { + return Objects.hash(filter); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFilterForDestinationV1Output {\n"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateFilterForDestinationV1Output createFilterForDestinationV1Output = (CreateFilterForDestinationV1Output) o; - return Objects.equals(this.filter, createFilterForDestinationV1Output.filter); - } - - @Override - public int hashCode() { - return Objects.hash(filter); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateFilterForDestinationV1Output {\n"); - sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("filter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("filter"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("filter"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("filter"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateFilterForDestinationV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateFilterForDestinationV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFilterForDestinationV1Output is not found in the empty JSON string", CreateFilterForDestinationV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateFilterForDestinationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFilterForDestinationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateFilterForDestinationV1Output is" + + " not found in the empty JSON string", + CreateFilterForDestinationV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateFilterForDestinationV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFilterForDestinationV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFilterForDestinationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateFilterForDestinationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateFilterForDestinationV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFilterForDestinationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `filter` + DestinationFilterV1.validateJsonElement(jsonObj.get("filter")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateFilterForDestinationV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateFilterForDestinationV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateFilterForDestinationV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateFilterForDestinationV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateFilterForDestinationV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFilterForDestinationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFilterForDestinationV1Output' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateFilterForDestinationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFilterForDestinationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFilterForDestinationV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFilterForDestinationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFilterForDestinationV1Output + * @throws IOException if the JSON string is invalid with respect to + * CreateFilterForDestinationV1Output + */ + public static CreateFilterForDestinationV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFilterForDestinationV1Output.class); } - } - - /** - * Create an instance of CreateFilterForDestinationV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateFilterForDestinationV1Output - * @throws IOException if the JSON string is invalid with respect to CreateFilterForDestinationV1Output - */ - public static CreateFilterForDestinationV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateFilterForDestinationV1Output.class); - } - - /** - * Convert an instance of CreateFilterForDestinationV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateFilterForDestinationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateFilterForSpace200Response.java b/src/main/java/com/segment/publicapi/models/CreateFilterForSpace200Response.java new file mode 100644 index 00000000..587158e9 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateFilterForSpace200Response.java @@ -0,0 +1,199 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateFilterForSpace200Response */ +public class CreateFilterForSpace200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateFilterForSpaceOutput data; + + public CreateFilterForSpace200Response() {} + + public CreateFilterForSpace200Response data(CreateFilterForSpaceOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateFilterForSpaceOutput getData() { + return data; + } + + public void setData(CreateFilterForSpaceOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFilterForSpace200Response createFilterForSpace200Response = + (CreateFilterForSpace200Response) o; + return Objects.equals(this.data, createFilterForSpace200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFilterForSpace200Response {\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 + * CreateFilterForSpace200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFilterForSpace200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateFilterForSpace200Response is not" + + " found in the empty JSON string", + CreateFilterForSpace200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFilterForSpace200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateFilterForSpace200Response` 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()) { + CreateFilterForSpaceOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFilterForSpace200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFilterForSpace200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateFilterForSpace200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFilterForSpace200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFilterForSpace200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFilterForSpace200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFilterForSpace200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateFilterForSpace200Response + */ + public static CreateFilterForSpace200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFilterForSpace200Response.class); + } + + /** + * Convert an instance of CreateFilterForSpace200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateFilterForSpaceInput.java b/src/main/java/com/segment/publicapi/models/CreateFilterForSpaceInput.java new file mode 100644 index 00000000..96a84806 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateFilterForSpaceInput.java @@ -0,0 +1,372 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Input for CreateFilter. */ +public class CreateFilterForSpaceInput { + public static final String SERIALIZED_NAME_INTEGRATION_ID = "integrationId"; + + @SerializedName(SERIALIZED_NAME_INTEGRATION_ID) + private String integrationId; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_IF = "if"; + + @SerializedName(SERIALIZED_NAME_IF) + private String _if; + + public static final String SERIALIZED_NAME_DROP = "drop"; + + @SerializedName(SERIALIZED_NAME_DROP) + private Boolean drop; + + public CreateFilterForSpaceInput() {} + + public CreateFilterForSpaceInput integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The Space id to filter on. + * + * @return integrationId + */ + @javax.annotation.Nonnull + public String getIntegrationId() { + return integrationId; + } + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + public CreateFilterForSpaceInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Whether the filter is enabled. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public CreateFilterForSpaceInput name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the filter. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreateFilterForSpaceInput description(String description) { + + this.description = description; + return this; + } + + /** + * The description of the filter. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CreateFilterForSpaceInput _if(String _if) { + + this._if = _if; + return this; + } + + /** + * The \"if\" statement for a filter. + * + * @return _if + */ + @javax.annotation.Nonnull + public String getIf() { + return _if; + } + + public void setIf(String _if) { + this._if = _if; + } + + public CreateFilterForSpaceInput drop(Boolean drop) { + + this.drop = drop; + return this; + } + + /** + * Whether the event is dropped. + * + * @return drop + */ + @javax.annotation.Nullable + public Boolean getDrop() { + return drop; + } + + public void setDrop(Boolean drop) { + this.drop = drop; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFilterForSpaceInput createFilterForSpaceInput = (CreateFilterForSpaceInput) o; + return Objects.equals(this.integrationId, createFilterForSpaceInput.integrationId) + && Objects.equals(this.enabled, createFilterForSpaceInput.enabled) + && Objects.equals(this.name, createFilterForSpaceInput.name) + && Objects.equals(this.description, createFilterForSpaceInput.description) + && Objects.equals(this._if, createFilterForSpaceInput._if) + && Objects.equals(this.drop, createFilterForSpaceInput.drop); + } + + @Override + public int hashCode() { + return Objects.hash(integrationId, enabled, name, description, _if, drop); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFilterForSpaceInput {\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" drop: ").append(toIndentedString(drop)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("integrationId"); + openapiFields.add("enabled"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("if"); + openapiFields.add("drop"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("integrationId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("if"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateFilterForSpaceInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFilterForSpaceInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateFilterForSpaceInput is not found" + + " in the empty JSON string", + CreateFilterForSpaceInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFilterForSpaceInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateFilterForSpaceInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFilterForSpaceInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("integrationId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `integrationId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("integrationId").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("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("if").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `if` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("if").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFilterForSpaceInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFilterForSpaceInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateFilterForSpaceInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFilterForSpaceInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFilterForSpaceInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFilterForSpaceInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFilterForSpaceInput + * @throws IOException if the JSON string is invalid with respect to CreateFilterForSpaceInput + */ + public static CreateFilterForSpaceInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFilterForSpaceInput.class); + } + + /** + * Convert an instance of CreateFilterForSpaceInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateFilterForSpaceOutput.java b/src/main/java/com/segment/publicapi/models/CreateFilterForSpaceOutput.java new file mode 100644 index 00000000..56b87d51 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateFilterForSpaceOutput.java @@ -0,0 +1,203 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output for CreateFilter. */ +public class CreateFilterForSpaceOutput { + public static final String SERIALIZED_NAME_FILTER = "filter"; + + @SerializedName(SERIALIZED_NAME_FILTER) + private Filter filter; + + public CreateFilterForSpaceOutput() {} + + public CreateFilterForSpaceOutput filter(Filter filter) { + + this.filter = filter; + return this; + } + + /** + * Get filter + * + * @return filter + */ + @javax.annotation.Nonnull + public Filter getFilter() { + return filter; + } + + public void setFilter(Filter filter) { + this.filter = filter; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFilterForSpaceOutput createFilterForSpaceOutput = (CreateFilterForSpaceOutput) o; + return Objects.equals(this.filter, createFilterForSpaceOutput.filter); + } + + @Override + public int hashCode() { + return Objects.hash(filter); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFilterForSpaceOutput {\n"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("filter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("filter"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateFilterForSpaceOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFilterForSpaceOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateFilterForSpaceOutput is not" + + " found in the empty JSON string", + CreateFilterForSpaceOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFilterForSpaceOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateFilterForSpaceOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFilterForSpaceOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `filter` + Filter.validateJsonElement(jsonObj.get("filter")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFilterForSpaceOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFilterForSpaceOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateFilterForSpaceOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFilterForSpaceOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFilterForSpaceOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFilterForSpaceOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFilterForSpaceOutput + * @throws IOException if the JSON string is invalid with respect to CreateFilterForSpaceOutput + */ + public static CreateFilterForSpaceOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFilterForSpaceOutput.class); + } + + /** + * Convert an instance of CreateFilterForSpaceOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateFunction200Response.java b/src/main/java/com/segment/publicapi/models/CreateFunction200Response.java index 334720d5..6e0eb501 100644 --- a/src/main/java/com/segment/publicapi/models/CreateFunction200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateFunction200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateFunctionV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateFunction200Response - */ - +/** CreateFunction200Response */ public class CreateFunction200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateFunctionV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateFunction200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateFunctionV1Output data; - public CreateFunction200Response data(CreateFunctionV1Output data) { - - this.data = data; - return this; - } + public CreateFunction200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateFunction200Response data(CreateFunctionV1Output data) { - public CreateFunctionV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateFunctionV1Output getData() { + return data; + } - public void setData(CreateFunctionV1Output data) { - this.data = data; - } + public void setData(CreateFunctionV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFunction200Response createFunction200Response = (CreateFunction200Response) o; + return Objects.equals(this.data, createFunction200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFunction200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateFunction200Response createFunction200Response = (CreateFunction200Response) o; - return Objects.equals(this.data, createFunction200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateFunction200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateFunction200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateFunction200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFunction200Response is not found in the empty JSON string", CreateFunction200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateFunction200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFunction200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateFunction200Response is not found" + + " in the empty JSON string", + CreateFunction200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateFunction200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFunction200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFunction200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateFunction200Response` 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()) { + CreateFunctionV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateFunction200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateFunction200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateFunction200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateFunction200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateFunction200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFunction200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFunction200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateFunction200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFunction200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFunction200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFunction200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFunction200Response + * @throws IOException if the JSON string is invalid with respect to CreateFunction200Response + */ + public static CreateFunction200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFunction200Response.class); } - } - - /** - * Create an instance of CreateFunction200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateFunction200Response - * @throws IOException if the JSON string is invalid with respect to CreateFunction200Response - */ - public static CreateFunction200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateFunction200Response.class); - } - - /** - * Convert an instance of CreateFunction200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateFunction200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateFunctionDeployment200Response.java b/src/main/java/com/segment/publicapi/models/CreateFunctionDeployment200Response.java index 4547cf1a..d8cec1a4 100644 --- a/src/main/java/com/segment/publicapi/models/CreateFunctionDeployment200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateFunctionDeployment200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,193 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateFunctionDeploymentV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateFunctionDeployment200Response - */ - +/** CreateFunctionDeployment200Response */ public class CreateFunctionDeployment200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateFunctionDeploymentV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateFunctionDeployment200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateFunctionDeploymentV1Output data; - public CreateFunctionDeployment200Response data(CreateFunctionDeploymentV1Output data) { - - this.data = data; - return this; - } + public CreateFunctionDeployment200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateFunctionDeployment200Response data(CreateFunctionDeploymentV1Output data) { - public CreateFunctionDeploymentV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateFunctionDeploymentV1Output getData() { + return data; + } - public void setData(CreateFunctionDeploymentV1Output data) { - this.data = data; - } + public void setData(CreateFunctionDeploymentV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFunctionDeployment200Response createFunctionDeployment200Response = + (CreateFunctionDeployment200Response) o; + return Objects.equals(this.data, createFunctionDeployment200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFunctionDeployment200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateFunctionDeployment200Response createFunctionDeployment200Response = (CreateFunctionDeployment200Response) o; - return Objects.equals(this.data, createFunctionDeployment200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateFunctionDeployment200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateFunctionDeployment200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateFunctionDeployment200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFunctionDeployment200Response is not found in the empty JSON string", CreateFunctionDeployment200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateFunctionDeployment200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFunctionDeployment200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateFunctionDeployment200Response is" + + " not found in the empty JSON string", + CreateFunctionDeployment200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateFunctionDeployment200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFunctionDeployment200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFunctionDeployment200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateFunctionDeployment200Response` 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()) { + CreateFunctionDeploymentV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateFunctionDeployment200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateFunctionDeployment200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateFunctionDeployment200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateFunctionDeployment200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateFunctionDeployment200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFunctionDeployment200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFunctionDeployment200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateFunctionDeployment200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFunctionDeployment200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFunctionDeployment200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFunctionDeployment200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFunctionDeployment200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateFunctionDeployment200Response + */ + public static CreateFunctionDeployment200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFunctionDeployment200Response.class); } - } - - /** - * Create an instance of CreateFunctionDeployment200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateFunctionDeployment200Response - * @throws IOException if the JSON string is invalid with respect to CreateFunctionDeployment200Response - */ - public static CreateFunctionDeployment200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateFunctionDeployment200Response.class); - } - - /** - * Convert an instance of CreateFunctionDeployment200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateFunctionDeployment200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateFunctionDeploymentV1Output.java b/src/main/java/com/segment/publicapi/models/CreateFunctionDeploymentV1Output.java index ebcd2358..09fc0438 100644 --- a/src/main/java/com/segment/publicapi/models/CreateFunctionDeploymentV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateFunctionDeploymentV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,204 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.FunctionDeployment; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Updates the deployment for a Source Function instance. - */ -@ApiModel(description = "Updates the deployment for a Source Function instance.") - +/** Updates the deployment for a Source Function instance. */ public class CreateFunctionDeploymentV1Output { - public static final String SERIALIZED_NAME_FUNCTION_DEPLOYMENT = "functionDeployment"; - @SerializedName(SERIALIZED_NAME_FUNCTION_DEPLOYMENT) - private FunctionDeployment functionDeployment; + public static final String SERIALIZED_NAME_FUNCTION_DEPLOYMENT = "functionDeployment"; - public CreateFunctionDeploymentV1Output() { - } + @SerializedName(SERIALIZED_NAME_FUNCTION_DEPLOYMENT) + private FunctionDeployment functionDeployment; - public CreateFunctionDeploymentV1Output functionDeployment(FunctionDeployment functionDeployment) { - - this.functionDeployment = functionDeployment; - return this; - } + public CreateFunctionDeploymentV1Output() {} - /** - * Get functionDeployment - * @return functionDeployment - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateFunctionDeploymentV1Output functionDeployment( + FunctionDeployment functionDeployment) { - public FunctionDeployment getFunctionDeployment() { - return functionDeployment; - } + this.functionDeployment = functionDeployment; + return this; + } + /** + * Get functionDeployment + * + * @return functionDeployment + */ + @javax.annotation.Nonnull + public FunctionDeployment getFunctionDeployment() { + return functionDeployment; + } - public void setFunctionDeployment(FunctionDeployment functionDeployment) { - this.functionDeployment = functionDeployment; - } + public void setFunctionDeployment(FunctionDeployment functionDeployment) { + this.functionDeployment = functionDeployment; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFunctionDeploymentV1Output createFunctionDeploymentV1Output = + (CreateFunctionDeploymentV1Output) o; + return Objects.equals( + this.functionDeployment, createFunctionDeploymentV1Output.functionDeployment); + } + @Override + public int hashCode() { + return Objects.hash(functionDeployment); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFunctionDeploymentV1Output {\n"); + sb.append(" functionDeployment: ") + .append(toIndentedString(functionDeployment)) + .append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateFunctionDeploymentV1Output createFunctionDeploymentV1Output = (CreateFunctionDeploymentV1Output) o; - return Objects.equals(this.functionDeployment, createFunctionDeploymentV1Output.functionDeployment); - } - - @Override - public int hashCode() { - return Objects.hash(functionDeployment); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateFunctionDeploymentV1Output {\n"); - sb.append(" functionDeployment: ").append(toIndentedString(functionDeployment)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("functionDeployment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("functionDeployment"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("functionDeployment"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("functionDeployment"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateFunctionDeploymentV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateFunctionDeploymentV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFunctionDeploymentV1Output is not found in the empty JSON string", CreateFunctionDeploymentV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateFunctionDeploymentV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFunctionDeploymentV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateFunctionDeploymentV1Output is" + + " not found in the empty JSON string", + CreateFunctionDeploymentV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateFunctionDeploymentV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFunctionDeploymentV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFunctionDeploymentV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateFunctionDeploymentV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateFunctionDeploymentV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFunctionDeploymentV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `functionDeployment` + FunctionDeployment.validateJsonElement(jsonObj.get("functionDeployment")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateFunctionDeploymentV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateFunctionDeploymentV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateFunctionDeploymentV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateFunctionDeploymentV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateFunctionDeploymentV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFunctionDeploymentV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFunctionDeploymentV1Output' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateFunctionDeploymentV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFunctionDeploymentV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFunctionDeploymentV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFunctionDeploymentV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFunctionDeploymentV1Output + * @throws IOException if the JSON string is invalid with respect to + * CreateFunctionDeploymentV1Output + */ + public static CreateFunctionDeploymentV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFunctionDeploymentV1Output.class); } - } - - /** - * Create an instance of CreateFunctionDeploymentV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateFunctionDeploymentV1Output - * @throws IOException if the JSON string is invalid with respect to CreateFunctionDeploymentV1Output - */ - public static CreateFunctionDeploymentV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateFunctionDeploymentV1Output.class); - } - - /** - * Convert an instance of CreateFunctionDeploymentV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateFunctionDeploymentV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateFunctionV1Input.java b/src/main/java/com/segment/publicapi/models/CreateFunctionV1Input.java index 762824af..2d938849 100644 --- a/src/main/java/com/segment/publicapi/models/CreateFunctionV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateFunctionV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,439 +9,453 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.segment.publicapi.models.FunctionSettingV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Creates a Function. */ +public class CreateFunctionV1Input { + public static final String SERIALIZED_NAME_CODE = "code"; -/** - * Creates a Function. - */ -@ApiModel(description = "Creates a Function.") + @SerializedName(SERIALIZED_NAME_CODE) + private String code; -public class CreateFunctionV1Input { - public static final String SERIALIZED_NAME_CODE = "code"; - @SerializedName(SERIALIZED_NAME_CODE) - private String code; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private List settings = null; - - public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; - @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) - private String displayName; - - public static final String SERIALIZED_NAME_LOGO_URL = "logoUrl"; - @SerializedName(SERIALIZED_NAME_LOGO_URL) - private String logoUrl; - - /** - * The Function type. Config API note: equal to `type`. - */ - @JsonAdapter(ResourceTypeEnum.Adapter.class) - public enum ResourceTypeEnum { - DESTINATION("DESTINATION"), - - SOURCE("SOURCE"); - - private String value; - - ResourceTypeEnum(String value) { - this.value = value; - } + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - public String getValue() { - return value; - } + @SerializedName(SERIALIZED_NAME_SETTINGS) + private List settings; - @Override - public String toString() { - return String.valueOf(value); - } + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; - public static ResourceTypeEnum fromValue(String value) { - for (ResourceTypeEnum b : ResourceTypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + private String displayName; - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final ResourceTypeEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ResourceTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return ResourceTypeEnum.fromValue(value); - } - } - } + public static final String SERIALIZED_NAME_LOGO_URL = "logoUrl"; - public static final String SERIALIZED_NAME_RESOURCE_TYPE = "resourceType"; - @SerializedName(SERIALIZED_NAME_RESOURCE_TYPE) - private ResourceTypeEnum resourceType; + @SerializedName(SERIALIZED_NAME_LOGO_URL) + private String logoUrl; - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + /** The Function type. Config API note: equal to `type`. */ + @JsonAdapter(ResourceTypeEnum.Adapter.class) + public enum ResourceTypeEnum { + DESTINATION("DESTINATION"), - public CreateFunctionV1Input() { - } + INSERT_DESTINATION("INSERT_DESTINATION"), - public CreateFunctionV1Input code(String code) { - - this.code = code; - return this; - } + INSERT_SOURCE("INSERT_SOURCE"), - /** - * The Function code. - * @return code - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Function code.") + SOURCE("SOURCE"); - public String getCode() { - return code; - } + private String value; + ResourceTypeEnum(String value) { + this.value = value; + } - public void setCode(String code) { - this.code = code; - } + public String getValue() { + return value; + } + @Override + public String toString() { + return String.valueOf(value); + } - public CreateFunctionV1Input settings(List settings) { - - this.settings = settings; - return this; - } + public static ResourceTypeEnum fromValue(String value) { + for (ResourceTypeEnum b : ResourceTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public CreateFunctionV1Input addSettingsItem(FunctionSettingV1 settingsItem) { - if (this.settings == null) { - this.settings = new ArrayList<>(); + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ResourceTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ResourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ResourceTypeEnum.fromValue(value); + } + } } - this.settings.add(settingsItem); - return this; - } - /** - * The list of settings for this Function. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The list of settings for this Function.") + public static final String SERIALIZED_NAME_RESOURCE_TYPE = "resourceType"; + + @SerializedName(SERIALIZED_NAME_RESOURCE_TYPE) + private ResourceTypeEnum resourceType; - public List getSettings() { - return settings; - } + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - public void setSettings(List settings) { - this.settings = settings; - } + public CreateFunctionV1Input() {} + public CreateFunctionV1Input code(String code) { - public CreateFunctionV1Input displayName(String displayName) { - - this.displayName = displayName; - return this; - } + this.code = code; + return this; + } - /** - * A display name for this Function. Note that Destination Functions append the Workspace to the display name. - * @return displayName - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A display name for this Function. Note that Destination Functions append the Workspace to the display name.") + /** + * The Function code. + * + * @return code + */ + @javax.annotation.Nonnull + public String getCode() { + return code; + } - public String getDisplayName() { - return displayName; - } + public void setCode(String code) { + this.code = code; + } + public CreateFunctionV1Input settings(List settings) { + + this.settings = settings; + return this; + } - public void setDisplayName(String displayName) { - this.displayName = displayName; - } + public CreateFunctionV1Input addSettingsItem(FunctionSettingV1 settingsItem) { + if (this.settings == null) { + this.settings = new ArrayList<>(); + } + this.settings.add(settingsItem); + return this; + } + /** + * The list of settings for this Function. + * + * @return settings + */ + @javax.annotation.Nullable + public List getSettings() { + return settings; + } - public CreateFunctionV1Input logoUrl(String logoUrl) { - - this.logoUrl = logoUrl; - return this; - } + public void setSettings(List settings) { + this.settings = settings; + } - /** - * The URL of the logo for this Function. - * @return logoUrl - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The URL of the logo for this Function.") + public CreateFunctionV1Input displayName(String displayName) { - public String getLogoUrl() { - return logoUrl; - } + this.displayName = displayName; + return this; + } + /** + * A display name for this Function. Note that Destination Functions append the Workspace to the + * display name. + * + * @return displayName + */ + @javax.annotation.Nonnull + public String getDisplayName() { + return displayName; + } - public void setLogoUrl(String logoUrl) { - this.logoUrl = logoUrl; - } + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + public CreateFunctionV1Input logoUrl(String logoUrl) { - public CreateFunctionV1Input resourceType(ResourceTypeEnum resourceType) { - - this.resourceType = resourceType; - return this; - } + this.logoUrl = logoUrl; + return this; + } - /** - * The Function type. Config API note: equal to `type`. - * @return resourceType - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Function type. Config API note: equal to `type`.") + /** + * The URL of the logo for this Function. + * + * @return logoUrl + */ + @javax.annotation.Nullable + public String getLogoUrl() { + return logoUrl; + } - public ResourceTypeEnum getResourceType() { - return resourceType; - } + public void setLogoUrl(String logoUrl) { + this.logoUrl = logoUrl; + } + public CreateFunctionV1Input resourceType(ResourceTypeEnum resourceType) { - public void setResourceType(ResourceTypeEnum resourceType) { - this.resourceType = resourceType; - } + this.resourceType = resourceType; + return this; + } + /** + * The Function type. Config API note: equal to `type`. + * + * @return resourceType + */ + @javax.annotation.Nonnull + public ResourceTypeEnum getResourceType() { + return resourceType; + } - public CreateFunctionV1Input description(String description) { - - this.description = description; - return this; - } + public void setResourceType(ResourceTypeEnum resourceType) { + this.resourceType = resourceType; + } - /** - * A description for this Function. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A description for this Function.") + public CreateFunctionV1Input description(String description) { - public String getDescription() { - return description; - } + this.description = description; + return this; + } + /** + * A description for this Function. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = 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; + } + CreateFunctionV1Input createFunctionV1Input = (CreateFunctionV1Input) o; + return Objects.equals(this.code, createFunctionV1Input.code) + && Objects.equals(this.settings, createFunctionV1Input.settings) + && Objects.equals(this.displayName, createFunctionV1Input.displayName) + && Objects.equals(this.logoUrl, createFunctionV1Input.logoUrl) + && Objects.equals(this.resourceType, createFunctionV1Input.resourceType) + && Objects.equals(this.description, createFunctionV1Input.description); + } + @Override + public int hashCode() { + return Objects.hash(code, settings, displayName, logoUrl, resourceType, description); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFunctionV1Input {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" logoUrl: ").append(toIndentedString(logoUrl)).append("\n"); + sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateFunctionV1Input createFunctionV1Input = (CreateFunctionV1Input) o; - return Objects.equals(this.code, createFunctionV1Input.code) && - Objects.equals(this.settings, createFunctionV1Input.settings) && - Objects.equals(this.displayName, createFunctionV1Input.displayName) && - Objects.equals(this.logoUrl, createFunctionV1Input.logoUrl) && - Objects.equals(this.resourceType, createFunctionV1Input.resourceType) && - Objects.equals(this.description, createFunctionV1Input.description); - } - - @Override - public int hashCode() { - return Objects.hash(code, settings, displayName, logoUrl, resourceType, description); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateFunctionV1Input {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); - sb.append(" logoUrl: ").append(toIndentedString(logoUrl)).append("\n"); - sb.append(" resourceType: ").append(toIndentedString(resourceType)).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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("settings"); + openapiFields.add("displayName"); + openapiFields.add("logoUrl"); + openapiFields.add("resourceType"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("code"); + openapiRequiredFields.add("displayName"); + openapiRequiredFields.add("resourceType"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("code"); - openapiFields.add("settings"); - openapiFields.add("displayName"); - openapiFields.add("logoUrl"); - openapiFields.add("resourceType"); - openapiFields.add("description"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("code"); - openapiRequiredFields.add("displayName"); - openapiRequiredFields.add("resourceType"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateFunctionV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateFunctionV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFunctionV1Input is not found in the empty JSON string", CreateFunctionV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateFunctionV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFunctionV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateFunctionV1Input is not found in" + + " the empty JSON string", + CreateFunctionV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateFunctionV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFunctionV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFunctionV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateFunctionV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateFunctionV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFunctionV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } } - } - if (!jsonObj.get("code").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); - } - if (jsonObj.get("settings") != null && !jsonObj.get("settings").isJsonNull()) { - JsonArray jsonArraysettings = jsonObj.getAsJsonArray("settings"); - if (jsonArraysettings != null) { - // ensure the json data is an array - if (!jsonObj.get("settings").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `settings` to be an array in the JSON string but got `%s`", jsonObj.get("settings").toString())); - } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if (jsonObj.get("settings") != null && !jsonObj.get("settings").isJsonNull()) { + JsonArray jsonArraysettings = jsonObj.getAsJsonArray("settings"); + if (jsonArraysettings != null) { + // ensure the json data is an array + if (!jsonObj.get("settings").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `settings` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("settings").toString())); + } + + // validate the optional field `settings` (array) + for (int i = 0; i < jsonArraysettings.size(); i++) { + FunctionSettingV1.validateJsonElement(jsonArraysettings.get(i)); + } + ; + } + } + if (!jsonObj.get("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `displayName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("displayName").toString())); + } + if ((jsonObj.get("logoUrl") != null && !jsonObj.get("logoUrl").isJsonNull()) + && !jsonObj.get("logoUrl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `logoUrl` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("logoUrl").toString())); + } + if (!jsonObj.get("resourceType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `resourceType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("resourceType").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("displayName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayName").toString())); - } - if ((jsonObj.get("logoUrl") != null && !jsonObj.get("logoUrl").isJsonNull()) && !jsonObj.get("logoUrl").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `logoUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("logoUrl").toString())); - } - if (!jsonObj.get("resourceType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `resourceType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resourceType").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 (!CreateFunctionV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateFunctionV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateFunctionV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateFunctionV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateFunctionV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateFunctionV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateFunctionV1Input - * @throws IOException if the JSON string is invalid with respect to CreateFunctionV1Input - */ - public static CreateFunctionV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateFunctionV1Input.class); - } - - /** - * Convert an instance of CreateFunctionV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFunctionV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFunctionV1Input' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateFunctionV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFunctionV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFunctionV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFunctionV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFunctionV1Input + * @throws IOException if the JSON string is invalid with respect to CreateFunctionV1Input + */ + public static CreateFunctionV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFunctionV1Input.class); + } + + /** + * Convert an instance of CreateFunctionV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateFunctionV1Output.java b/src/main/java/com/segment/publicapi/models/CreateFunctionV1Output.java index b26e70f3..8e9cdcef 100644 --- a/src/main/java/com/segment/publicapi/models/CreateFunctionV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateFunctionV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Function1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Create a Function. - */ -@ApiModel(description = "Create a Function.") - +/** Create a Function. */ public class CreateFunctionV1Output { - public static final String SERIALIZED_NAME_FUNCTION = "function"; - @SerializedName(SERIALIZED_NAME_FUNCTION) - private Function1 function; + public static final String SERIALIZED_NAME_FUNCTION = "function"; - public CreateFunctionV1Output() { - } + @SerializedName(SERIALIZED_NAME_FUNCTION) + private FunctionV1 function; - public CreateFunctionV1Output function(Function1 function) { - - this.function = function; - return this; - } + public CreateFunctionV1Output() {} - /** - * Get function - * @return function - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateFunctionV1Output function(FunctionV1 function) { - public Function1 getFunction() { - return function; - } + this.function = function; + return this; + } + /** + * Get function + * + * @return function + */ + @javax.annotation.Nonnull + public FunctionV1 getFunction() { + return function; + } - public void setFunction(Function1 function) { - this.function = function; - } + public void setFunction(FunctionV1 function) { + this.function = function; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFunctionV1Output createFunctionV1Output = (CreateFunctionV1Output) o; + return Objects.equals(this.function, createFunctionV1Output.function); + } + @Override + public int hashCode() { + return Objects.hash(function); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFunctionV1Output {\n"); + sb.append(" function: ").append(toIndentedString(function)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateFunctionV1Output createFunctionV1Output = (CreateFunctionV1Output) o; - return Objects.equals(this.function, createFunctionV1Output.function); - } - - @Override - public int hashCode() { - return Objects.hash(function); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateFunctionV1Output {\n"); - sb.append(" function: ").append(toIndentedString(function)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("function"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("function"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("function"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("function"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateFunctionV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateFunctionV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFunctionV1Output is not found in the empty JSON string", CreateFunctionV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateFunctionV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFunctionV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateFunctionV1Output is not found in" + + " the empty JSON string", + CreateFunctionV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateFunctionV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFunctionV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFunctionV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateFunctionV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateFunctionV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFunctionV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `function` + FunctionV1.validateJsonElement(jsonObj.get("function")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateFunctionV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateFunctionV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateFunctionV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateFunctionV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateFunctionV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFunctionV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFunctionV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateFunctionV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFunctionV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFunctionV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFunctionV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFunctionV1Output + * @throws IOException if the JSON string is invalid with respect to CreateFunctionV1Output + */ + public static CreateFunctionV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFunctionV1Output.class); } - } - - /** - * Create an instance of CreateFunctionV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateFunctionV1Output - * @throws IOException if the JSON string is invalid with respect to CreateFunctionV1Output - */ - public static CreateFunctionV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateFunctionV1Output.class); - } - - /** - * Convert an instance of CreateFunctionV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateFunctionV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateInsertFunctionInstance200Response.java b/src/main/java/com/segment/publicapi/models/CreateInsertFunctionInstance200Response.java new file mode 100644 index 00000000..afc4196e --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateInsertFunctionInstance200Response.java @@ -0,0 +1,206 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateInsertFunctionInstance200Response */ +public class CreateInsertFunctionInstance200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateInsertFunctionInstanceAlphaOutput data; + + public CreateInsertFunctionInstance200Response() {} + + public CreateInsertFunctionInstance200Response data( + CreateInsertFunctionInstanceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateInsertFunctionInstanceAlphaOutput getData() { + return data; + } + + public void setData(CreateInsertFunctionInstanceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateInsertFunctionInstance200Response createInsertFunctionInstance200Response = + (CreateInsertFunctionInstance200Response) o; + return Objects.equals(this.data, createInsertFunctionInstance200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateInsertFunctionInstance200Response {\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 + * CreateInsertFunctionInstance200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateInsertFunctionInstance200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " CreateInsertFunctionInstance200Response is not found in the" + + " empty JSON string", + CreateInsertFunctionInstance200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateInsertFunctionInstance200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateInsertFunctionInstance200Response` 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()) { + CreateInsertFunctionInstanceAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateInsertFunctionInstance200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'CreateInsertFunctionInstance200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateInsertFunctionInstance200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CreateInsertFunctionInstance200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateInsertFunctionInstance200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateInsertFunctionInstance200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateInsertFunctionInstance200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateInsertFunctionInstance200Response + */ + public static CreateInsertFunctionInstance200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateInsertFunctionInstance200Response.class); + } + + /** + * Convert an instance of CreateInsertFunctionInstance200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateInsertFunctionInstanceAlphaInput.java b/src/main/java/com/segment/publicapi/models/CreateInsertFunctionInstanceAlphaInput.java new file mode 100644 index 00000000..e7148225 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateInsertFunctionInstanceAlphaInput.java @@ -0,0 +1,358 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Creates an insert Function instance. */ +public class CreateInsertFunctionInstanceAlphaInput { + public static final String SERIALIZED_NAME_FUNCTION_ID = "functionId"; + + @SerializedName(SERIALIZED_NAME_FUNCTION_ID) + private String functionId; + + public static final String SERIALIZED_NAME_INTEGRATION_ID = "integrationId"; + + @SerializedName(SERIALIZED_NAME_INTEGRATION_ID) + private String integrationId; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_SETTINGS = "settings"; + + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings = new HashMap<>(); + + public CreateInsertFunctionInstanceAlphaInput() {} + + public CreateInsertFunctionInstanceAlphaInput functionId(String functionId) { + + this.functionId = functionId; + return this; + } + + /** + * Insert Function id to which this instance is associated. Note: Remove the ifnd_/ifns_ prefix + * from the id. + * + * @return functionId + */ + @javax.annotation.Nonnull + public String getFunctionId() { + return functionId; + } + + public void setFunctionId(String functionId) { + this.functionId = functionId; + } + + public CreateInsertFunctionInstanceAlphaInput integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The Source or Destination id to be connected. + * + * @return integrationId + */ + @javax.annotation.Nonnull + public String getIntegrationId() { + return integrationId; + } + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + public CreateInsertFunctionInstanceAlphaInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Whether this insert Function instance should be enabled for the Destination. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public CreateInsertFunctionInstanceAlphaInput name(String name) { + + this.name = name; + return this; + } + + /** + * Defines the display name of the insert Function instance. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreateInsertFunctionInstanceAlphaInput settings(Map settings) { + + this.settings = settings; + return this; + } + + public CreateInsertFunctionInstanceAlphaInput putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + + /** + * An object that contains settings for this insert Function instance based on the settings + * present in the insert Function class. + * + * @return settings + */ + @javax.annotation.Nonnull + public Map getSettings() { + return settings; + } + + public void setSettings(Map settings) { + this.settings = settings; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateInsertFunctionInstanceAlphaInput createInsertFunctionInstanceAlphaInput = + (CreateInsertFunctionInstanceAlphaInput) o; + return Objects.equals(this.functionId, createInsertFunctionInstanceAlphaInput.functionId) + && Objects.equals( + this.integrationId, createInsertFunctionInstanceAlphaInput.integrationId) + && Objects.equals(this.enabled, createInsertFunctionInstanceAlphaInput.enabled) + && Objects.equals(this.name, createInsertFunctionInstanceAlphaInput.name) + && Objects.equals(this.settings, createInsertFunctionInstanceAlphaInput.settings); + } + + @Override + public int hashCode() { + return Objects.hash(functionId, integrationId, enabled, name, settings); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateInsertFunctionInstanceAlphaInput {\n"); + sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("functionId"); + openapiFields.add("integrationId"); + openapiFields.add("enabled"); + openapiFields.add("name"); + openapiFields.add("settings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("functionId"); + openapiRequiredFields.add("integrationId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("settings"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateInsertFunctionInstanceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateInsertFunctionInstanceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateInsertFunctionInstanceAlphaInput" + + " is not found in the empty JSON string", + CreateInsertFunctionInstanceAlphaInput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateInsertFunctionInstanceAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateInsertFunctionInstanceAlphaInput` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateInsertFunctionInstanceAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("functionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `functionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("functionId").toString())); + } + if (!jsonObj.get("integrationId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `integrationId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("integrationId").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 (!CreateInsertFunctionInstanceAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateInsertFunctionInstanceAlphaInput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateInsertFunctionInstanceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CreateInsertFunctionInstanceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateInsertFunctionInstanceAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateInsertFunctionInstanceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateInsertFunctionInstanceAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * CreateInsertFunctionInstanceAlphaInput + */ + public static CreateInsertFunctionInstanceAlphaInput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateInsertFunctionInstanceAlphaInput.class); + } + + /** + * Convert an instance of CreateInsertFunctionInstanceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateInsertFunctionInstanceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/CreateInsertFunctionInstanceAlphaOutput.java new file mode 100644 index 00000000..40766a76 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateInsertFunctionInstanceAlphaOutput.java @@ -0,0 +1,219 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Creates an insert Function instance. */ +public class CreateInsertFunctionInstanceAlphaOutput { + public static final String SERIALIZED_NAME_INSERT_FUNCTION_INSTANCE = "insertFunctionInstance"; + + @SerializedName(SERIALIZED_NAME_INSERT_FUNCTION_INSTANCE) + private InsertFunctionInstanceAlpha insertFunctionInstance; + + public CreateInsertFunctionInstanceAlphaOutput() {} + + public CreateInsertFunctionInstanceAlphaOutput insertFunctionInstance( + InsertFunctionInstanceAlpha insertFunctionInstance) { + + this.insertFunctionInstance = insertFunctionInstance; + return this; + } + + /** + * Get insertFunctionInstance + * + * @return insertFunctionInstance + */ + @javax.annotation.Nonnull + public InsertFunctionInstanceAlpha getInsertFunctionInstance() { + return insertFunctionInstance; + } + + public void setInsertFunctionInstance(InsertFunctionInstanceAlpha insertFunctionInstance) { + this.insertFunctionInstance = insertFunctionInstance; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateInsertFunctionInstanceAlphaOutput createInsertFunctionInstanceAlphaOutput = + (CreateInsertFunctionInstanceAlphaOutput) o; + return Objects.equals( + this.insertFunctionInstance, + createInsertFunctionInstanceAlphaOutput.insertFunctionInstance); + } + + @Override + public int hashCode() { + return Objects.hash(insertFunctionInstance); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateInsertFunctionInstanceAlphaOutput {\n"); + sb.append(" insertFunctionInstance: ") + .append(toIndentedString(insertFunctionInstance)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("insertFunctionInstance"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("insertFunctionInstance"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateInsertFunctionInstanceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateInsertFunctionInstanceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " CreateInsertFunctionInstanceAlphaOutput is not found in the" + + " empty JSON string", + CreateInsertFunctionInstanceAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateInsertFunctionInstanceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateInsertFunctionInstanceAlphaOutput` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateInsertFunctionInstanceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `insertFunctionInstance` + InsertFunctionInstanceAlpha.validateJsonElement(jsonObj.get("insertFunctionInstance")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateInsertFunctionInstanceAlphaOutput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'CreateInsertFunctionInstanceAlphaOutput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateInsertFunctionInstanceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CreateInsertFunctionInstanceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateInsertFunctionInstanceAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateInsertFunctionInstanceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateInsertFunctionInstanceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * CreateInsertFunctionInstanceAlphaOutput + */ + public static CreateInsertFunctionInstanceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateInsertFunctionInstanceAlphaOutput.class); + } + + /** + * Convert an instance of CreateInsertFunctionInstanceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateInvites200Response.java b/src/main/java/com/segment/publicapi/models/CreateInvites200Response.java deleted file mode 100644 index c8c3a9b6..00000000 --- a/src/main/java/com/segment/publicapi/models/CreateInvites200Response.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateInvitesV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * CreateInvites200Response - */ - -public class CreateInvites200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateInvitesV1Output data; - - public CreateInvites200Response() { - } - - public CreateInvites200Response data(CreateInvitesV1Output data) { - - this.data = data; - return this; - } - - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public CreateInvitesV1Output getData() { - return data; - } - - - public void setData(CreateInvitesV1Output data) { - this.data = data; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateInvites200Response createInvites200Response = (CreateInvites200Response) o; - return Objects.equals(this.data, createInvites200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateInvites200Response {\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateInvites200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateInvites200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateInvites200Response is not found in the empty JSON string", CreateInvites200Response.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateInvites200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateInvites200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateInvites200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateInvites200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateInvites200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateInvites200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateInvites200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of CreateInvites200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateInvites200Response - * @throws IOException if the JSON string is invalid with respect to CreateInvites200Response - */ - public static CreateInvites200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateInvites200Response.class); - } - - /** - * Convert an instance of CreateInvites200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/CreateInvites201Response.java b/src/main/java/com/segment/publicapi/models/CreateInvites201Response.java new file mode 100644 index 00000000..f9becd5f --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateInvites201Response.java @@ -0,0 +1,194 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateInvites201Response */ +public class CreateInvites201Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateInvitesV1Output data; + + public CreateInvites201Response() {} + + public CreateInvites201Response data(CreateInvitesV1Output data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateInvitesV1Output getData() { + return data; + } + + public void setData(CreateInvitesV1Output data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateInvites201Response createInvites201Response = (CreateInvites201Response) o; + return Objects.equals(this.data, createInvites201Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateInvites201Response {\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 CreateInvites201Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateInvites201Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateInvites201Response is not found" + + " in the empty JSON string", + CreateInvites201Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateInvites201Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateInvites201Response` 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()) { + CreateInvitesV1Output.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateInvites201Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateInvites201Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateInvites201Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateInvites201Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateInvites201Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateInvites201Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateInvites201Response + * @throws IOException if the JSON string is invalid with respect to CreateInvites201Response + */ + public static CreateInvites201Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateInvites201Response.class); + } + + /** + * Convert an instance of CreateInvites201Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateInvitesV1Input.java b/src/main/java/com/segment/publicapi/models/CreateInvitesV1Input.java index 50136e91..4152a1f6 100644 --- a/src/main/java/com/segment/publicapi/models/CreateInvitesV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateInvitesV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,219 +9,218 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.InviteV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Invites a user to a Workspace with specified permissions. - */ -@ApiModel(description = "Invites a user to a Workspace with specified permissions.") - +/** Invites a user to a Workspace with specified permissions. */ public class CreateInvitesV1Input { - public static final String SERIALIZED_NAME_INVITES = "invites"; - @SerializedName(SERIALIZED_NAME_INVITES) - private List invites = new ArrayList<>(); + public static final String SERIALIZED_NAME_INVITES = "invites"; - public CreateInvitesV1Input() { - } + @SerializedName(SERIALIZED_NAME_INVITES) + private List invites = new ArrayList<>(); - public CreateInvitesV1Input invites(List invites) { - - this.invites = invites; - return this; - } + public CreateInvitesV1Input() {} - public CreateInvitesV1Input addInvitesItem(InviteV1 invitesItem) { - this.invites.add(invitesItem); - return this; - } + public CreateInvitesV1Input invites(List invites) { - /** - * The list of invites. - * @return invites - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The list of invites.") + this.invites = invites; + return this; + } - public List getInvites() { - return invites; - } + public CreateInvitesV1Input addInvitesItem(InviteV1 invitesItem) { + if (this.invites == null) { + this.invites = new ArrayList<>(); + } + this.invites.add(invitesItem); + return this; + } + /** + * The list of invites. + * + * @return invites + */ + @javax.annotation.Nonnull + public List getInvites() { + return invites; + } - public void setInvites(List invites) { - this.invites = invites; - } + public void setInvites(List invites) { + this.invites = invites; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateInvitesV1Input createInvitesV1Input = (CreateInvitesV1Input) o; + return Objects.equals(this.invites, createInvitesV1Input.invites); + } + @Override + public int hashCode() { + return Objects.hash(invites); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateInvitesV1Input {\n"); + sb.append(" invites: ").append(toIndentedString(invites)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateInvitesV1Input createInvitesV1Input = (CreateInvitesV1Input) o; - return Objects.equals(this.invites, createInvitesV1Input.invites); - } - - @Override - public int hashCode() { - return Objects.hash(invites); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateInvitesV1Input {\n"); - sb.append(" invites: ").append(toIndentedString(invites)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("invites"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("invites"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("invites"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("invites"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateInvitesV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateInvitesV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateInvitesV1Input is not found in the empty JSON string", CreateInvitesV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateInvitesV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateInvitesV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateInvitesV1Input is not found in" + + " the empty JSON string", + CreateInvitesV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateInvitesV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateInvitesV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateInvitesV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateInvitesV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateInvitesV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateInvitesV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("invites").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `invites` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("invites").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("invites").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `invites` to be an array in the JSON string but got `%s`", jsonObj.get("invites").toString())); - } - JsonArray jsonArrayinvites = jsonObj.getAsJsonArray("invites"); - } + JsonArray jsonArrayinvites = jsonObj.getAsJsonArray("invites"); + // validate the required field `invites` (array) + for (int i = 0; i < jsonArrayinvites.size(); i++) { + InviteV1.validateJsonElement(jsonArrayinvites.get(i)); + } + ; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateInvitesV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateInvitesV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateInvitesV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateInvitesV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateInvitesV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateInvitesV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateInvitesV1Input' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateInvitesV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateInvitesV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateInvitesV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateInvitesV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateInvitesV1Input + * @throws IOException if the JSON string is invalid with respect to CreateInvitesV1Input + */ + public static CreateInvitesV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateInvitesV1Input.class); } - } - - /** - * Create an instance of CreateInvitesV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateInvitesV1Input - * @throws IOException if the JSON string is invalid with respect to CreateInvitesV1Input - */ - public static CreateInvitesV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateInvitesV1Input.class); - } - - /** - * Convert an instance of CreateInvitesV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateInvitesV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateInvitesV1Output.java b/src/main/java/com/segment/publicapi/models/CreateInvitesV1Output.java index b1179726..f644ee06 100644 --- a/src/main/java/com/segment/publicapi/models/CreateInvitesV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateInvitesV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,218 +9,214 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the emails of the invited users. - */ -@ApiModel(description = "Returns the emails of the invited users.") - +/** Returns the emails of the invited users. */ public class CreateInvitesV1Output { - public static final String SERIALIZED_NAME_EMAILS = "emails"; - @SerializedName(SERIALIZED_NAME_EMAILS) - private List emails = new ArrayList<>(); + public static final String SERIALIZED_NAME_EMAILS = "emails"; - public CreateInvitesV1Output() { - } + @SerializedName(SERIALIZED_NAME_EMAILS) + private List emails = new ArrayList<>(); - public CreateInvitesV1Output emails(List emails) { - - this.emails = emails; - return this; - } + public CreateInvitesV1Output() {} - public CreateInvitesV1Output addEmailsItem(String emailsItem) { - this.emails.add(emailsItem); - return this; - } + public CreateInvitesV1Output emails(List emails) { - /** - * The list of emails invited to the Workspace. - * @return emails - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The list of emails invited to the Workspace.") + this.emails = emails; + return this; + } - public List getEmails() { - return emails; - } + public CreateInvitesV1Output addEmailsItem(String emailsItem) { + if (this.emails == null) { + this.emails = new ArrayList<>(); + } + this.emails.add(emailsItem); + return this; + } + /** + * The list of emails invited to the Workspace. + * + * @return emails + */ + @javax.annotation.Nonnull + public List getEmails() { + return emails; + } - public void setEmails(List emails) { - this.emails = emails; - } + public void setEmails(List emails) { + this.emails = emails; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateInvitesV1Output createInvitesV1Output = (CreateInvitesV1Output) o; + return Objects.equals(this.emails, createInvitesV1Output.emails); + } + @Override + public int hashCode() { + return Objects.hash(emails); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateInvitesV1Output {\n"); + sb.append(" emails: ").append(toIndentedString(emails)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateInvitesV1Output createInvitesV1Output = (CreateInvitesV1Output) o; - return Objects.equals(this.emails, createInvitesV1Output.emails); - } - - @Override - public int hashCode() { - return Objects.hash(emails); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateInvitesV1Output {\n"); - sb.append(" emails: ").append(toIndentedString(emails)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("emails"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("emails"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("emails"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("emails"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateInvitesV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateInvitesV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateInvitesV1Output is not found in the empty JSON string", CreateInvitesV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateInvitesV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateInvitesV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateInvitesV1Output is not found in" + + " the empty JSON string", + CreateInvitesV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateInvitesV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateInvitesV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateInvitesV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateInvitesV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateInvitesV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateInvitesV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 required json array is present + if (jsonObj.get("emails") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("emails").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `emails` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("emails").toString())); } - } - // ensure the required json array is present - if (jsonObj.get("emails") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("emails").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `emails` to be an array in the JSON string but got `%s`", jsonObj.get("emails").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateInvitesV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateInvitesV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateInvitesV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateInvitesV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateInvitesV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateInvitesV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateInvitesV1Output - * @throws IOException if the JSON string is invalid with respect to CreateInvitesV1Output - */ - public static CreateInvitesV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateInvitesV1Output.class); - } - - /** - * Convert an instance of CreateInvitesV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateInvitesV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateInvitesV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateInvitesV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateInvitesV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateInvitesV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateInvitesV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateInvitesV1Output + * @throws IOException if the JSON string is invalid with respect to CreateInvitesV1Output + */ + public static CreateInvitesV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateInvitesV1Output.class); + } + + /** + * Convert an instance of CreateInvitesV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateLabel200Response.java b/src/main/java/com/segment/publicapi/models/CreateLabel200Response.java deleted file mode 100644 index 0cc9033f..00000000 --- a/src/main/java/com/segment/publicapi/models/CreateLabel200Response.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateLabelAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * CreateLabel200Response - */ - -public class CreateLabel200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateLabelAlphaOutput data; - - public CreateLabel200Response() { - } - - public CreateLabel200Response data(CreateLabelAlphaOutput data) { - - this.data = data; - return this; - } - - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public CreateLabelAlphaOutput getData() { - return data; - } - - - public void setData(CreateLabelAlphaOutput data) { - this.data = data; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateLabel200Response createLabel200Response = (CreateLabel200Response) o; - return Objects.equals(this.data, createLabel200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateLabel200Response {\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateLabel200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateLabel200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateLabel200Response is not found in the empty JSON string", CreateLabel200Response.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateLabel200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateLabel200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateLabel200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateLabel200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateLabel200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateLabel200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateLabel200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of CreateLabel200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateLabel200Response - * @throws IOException if the JSON string is invalid with respect to CreateLabel200Response - */ - public static CreateLabel200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateLabel200Response.class); - } - - /** - * Convert an instance of CreateLabel200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/CreateLabel200Response1.java b/src/main/java/com/segment/publicapi/models/CreateLabel200Response1.java deleted file mode 100644 index 374dee80..00000000 --- a/src/main/java/com/segment/publicapi/models/CreateLabel200Response1.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateLabelV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * CreateLabel200Response1 - */ - -public class CreateLabel200Response1 { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateLabelV1Output data; - - public CreateLabel200Response1() { - } - - public CreateLabel200Response1 data(CreateLabelV1Output data) { - - this.data = data; - return this; - } - - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public CreateLabelV1Output getData() { - return data; - } - - - public void setData(CreateLabelV1Output data) { - this.data = data; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateLabel200Response1 createLabel200Response1 = (CreateLabel200Response1) o; - return Objects.equals(this.data, createLabel200Response1.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateLabel200Response1 {\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateLabel200Response1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateLabel200Response1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateLabel200Response1 is not found in the empty JSON string", CreateLabel200Response1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateLabel200Response1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateLabel200Response1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateLabel200Response1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateLabel200Response1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateLabel200Response1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateLabel200Response1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateLabel200Response1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of CreateLabel200Response1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateLabel200Response1 - * @throws IOException if the JSON string is invalid with respect to CreateLabel200Response1 - */ - public static CreateLabel200Response1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateLabel200Response1.class); - } - - /** - * Convert an instance of CreateLabel200Response1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/CreateLabel201Response.java b/src/main/java/com/segment/publicapi/models/CreateLabel201Response.java new file mode 100644 index 00000000..b123643b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateLabel201Response.java @@ -0,0 +1,193 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateLabel201Response */ +public class CreateLabel201Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateLabelV1Output data; + + public CreateLabel201Response() {} + + public CreateLabel201Response data(CreateLabelV1Output data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateLabelV1Output getData() { + return data; + } + + public void setData(CreateLabelV1Output data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateLabel201Response createLabel201Response = (CreateLabel201Response) o; + return Objects.equals(this.data, createLabel201Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateLabel201Response {\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 CreateLabel201Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateLabel201Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateLabel201Response is not found in" + + " the empty JSON string", + CreateLabel201Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateLabel201Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateLabel201Response` 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()) { + CreateLabelV1Output.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateLabel201Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateLabel201Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateLabel201Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateLabel201Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateLabel201Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateLabel201Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateLabel201Response + * @throws IOException if the JSON string is invalid with respect to CreateLabel201Response + */ + public static CreateLabel201Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateLabel201Response.class); + } + + /** + * Convert an instance of CreateLabel201Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateLabelAlphaInput.java b/src/main/java/com/segment/publicapi/models/CreateLabelAlphaInput.java deleted file mode 100644 index 655c4954..00000000 --- a/src/main/java/com/segment/publicapi/models/CreateLabelAlphaInput.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Label; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * Creates a new label in the current Workspace. - */ -@ApiModel(description = "Creates a new label in the current Workspace.") - -public class CreateLabelAlphaInput { - public static final String SERIALIZED_NAME_LABEL = "label"; - @SerializedName(SERIALIZED_NAME_LABEL) - private Label label; - - public CreateLabelAlphaInput() { - } - - public CreateLabelAlphaInput label(Label label) { - - this.label = label; - return this; - } - - /** - * Get label - * @return label - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Label getLabel() { - return label; - } - - - public void setLabel(Label label) { - this.label = label; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateLabelAlphaInput createLabelAlphaInput = (CreateLabelAlphaInput) o; - return Objects.equals(this.label, createLabelAlphaInput.label); - } - - @Override - public int hashCode() { - return Objects.hash(label); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateLabelAlphaInput {\n"); - sb.append(" label: ").append(toIndentedString(label)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("label"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateLabelAlphaInput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateLabelAlphaInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateLabelAlphaInput is not found in the empty JSON string", CreateLabelAlphaInput.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateLabelAlphaInput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateLabelAlphaInput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateLabelAlphaInput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateLabelAlphaInput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateLabelAlphaInput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateLabelAlphaInput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateLabelAlphaInput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateLabelAlphaInput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of CreateLabelAlphaInput given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateLabelAlphaInput - * @throws IOException if the JSON string is invalid with respect to CreateLabelAlphaInput - */ - public static CreateLabelAlphaInput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateLabelAlphaInput.class); - } - - /** - * Convert an instance of CreateLabelAlphaInput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/CreateLabelAlphaOutput.java b/src/main/java/com/segment/publicapi/models/CreateLabelAlphaOutput.java deleted file mode 100644 index e1b3f994..00000000 --- a/src/main/java/com/segment/publicapi/models/CreateLabelAlphaOutput.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelAlpha; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * Result of creating a new label in the current Workspace. - */ -@ApiModel(description = "Result of creating a new label in the current Workspace.") - -public class CreateLabelAlphaOutput { - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = new ArrayList<>(); - - public CreateLabelAlphaOutput() { - } - - public CreateLabelAlphaOutput labels(List labels) { - - this.labels = labels; - return this; - } - - public CreateLabelAlphaOutput addLabelsItem(LabelAlpha labelsItem) { - this.labels.add(labelsItem); - return this; - } - - /** - * All labels associated with the current Workspace. - * @return labels - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "All labels associated with the current Workspace.") - - public List getLabels() { - return labels; - } - - - public void setLabels(List labels) { - this.labels = labels; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateLabelAlphaOutput createLabelAlphaOutput = (CreateLabelAlphaOutput) o; - return Objects.equals(this.labels, createLabelAlphaOutput.labels); - } - - @Override - public int hashCode() { - return Objects.hash(labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateLabelAlphaOutput {\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("labels"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateLabelAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateLabelAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateLabelAlphaOutput is not found in the empty JSON string", CreateLabelAlphaOutput.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateLabelAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateLabelAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateLabelAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); - } - } - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } - - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateLabelAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateLabelAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateLabelAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateLabelAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateLabelAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of CreateLabelAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateLabelAlphaOutput - * @throws IOException if the JSON string is invalid with respect to CreateLabelAlphaOutput - */ - public static CreateLabelAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateLabelAlphaOutput.class); - } - - /** - * Convert an instance of CreateLabelAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/CreateLabelV1Input.java b/src/main/java/com/segment/publicapi/models/CreateLabelV1Input.java index 7238fdab..b3e7f537 100644 --- a/src/main/java/com/segment/publicapi/models/CreateLabelV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateLabelV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Label1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Creates a new label in the current Workspace. - */ -@ApiModel(description = "Creates a new label in the current Workspace.") - +/** Creates a new label in the current Workspace. */ public class CreateLabelV1Input { - public static final String SERIALIZED_NAME_LABEL = "label"; - @SerializedName(SERIALIZED_NAME_LABEL) - private Label1 label; + public static final String SERIALIZED_NAME_LABEL = "label"; - public CreateLabelV1Input() { - } + @SerializedName(SERIALIZED_NAME_LABEL) + private LabelV1 label; - public CreateLabelV1Input label(Label1 label) { - - this.label = label; - return this; - } + public CreateLabelV1Input() {} - /** - * Get label - * @return label - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateLabelV1Input label(LabelV1 label) { - public Label1 getLabel() { - return label; - } + this.label = label; + return this; + } + /** + * Get label + * + * @return label + */ + @javax.annotation.Nonnull + public LabelV1 getLabel() { + return label; + } - public void setLabel(Label1 label) { - this.label = label; - } + public void setLabel(LabelV1 label) { + this.label = label; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateLabelV1Input createLabelV1Input = (CreateLabelV1Input) o; + return Objects.equals(this.label, createLabelV1Input.label); + } + @Override + public int hashCode() { + return Objects.hash(label); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateLabelV1Input {\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateLabelV1Input createLabelV1Input = (CreateLabelV1Input) o; - return Objects.equals(this.label, createLabelV1Input.label); - } - - @Override - public int hashCode() { - return Objects.hash(label); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateLabelV1Input {\n"); - sb.append(" label: ").append(toIndentedString(label)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("label"); } - return o.toString().replace("\n", "\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"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("label"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateLabelV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateLabelV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateLabelV1Input is not found in the empty JSON string", CreateLabelV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateLabelV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateLabelV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateLabelV1Input is not found in the" + + " empty JSON string", + CreateLabelV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateLabelV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateLabelV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateLabelV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateLabelV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateLabelV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateLabelV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `label` + LabelV1.validateJsonElement(jsonObj.get("label")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateLabelV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateLabelV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateLabelV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateLabelV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateLabelV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateLabelV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateLabelV1Input' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateLabelV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateLabelV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateLabelV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateLabelV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateLabelV1Input + * @throws IOException if the JSON string is invalid with respect to CreateLabelV1Input + */ + public static CreateLabelV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateLabelV1Input.class); } - } - - /** - * Create an instance of CreateLabelV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateLabelV1Input - * @throws IOException if the JSON string is invalid with respect to CreateLabelV1Input - */ - public static CreateLabelV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateLabelV1Input.class); - } - - /** - * Convert an instance of CreateLabelV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateLabelV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateLabelV1Output.java b/src/main/java/com/segment/publicapi/models/CreateLabelV1Output.java index b9b5ba78..a67e0fa2 100644 --- a/src/main/java/com/segment/publicapi/models/CreateLabelV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateLabelV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Label2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Result of creating a new label in the current Workspace. - */ -@ApiModel(description = "Result of creating a new label in the current Workspace.") - +/** Result of creating a new label in the current Workspace. */ public class CreateLabelV1Output { - public static final String SERIALIZED_NAME_LABEL = "label"; - @SerializedName(SERIALIZED_NAME_LABEL) - private Label2 label; + public static final String SERIALIZED_NAME_LABEL = "label"; - public CreateLabelV1Output() { - } + @SerializedName(SERIALIZED_NAME_LABEL) + private LabelV1 label; - public CreateLabelV1Output label(Label2 label) { - - this.label = label; - return this; - } + public CreateLabelV1Output() {} - /** - * Get label - * @return label - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateLabelV1Output label(LabelV1 label) { - public Label2 getLabel() { - return label; - } + this.label = label; + return this; + } + /** + * Get label + * + * @return label + */ + @javax.annotation.Nonnull + public LabelV1 getLabel() { + return label; + } - public void setLabel(Label2 label) { - this.label = label; - } + public void setLabel(LabelV1 label) { + this.label = label; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateLabelV1Output createLabelV1Output = (CreateLabelV1Output) o; + return Objects.equals(this.label, createLabelV1Output.label); + } + @Override + public int hashCode() { + return Objects.hash(label); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateLabelV1Output {\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateLabelV1Output createLabelV1Output = (CreateLabelV1Output) o; - return Objects.equals(this.label, createLabelV1Output.label); - } - - @Override - public int hashCode() { - return Objects.hash(label); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateLabelV1Output {\n"); - sb.append(" label: ").append(toIndentedString(label)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("label"); } - return o.toString().replace("\n", "\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"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("label"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateLabelV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateLabelV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateLabelV1Output is not found in the empty JSON string", CreateLabelV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateLabelV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateLabelV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateLabelV1Output is not found in" + + " the empty JSON string", + CreateLabelV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateLabelV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateLabelV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateLabelV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateLabelV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateLabelV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateLabelV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `label` + LabelV1.validateJsonElement(jsonObj.get("label")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateLabelV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateLabelV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateLabelV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateLabelV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateLabelV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateLabelV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateLabelV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateLabelV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateLabelV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateLabelV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateLabelV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateLabelV1Output + * @throws IOException if the JSON string is invalid with respect to CreateLabelV1Output + */ + public static CreateLabelV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateLabelV1Output.class); } - } - - /** - * Create an instance of CreateLabelV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateLabelV1Output - * @throws IOException if the JSON string is invalid with respect to CreateLabelV1Output - */ - public static CreateLabelV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateLabelV1Output.class); - } - - /** - * Convert an instance of CreateLabelV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateLabelV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateProfilesWarehouse201Response.java b/src/main/java/com/segment/publicapi/models/CreateProfilesWarehouse201Response.java new file mode 100644 index 00000000..a1612ed3 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateProfilesWarehouse201Response.java @@ -0,0 +1,201 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateProfilesWarehouse201Response */ +public class CreateProfilesWarehouse201Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateProfilesWarehouseAlphaOutput data; + + public CreateProfilesWarehouse201Response() {} + + public CreateProfilesWarehouse201Response data(CreateProfilesWarehouseAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateProfilesWarehouseAlphaOutput getData() { + return data; + } + + public void setData(CreateProfilesWarehouseAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateProfilesWarehouse201Response createProfilesWarehouse201Response = + (CreateProfilesWarehouse201Response) o; + return Objects.equals(this.data, createProfilesWarehouse201Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateProfilesWarehouse201Response {\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 + * CreateProfilesWarehouse201Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateProfilesWarehouse201Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateProfilesWarehouse201Response is" + + " not found in the empty JSON string", + CreateProfilesWarehouse201Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateProfilesWarehouse201Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateProfilesWarehouse201Response` 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()) { + CreateProfilesWarehouseAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateProfilesWarehouse201Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateProfilesWarehouse201Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateProfilesWarehouse201Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateProfilesWarehouse201Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateProfilesWarehouse201Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateProfilesWarehouse201Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateProfilesWarehouse201Response + * @throws IOException if the JSON string is invalid with respect to + * CreateProfilesWarehouse201Response + */ + public static CreateProfilesWarehouse201Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateProfilesWarehouse201Response.class); + } + + /** + * Convert an instance of CreateProfilesWarehouse201Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateProfilesWarehouseAlphaInput.java b/src/main/java/com/segment/publicapi/models/CreateProfilesWarehouseAlphaInput.java new file mode 100644 index 00000000..0ef56ddf --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateProfilesWarehouseAlphaInput.java @@ -0,0 +1,354 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Create a new Profiles Warehouse based on a set of parameters. */ +public class CreateProfilesWarehouseAlphaInput { + public static final String SERIALIZED_NAME_METADATA_ID = "metadataId"; + + @SerializedName(SERIALIZED_NAME_METADATA_ID) + private String metadataId; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_SETTINGS = "settings"; + + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; + + public static final String SERIALIZED_NAME_SCHEMA_NAME = "schemaName"; + + @SerializedName(SERIALIZED_NAME_SCHEMA_NAME) + private String schemaName; + + public CreateProfilesWarehouseAlphaInput() {} + + public CreateProfilesWarehouseAlphaInput metadataId(String metadataId) { + + this.metadataId = metadataId; + return this; + } + + /** + * The Warehouse metadata to use. + * + * @return metadataId + */ + @javax.annotation.Nonnull + public String getMetadataId() { + return metadataId; + } + + public void setMetadataId(String metadataId) { + this.metadataId = metadataId; + } + + public CreateProfilesWarehouseAlphaInput name(String name) { + + this.name = name; + return this; + } + + /** + * An optional human-readable name for this Warehouse. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreateProfilesWarehouseAlphaInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Enable to allow this Warehouse to receive data. Defaults to true. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public CreateProfilesWarehouseAlphaInput settings(Map settings) { + + this.settings = settings; + return this; + } + + public CreateProfilesWarehouseAlphaInput putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + + /** + * A key-value object that contains instance-specific Warehouse settings. + * + * @return settings + */ + @javax.annotation.Nonnull + public Map getSettings() { + return settings; + } + + public void setSettings(Map settings) { + this.settings = settings; + } + + public CreateProfilesWarehouseAlphaInput schemaName(String schemaName) { + + this.schemaName = schemaName; + return this; + } + + /** + * The custom schema name that Segment uses on the Warehouse side. The space slug value is + * default otherwise. The schema name cannot be an existing schema name in the Warehouse. To use + * an existing schema name, please create a profiles Warehouse through the Segment app UI. + * + * @return schemaName + */ + @javax.annotation.Nullable + public String getSchemaName() { + return schemaName; + } + + public void setSchemaName(String schemaName) { + this.schemaName = schemaName; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateProfilesWarehouseAlphaInput createProfilesWarehouseAlphaInput = + (CreateProfilesWarehouseAlphaInput) o; + return Objects.equals(this.metadataId, createProfilesWarehouseAlphaInput.metadataId) + && Objects.equals(this.name, createProfilesWarehouseAlphaInput.name) + && Objects.equals(this.enabled, createProfilesWarehouseAlphaInput.enabled) + && Objects.equals(this.settings, createProfilesWarehouseAlphaInput.settings) + && Objects.equals(this.schemaName, createProfilesWarehouseAlphaInput.schemaName); + } + + @Override + public int hashCode() { + return Objects.hash(metadataId, name, enabled, settings, schemaName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateProfilesWarehouseAlphaInput {\n"); + sb.append(" metadataId: ").append(toIndentedString(metadataId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" schemaName: ").append(toIndentedString(schemaName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("metadataId"); + openapiFields.add("name"); + openapiFields.add("enabled"); + openapiFields.add("settings"); + openapiFields.add("schemaName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("metadataId"); + openapiRequiredFields.add("settings"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateProfilesWarehouseAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateProfilesWarehouseAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateProfilesWarehouseAlphaInput is" + + " not found in the empty JSON string", + CreateProfilesWarehouseAlphaInput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateProfilesWarehouseAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateProfilesWarehouseAlphaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateProfilesWarehouseAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("metadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `metadataId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("metadataId").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("schemaName") != null && !jsonObj.get("schemaName").isJsonNull()) + && !jsonObj.get("schemaName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `schemaName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("schemaName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateProfilesWarehouseAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateProfilesWarehouseAlphaInput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateProfilesWarehouseAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateProfilesWarehouseAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateProfilesWarehouseAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateProfilesWarehouseAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateProfilesWarehouseAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * CreateProfilesWarehouseAlphaInput + */ + public static CreateProfilesWarehouseAlphaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateProfilesWarehouseAlphaInput.class); + } + + /** + * Convert an instance of CreateProfilesWarehouseAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateProfilesWarehouseAlphaOutput.java b/src/main/java/com/segment/publicapi/models/CreateProfilesWarehouseAlphaOutput.java new file mode 100644 index 00000000..8c320414 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateProfilesWarehouseAlphaOutput.java @@ -0,0 +1,214 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Returns the newly created Warehouse. */ +public class CreateProfilesWarehouseAlphaOutput { + public static final String SERIALIZED_NAME_PROFILES_WAREHOUSE = "profilesWarehouse"; + + @SerializedName(SERIALIZED_NAME_PROFILES_WAREHOUSE) + private ProfilesWarehouseAlpha profilesWarehouse; + + public CreateProfilesWarehouseAlphaOutput() {} + + public CreateProfilesWarehouseAlphaOutput profilesWarehouse( + ProfilesWarehouseAlpha profilesWarehouse) { + + this.profilesWarehouse = profilesWarehouse; + return this; + } + + /** + * Get profilesWarehouse + * + * @return profilesWarehouse + */ + @javax.annotation.Nonnull + public ProfilesWarehouseAlpha getProfilesWarehouse() { + return profilesWarehouse; + } + + public void setProfilesWarehouse(ProfilesWarehouseAlpha profilesWarehouse) { + this.profilesWarehouse = profilesWarehouse; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateProfilesWarehouseAlphaOutput createProfilesWarehouseAlphaOutput = + (CreateProfilesWarehouseAlphaOutput) o; + return Objects.equals( + this.profilesWarehouse, createProfilesWarehouseAlphaOutput.profilesWarehouse); + } + + @Override + public int hashCode() { + return Objects.hash(profilesWarehouse); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateProfilesWarehouseAlphaOutput {\n"); + sb.append(" profilesWarehouse: ") + .append(toIndentedString(profilesWarehouse)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("profilesWarehouse"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("profilesWarehouse"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateProfilesWarehouseAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateProfilesWarehouseAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateProfilesWarehouseAlphaOutput is" + + " not found in the empty JSON string", + CreateProfilesWarehouseAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateProfilesWarehouseAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateProfilesWarehouseAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateProfilesWarehouseAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `profilesWarehouse` + ProfilesWarehouseAlpha.validateJsonElement(jsonObj.get("profilesWarehouse")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateProfilesWarehouseAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateProfilesWarehouseAlphaOutput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateProfilesWarehouseAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateProfilesWarehouseAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateProfilesWarehouseAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateProfilesWarehouseAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateProfilesWarehouseAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * CreateProfilesWarehouseAlphaOutput + */ + public static CreateProfilesWarehouseAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateProfilesWarehouseAlphaOutput.class); + } + + /** + * Convert an instance of CreateProfilesWarehouseAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateReverseETLManualSync200Response.java b/src/main/java/com/segment/publicapi/models/CreateReverseETLManualSync200Response.java new file mode 100644 index 00000000..7ac4cd26 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateReverseETLManualSync200Response.java @@ -0,0 +1,203 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateReverseETLManualSync200Response */ +public class CreateReverseETLManualSync200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateReverseETLManualSyncOutput data; + + public CreateReverseETLManualSync200Response() {} + + public CreateReverseETLManualSync200Response data(CreateReverseETLManualSyncOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateReverseETLManualSyncOutput getData() { + return data; + } + + public void setData(CreateReverseETLManualSyncOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReverseETLManualSync200Response createReverseETLManualSync200Response = + (CreateReverseETLManualSync200Response) o; + return Objects.equals(this.data, createReverseETLManualSync200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateReverseETLManualSync200Response {\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 + * CreateReverseETLManualSync200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateReverseETLManualSync200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateReverseETLManualSync200Response" + + " is not found in the empty JSON string", + CreateReverseETLManualSync200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateReverseETLManualSync200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateReverseETLManualSync200Response` 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()) { + CreateReverseETLManualSyncOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateReverseETLManualSync200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateReverseETLManualSync200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateReverseETLManualSync200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CreateReverseETLManualSync200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateReverseETLManualSync200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateReverseETLManualSync200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateReverseETLManualSync200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateReverseETLManualSync200Response + */ + public static CreateReverseETLManualSync200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateReverseETLManualSync200Response.class); + } + + /** + * Convert an instance of CreateReverseETLManualSync200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateReverseETLManualSyncInput.java b/src/main/java/com/segment/publicapi/models/CreateReverseETLManualSyncInput.java new file mode 100644 index 00000000..e6cb5f8b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateReverseETLManualSyncInput.java @@ -0,0 +1,286 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Defines the parameters needed to trigger a manual sync for a RETL connection. */ +public class CreateReverseETLManualSyncInput { + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; + + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; + + public static final String SERIALIZED_NAME_MODEL_ID = "modelId"; + + @SerializedName(SERIALIZED_NAME_MODEL_ID) + private String modelId; + + public static final String SERIALIZED_NAME_SUBSCRIPTION_ID = "subscriptionId"; + + @SerializedName(SERIALIZED_NAME_SUBSCRIPTION_ID) + private String subscriptionId; + + public CreateReverseETLManualSyncInput() {} + + public CreateReverseETLManualSyncInput sourceId(String sourceId) { + + this.sourceId = sourceId; + return this; + } + + /** + * The id of the Source. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public CreateReverseETLManualSyncInput modelId(String modelId) { + + this.modelId = modelId; + return this; + } + + /** + * The id of the Model. + * + * @return modelId + */ + @javax.annotation.Nonnull + public String getModelId() { + return modelId; + } + + public void setModelId(String modelId) { + this.modelId = modelId; + } + + public CreateReverseETLManualSyncInput subscriptionId(String subscriptionId) { + + this.subscriptionId = subscriptionId; + return this; + } + + /** + * The id of the Subscription. + * + * @return subscriptionId + */ + @javax.annotation.Nonnull + public String getSubscriptionId() { + return subscriptionId; + } + + public void setSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReverseETLManualSyncInput createReverseETLManualSyncInput = + (CreateReverseETLManualSyncInput) o; + return Objects.equals(this.sourceId, createReverseETLManualSyncInput.sourceId) + && Objects.equals(this.modelId, createReverseETLManualSyncInput.modelId) + && Objects.equals( + this.subscriptionId, createReverseETLManualSyncInput.subscriptionId); + } + + @Override + public int hashCode() { + return Objects.hash(sourceId, modelId, subscriptionId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateReverseETLManualSyncInput {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" modelId: ").append(toIndentedString(modelId)).append("\n"); + sb.append(" subscriptionId: ").append(toIndentedString(subscriptionId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + openapiFields.add("modelId"); + openapiFields.add("subscriptionId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("modelId"); + openapiRequiredFields.add("subscriptionId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateReverseETLManualSyncInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateReverseETLManualSyncInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateReverseETLManualSyncInput is not" + + " found in the empty JSON string", + CreateReverseETLManualSyncInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateReverseETLManualSyncInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateReverseETLManualSyncInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateReverseETLManualSyncInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if (!jsonObj.get("modelId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `modelId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("modelId").toString())); + } + if (!jsonObj.get("subscriptionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `subscriptionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("subscriptionId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateReverseETLManualSyncInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateReverseETLManualSyncInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateReverseETLManualSyncInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateReverseETLManualSyncInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateReverseETLManualSyncInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateReverseETLManualSyncInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateReverseETLManualSyncInput + * @throws IOException if the JSON string is invalid with respect to + * CreateReverseETLManualSyncInput + */ + public static CreateReverseETLManualSyncInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateReverseETLManualSyncInput.class); + } + + /** + * Convert an instance of CreateReverseETLManualSyncInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateReverseETLManualSyncOutput.java b/src/main/java/com/segment/publicapi/models/CreateReverseETLManualSyncOutput.java new file mode 100644 index 00000000..c41f22aa --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateReverseETLManualSyncOutput.java @@ -0,0 +1,212 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output for triggering a manual sync for a RETL connection. */ +public class CreateReverseETLManualSyncOutput { + public static final String SERIALIZED_NAME_REVERSE_E_T_L_MANUAL_SYNC = "reverseETLManualSync"; + + @SerializedName(SERIALIZED_NAME_REVERSE_E_T_L_MANUAL_SYNC) + private ReverseETLManualSyncJobOutput reverseETLManualSync; + + public CreateReverseETLManualSyncOutput() {} + + public CreateReverseETLManualSyncOutput reverseETLManualSync( + ReverseETLManualSyncJobOutput reverseETLManualSync) { + + this.reverseETLManualSync = reverseETLManualSync; + return this; + } + + /** + * Get reverseETLManualSync + * + * @return reverseETLManualSync + */ + @javax.annotation.Nonnull + public ReverseETLManualSyncJobOutput getReverseETLManualSync() { + return reverseETLManualSync; + } + + public void setReverseETLManualSync(ReverseETLManualSyncJobOutput reverseETLManualSync) { + this.reverseETLManualSync = reverseETLManualSync; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReverseETLManualSyncOutput createReverseETLManualSyncOutput = + (CreateReverseETLManualSyncOutput) o; + return Objects.equals( + this.reverseETLManualSync, createReverseETLManualSyncOutput.reverseETLManualSync); + } + + @Override + public int hashCode() { + return Objects.hash(reverseETLManualSync); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateReverseETLManualSyncOutput {\n"); + sb.append(" reverseETLManualSync: ") + .append(toIndentedString(reverseETLManualSync)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reverseETLManualSync"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("reverseETLManualSync"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateReverseETLManualSyncOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateReverseETLManualSyncOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateReverseETLManualSyncOutput is" + + " not found in the empty JSON string", + CreateReverseETLManualSyncOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateReverseETLManualSyncOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateReverseETLManualSyncOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateReverseETLManualSyncOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `reverseETLManualSync` + ReverseETLManualSyncJobOutput.validateJsonElement(jsonObj.get("reverseETLManualSync")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateReverseETLManualSyncOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateReverseETLManualSyncOutput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateReverseETLManualSyncOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateReverseETLManualSyncOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateReverseETLManualSyncOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateReverseETLManualSyncOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateReverseETLManualSyncOutput + * @throws IOException if the JSON string is invalid with respect to + * CreateReverseETLManualSyncOutput + */ + public static CreateReverseETLManualSyncOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateReverseETLManualSyncOutput.class); + } + + /** + * Convert an instance of CreateReverseETLManualSyncOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateReverseEtlModel201Response.java b/src/main/java/com/segment/publicapi/models/CreateReverseEtlModel201Response.java new file mode 100644 index 00000000..4504dbef --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateReverseEtlModel201Response.java @@ -0,0 +1,199 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateReverseEtlModel201Response */ +public class CreateReverseEtlModel201Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateReverseEtlModelOutput data; + + public CreateReverseEtlModel201Response() {} + + public CreateReverseEtlModel201Response data(CreateReverseEtlModelOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateReverseEtlModelOutput getData() { + return data; + } + + public void setData(CreateReverseEtlModelOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReverseEtlModel201Response createReverseEtlModel201Response = + (CreateReverseEtlModel201Response) o; + return Objects.equals(this.data, createReverseEtlModel201Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateReverseEtlModel201Response {\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 + * CreateReverseEtlModel201Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateReverseEtlModel201Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateReverseEtlModel201Response is" + + " not found in the empty JSON string", + CreateReverseEtlModel201Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateReverseEtlModel201Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateReverseEtlModel201Response` 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()) { + CreateReverseEtlModelOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateReverseEtlModel201Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateReverseEtlModel201Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateReverseEtlModel201Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateReverseEtlModel201Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateReverseEtlModel201Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateReverseEtlModel201Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateReverseEtlModel201Response + * @throws IOException if the JSON string is invalid with respect to + * CreateReverseEtlModel201Response + */ + public static CreateReverseEtlModel201Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateReverseEtlModel201Response.class); + } + + /** + * Convert an instance of CreateReverseEtlModel201Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateReverseEtlModelInput.java b/src/main/java/com/segment/publicapi/models/CreateReverseEtlModelInput.java new file mode 100644 index 00000000..a1457b7c --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateReverseEtlModelInput.java @@ -0,0 +1,387 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Defines how to create a new Model. */ +public class CreateReverseEtlModelInput { + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; + + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_QUERY = "query"; + + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + + public static final String SERIALIZED_NAME_QUERY_IDENTIFIER_COLUMN = "queryIdentifierColumn"; + + @SerializedName(SERIALIZED_NAME_QUERY_IDENTIFIER_COLUMN) + private String queryIdentifierColumn; + + public CreateReverseEtlModelInput() {} + + public CreateReverseEtlModelInput sourceId(String sourceId) { + + this.sourceId = sourceId; + return this; + } + + /** + * Indicates which Source to attach this model to. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public CreateReverseEtlModelInput name(String name) { + + this.name = name; + return this; + } + + /** + * A short, human-readable description of the Model. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreateReverseEtlModelInput description(String description) { + + this.description = description; + return this; + } + + /** + * A longer, more descriptive explanation of the Model. + * + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CreateReverseEtlModelInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Indicates whether the Model should have syncs enabled. When disabled, no syncs will be + * triggered, regardless of the enabled status of the attached destinations/subscriptions. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public CreateReverseEtlModelInput query(String query) { + + this.query = query; + return this; + } + + /** + * The SQL query that will be executed to extract data from the connected Source. + * + * @return query + */ + @javax.annotation.Nonnull + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public CreateReverseEtlModelInput queryIdentifierColumn(String queryIdentifierColumn) { + + this.queryIdentifierColumn = queryIdentifierColumn; + return this; + } + + /** + * Indicates the column named in `query` that should be used to uniquely identify the + * extracted records. + * + * @return queryIdentifierColumn + */ + @javax.annotation.Nonnull + public String getQueryIdentifierColumn() { + return queryIdentifierColumn; + } + + public void setQueryIdentifierColumn(String queryIdentifierColumn) { + this.queryIdentifierColumn = queryIdentifierColumn; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReverseEtlModelInput createReverseEtlModelInput = (CreateReverseEtlModelInput) o; + return Objects.equals(this.sourceId, createReverseEtlModelInput.sourceId) + && Objects.equals(this.name, createReverseEtlModelInput.name) + && Objects.equals(this.description, createReverseEtlModelInput.description) + && Objects.equals(this.enabled, createReverseEtlModelInput.enabled) + && Objects.equals(this.query, createReverseEtlModelInput.query) + && Objects.equals( + this.queryIdentifierColumn, + createReverseEtlModelInput.queryIdentifierColumn); + } + + @Override + public int hashCode() { + return Objects.hash(sourceId, name, description, enabled, query, queryIdentifierColumn); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateReverseEtlModelInput {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" queryIdentifierColumn: ") + .append(toIndentedString(queryIdentifierColumn)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("enabled"); + openapiFields.add("query"); + openapiFields.add("queryIdentifierColumn"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("query"); + openapiRequiredFields.add("queryIdentifierColumn"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateReverseEtlModelInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateReverseEtlModelInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateReverseEtlModelInput is not" + + " found in the empty JSON string", + CreateReverseEtlModelInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateReverseEtlModelInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateReverseEtlModelInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateReverseEtlModelInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").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("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("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("queryIdentifierColumn").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `queryIdentifierColumn` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("queryIdentifierColumn").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateReverseEtlModelInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateReverseEtlModelInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateReverseEtlModelInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateReverseEtlModelInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateReverseEtlModelInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateReverseEtlModelInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateReverseEtlModelInput + * @throws IOException if the JSON string is invalid with respect to CreateReverseEtlModelInput + */ + public static CreateReverseEtlModelInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateReverseEtlModelInput.class); + } + + /** + * Convert an instance of CreateReverseEtlModelInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateReverseEtlModelOutput.java b/src/main/java/com/segment/publicapi/models/CreateReverseEtlModelOutput.java new file mode 100644 index 00000000..aa23e990 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateReverseEtlModelOutput.java @@ -0,0 +1,204 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Defines the results of creating a Model. */ +public class CreateReverseEtlModelOutput { + public static final String SERIALIZED_NAME_REVERSE_ETL_MODEL = "reverseEtlModel"; + + @SerializedName(SERIALIZED_NAME_REVERSE_ETL_MODEL) + private ReverseEtlModel reverseEtlModel; + + public CreateReverseEtlModelOutput() {} + + public CreateReverseEtlModelOutput reverseEtlModel(ReverseEtlModel reverseEtlModel) { + + this.reverseEtlModel = reverseEtlModel; + return this; + } + + /** + * Get reverseEtlModel + * + * @return reverseEtlModel + */ + @javax.annotation.Nonnull + public ReverseEtlModel getReverseEtlModel() { + return reverseEtlModel; + } + + public void setReverseEtlModel(ReverseEtlModel reverseEtlModel) { + this.reverseEtlModel = reverseEtlModel; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReverseEtlModelOutput createReverseEtlModelOutput = (CreateReverseEtlModelOutput) o; + return Objects.equals(this.reverseEtlModel, createReverseEtlModelOutput.reverseEtlModel); + } + + @Override + public int hashCode() { + return Objects.hash(reverseEtlModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateReverseEtlModelOutput {\n"); + sb.append(" reverseEtlModel: ").append(toIndentedString(reverseEtlModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reverseEtlModel"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("reverseEtlModel"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateReverseEtlModelOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateReverseEtlModelOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateReverseEtlModelOutput is not" + + " found in the empty JSON string", + CreateReverseEtlModelOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateReverseEtlModelOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateReverseEtlModelOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateReverseEtlModelOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `reverseEtlModel` + ReverseEtlModel.validateJsonElement(jsonObj.get("reverseEtlModel")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateReverseEtlModelOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateReverseEtlModelOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateReverseEtlModelOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateReverseEtlModelOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateReverseEtlModelOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateReverseEtlModelOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateReverseEtlModelOutput + * @throws IOException if the JSON string is invalid with respect to CreateReverseEtlModelOutput + */ + public static CreateReverseEtlModelOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateReverseEtlModelOutput.class); + } + + /** + * Convert an instance of CreateReverseEtlModelOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateSource200Response.java b/src/main/java/com/segment/publicapi/models/CreateSource200Response.java deleted file mode 100644 index f8b36225..00000000 --- a/src/main/java/com/segment/publicapi/models/CreateSource200Response.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateSourceAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * CreateSource200Response - */ - -public class CreateSource200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateSourceAlphaOutput data; - - public CreateSource200Response() { - } - - public CreateSource200Response data(CreateSourceAlphaOutput data) { - - this.data = data; - return this; - } - - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public CreateSourceAlphaOutput getData() { - return data; - } - - - public void setData(CreateSourceAlphaOutput data) { - this.data = data; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateSource200Response createSource200Response = (CreateSource200Response) o; - return Objects.equals(this.data, createSource200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateSource200Response {\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateSource200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateSource200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSource200Response is not found in the empty JSON string", CreateSource200Response.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateSource200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSource200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateSource200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateSource200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateSource200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateSource200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateSource200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of CreateSource200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateSource200Response - * @throws IOException if the JSON string is invalid with respect to CreateSource200Response - */ - public static CreateSource200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateSource200Response.class); - } - - /** - * Convert an instance of CreateSource200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/CreateSource200Response1.java b/src/main/java/com/segment/publicapi/models/CreateSource200Response1.java deleted file mode 100644 index 0901aa0a..00000000 --- a/src/main/java/com/segment/publicapi/models/CreateSource200Response1.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateSourceV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * CreateSource200Response1 - */ - -public class CreateSource200Response1 { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateSourceV1Output data; - - public CreateSource200Response1() { - } - - public CreateSource200Response1 data(CreateSourceV1Output data) { - - this.data = data; - return this; - } - - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public CreateSourceV1Output getData() { - return data; - } - - - public void setData(CreateSourceV1Output data) { - this.data = data; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateSource200Response1 createSource200Response1 = (CreateSource200Response1) o; - return Objects.equals(this.data, createSource200Response1.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateSource200Response1 {\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateSource200Response1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateSource200Response1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSource200Response1 is not found in the empty JSON string", CreateSource200Response1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateSource200Response1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSource200Response1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateSource200Response1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateSource200Response1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateSource200Response1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateSource200Response1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateSource200Response1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of CreateSource200Response1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateSource200Response1 - * @throws IOException if the JSON string is invalid with respect to CreateSource200Response1 - */ - public static CreateSource200Response1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateSource200Response1.class); - } - - /** - * Convert an instance of CreateSource200Response1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/CreateSource201Response.java b/src/main/java/com/segment/publicapi/models/CreateSource201Response.java new file mode 100644 index 00000000..3d411bc5 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateSource201Response.java @@ -0,0 +1,194 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateSource201Response */ +public class CreateSource201Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateSourceV1Output data; + + public CreateSource201Response() {} + + public CreateSource201Response data(CreateSourceV1Output data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateSourceV1Output getData() { + return data; + } + + public void setData(CreateSourceV1Output data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSource201Response createSource201Response = (CreateSource201Response) o; + return Objects.equals(this.data, createSource201Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSource201Response {\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 CreateSource201Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSource201Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateSource201Response is not found" + + " in the empty JSON string", + CreateSource201Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSource201Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateSource201Response` 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()) { + CreateSourceV1Output.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSource201Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSource201Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateSource201Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSource201Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSource201Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSource201Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSource201Response + * @throws IOException if the JSON string is invalid with respect to CreateSource201Response + */ + public static CreateSource201Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSource201Response.class); + } + + /** + * Convert an instance of CreateSource201Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateSource201Response1.java b/src/main/java/com/segment/publicapi/models/CreateSource201Response1.java new file mode 100644 index 00000000..e294804d --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateSource201Response1.java @@ -0,0 +1,194 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateSource201Response1 */ +public class CreateSource201Response1 { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateSourceAlphaOutput data; + + public CreateSource201Response1() {} + + public CreateSource201Response1 data(CreateSourceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateSourceAlphaOutput getData() { + return data; + } + + public void setData(CreateSourceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSource201Response1 createSource201Response1 = (CreateSource201Response1) o; + return Objects.equals(this.data, createSource201Response1.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSource201Response1 {\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 CreateSource201Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSource201Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateSource201Response1 is not found" + + " in the empty JSON string", + CreateSource201Response1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSource201Response1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateSource201Response1` 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()) { + CreateSourceAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSource201Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSource201Response1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateSource201Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSource201Response1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSource201Response1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSource201Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSource201Response1 + * @throws IOException if the JSON string is invalid with respect to CreateSource201Response1 + */ + public static CreateSource201Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSource201Response1.class); + } + + /** + * Convert an instance of CreateSource201Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateSourceAlphaInput.java b/src/main/java/com/segment/publicapi/models/CreateSourceAlphaInput.java index 4d620872..74c3143e 100644 --- a/src/main/java/com/segment/publicapi/models/CreateSourceAlphaInput.java +++ b/src/main/java/com/segment/publicapi/models/CreateSourceAlphaInput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,337 +9,339 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Create a new Source based on a set of parameters. - */ -@ApiModel(description = "Create a new Source based on a set of parameters.") - +/** Create a new Source based on a set of parameters. */ public class CreateSourceAlphaInput { - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_METADATA_ID = "metadataId"; - @SerializedName(SERIALIZED_NAME_METADATA_ID) - private String metadataId; + public static final String SERIALIZED_NAME_SLUG = "slug"; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; - public CreateSourceAlphaInput() { - } + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public CreateSourceAlphaInput slug(String slug) { - - this.slug = slug; - return this; - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - /** - * The slug by which to identify the Source in the Segment app. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug by which to identify the Source in the Segment app.") + public static final String SERIALIZED_NAME_NAME = "name"; - public String getSlug() { - return slug; - } + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_METADATA_ID = "metadataId"; - public void setSlug(String slug) { - this.slug = slug; - } + @SerializedName(SERIALIZED_NAME_METADATA_ID) + private String metadataId; + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - public CreateSourceAlphaInput enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; - /** - * Enable to allow this Source to send data. Defaults to true. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Enable to allow this Source to send data. Defaults to true.") + public CreateSourceAlphaInput() {} - public Boolean getEnabled() { - return enabled; - } + public CreateSourceAlphaInput slug(String slug) { + this.slug = slug; + return this; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + /** + * The slug by which to identify the Source in the Segment app. + * + * @return slug + */ + @javax.annotation.Nonnull + public String getSlug() { + return slug; + } + public void setSlug(String slug) { + this.slug = slug; + } - public CreateSourceAlphaInput name(String name) { - - this.name = name; - return this; - } + public CreateSourceAlphaInput enabled(Boolean enabled) { - /** - * An optional human-readable name for this Source. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An optional human-readable name for this Source.") + this.enabled = enabled; + return this; + } - public String getName() { - return name; - } + /** + * Enable to allow this Source to send data. Defaults to true. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public void setName(String name) { - this.name = name; - } + public CreateSourceAlphaInput name(String name) { + this.name = name; + return this; + } - public CreateSourceAlphaInput metadataId(String metadataId) { - - this.metadataId = metadataId; - return this; - } + /** + * An optional human-readable name for this Source. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - /** - * The id of the Source metadata from which this instance of the Source derives. All Source metadata is available under `/catalog/sources`. - * @return metadataId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source metadata from which this instance of the Source derives. All Source metadata is available under `/catalog/sources`.") + public void setName(String name) { + this.name = name; + } - public String getMetadataId() { - return metadataId; - } + public CreateSourceAlphaInput metadataId(String metadataId) { + this.metadataId = metadataId; + return this; + } - public void setMetadataId(String metadataId) { - this.metadataId = metadataId; - } + /** + * The id of the Source metadata from which this instance of the Source derives. All Source + * metadata is available under `/catalog/sources`. + * + * @return metadataId + */ + @javax.annotation.Nonnull + public String getMetadataId() { + return metadataId; + } + public void setMetadataId(String metadataId) { + this.metadataId = metadataId; + } - public CreateSourceAlphaInput settings(Map settings) { - - this.settings = settings; - return this; - } + public CreateSourceAlphaInput settings(Map settings) { - /** - * A key-value object that contains instance-specific settings for the Source. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A key-value object that contains instance-specific settings for the Source.") + this.settings = settings; + return this; + } - public Map getSettings() { - return settings; - } + public CreateSourceAlphaInput putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + /** + * A key-value object that contains instance-specific settings for a Source. The + * `options` field in the Source metadata defines the schema of this object. + * + * @return settings + */ + @javax.annotation.Nullable + public Map getSettings() { + return settings; + } - public void setSettings(Map settings) { - this.settings = settings; - } + public void setSettings(Map settings) { + this.settings = settings; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSourceAlphaInput createSourceAlphaInput = (CreateSourceAlphaInput) o; + return Objects.equals(this.slug, createSourceAlphaInput.slug) + && Objects.equals(this.enabled, createSourceAlphaInput.enabled) + && Objects.equals(this.name, createSourceAlphaInput.name) + && Objects.equals(this.metadataId, createSourceAlphaInput.metadataId) + && Objects.equals(this.settings, createSourceAlphaInput.settings); + } + @Override + public int hashCode() { + return Objects.hash(slug, enabled, name, metadataId, settings); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSourceAlphaInput {\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" metadataId: ").append(toIndentedString(metadataId)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateSourceAlphaInput createSourceAlphaInput = (CreateSourceAlphaInput) o; - return Objects.equals(this.slug, createSourceAlphaInput.slug) && - Objects.equals(this.enabled, createSourceAlphaInput.enabled) && - Objects.equals(this.name, createSourceAlphaInput.name) && - Objects.equals(this.metadataId, createSourceAlphaInput.metadataId) && - Objects.equals(this.settings, createSourceAlphaInput.settings); - } - - @Override - public int hashCode() { - return Objects.hash(slug, enabled, name, metadataId, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateSourceAlphaInput {\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" metadataId: ").append(toIndentedString(metadataId)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("slug"); + openapiFields.add("enabled"); + openapiFields.add("name"); + openapiFields.add("metadataId"); + openapiFields.add("settings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("slug"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("metadataId"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("slug"); - openapiFields.add("enabled"); - openapiFields.add("name"); - openapiFields.add("metadataId"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("metadataId"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateSourceAlphaInput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateSourceAlphaInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSourceAlphaInput is not found in the empty JSON string", CreateSourceAlphaInput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSourceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSourceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateSourceAlphaInput is not found in" + + " the empty JSON string", + CreateSourceAlphaInput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateSourceAlphaInput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSourceAlphaInput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSourceAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateSourceAlphaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateSourceAlphaInput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSourceAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").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("metadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `metadataId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("metadataId").toString())); } - } - if (!jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("metadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `metadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metadataId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateSourceAlphaInput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateSourceAlphaInput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateSourceAlphaInput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateSourceAlphaInput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateSourceAlphaInput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateSourceAlphaInput given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateSourceAlphaInput - * @throws IOException if the JSON string is invalid with respect to CreateSourceAlphaInput - */ - public static CreateSourceAlphaInput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateSourceAlphaInput.class); - } - - /** - * Convert an instance of CreateSourceAlphaInput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSourceAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSourceAlphaInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateSourceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSourceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSourceAlphaInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSourceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSourceAlphaInput + * @throws IOException if the JSON string is invalid with respect to CreateSourceAlphaInput + */ + public static CreateSourceAlphaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSourceAlphaInput.class); + } + + /** + * Convert an instance of CreateSourceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateSourceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/CreateSourceAlphaOutput.java index 1c0da3aa..f0e76f46 100644 --- a/src/main/java/com/segment/publicapi/models/CreateSourceAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/CreateSourceAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Source2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the newly Source. - */ -@ApiModel(description = "Returns the newly Source.") - +/** Returns the newly created Source. */ public class CreateSourceAlphaOutput { - public static final String SERIALIZED_NAME_SOURCE = "source"; - @SerializedName(SERIALIZED_NAME_SOURCE) - private Source2 source; + public static final String SERIALIZED_NAME_SOURCE = "source"; - public CreateSourceAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_SOURCE) + private SourceAlpha source; - public CreateSourceAlphaOutput source(Source2 source) { - - this.source = source; - return this; - } + public CreateSourceAlphaOutput() {} - /** - * Get source - * @return source - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateSourceAlphaOutput source(SourceAlpha source) { - public Source2 getSource() { - return source; - } + this.source = source; + return this; + } + /** + * Get source + * + * @return source + */ + @javax.annotation.Nonnull + public SourceAlpha getSource() { + return source; + } - public void setSource(Source2 source) { - this.source = source; - } + public void setSource(SourceAlpha source) { + this.source = source; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSourceAlphaOutput createSourceAlphaOutput = (CreateSourceAlphaOutput) o; + return Objects.equals(this.source, createSourceAlphaOutput.source); + } + @Override + public int hashCode() { + return Objects.hash(source); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSourceAlphaOutput {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateSourceAlphaOutput createSourceAlphaOutput = (CreateSourceAlphaOutput) o; - return Objects.equals(this.source, createSourceAlphaOutput.source); - } - - @Override - public int hashCode() { - return Objects.hash(source); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateSourceAlphaOutput {\n"); - sb.append(" source: ").append(toIndentedString(source)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); } - return o.toString().replace("\n", "\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"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("source"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateSourceAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateSourceAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSourceAlphaOutput is not found in the empty JSON string", CreateSourceAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSourceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSourceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateSourceAlphaOutput is not found" + + " in the empty JSON string", + CreateSourceAlphaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateSourceAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSourceAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSourceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateSourceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateSourceAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSourceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `source` + SourceAlpha.validateJsonElement(jsonObj.get("source")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateSourceAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateSourceAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateSourceAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateSourceAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateSourceAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSourceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSourceAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateSourceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSourceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSourceAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSourceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSourceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to CreateSourceAlphaOutput + */ + public static CreateSourceAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSourceAlphaOutput.class); } - } - - /** - * Create an instance of CreateSourceAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateSourceAlphaOutput - * @throws IOException if the JSON string is invalid with respect to CreateSourceAlphaOutput - */ - public static CreateSourceAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateSourceAlphaOutput.class); - } - - /** - * Convert an instance of CreateSourceAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateSourceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateSourceRegulation200Response.java b/src/main/java/com/segment/publicapi/models/CreateSourceRegulation200Response.java index 227227e8..29c4b895 100644 --- a/src/main/java/com/segment/publicapi/models/CreateSourceRegulation200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateSourceRegulation200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,192 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateSourceRegulationV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateSourceRegulation200Response - */ - +/** CreateSourceRegulation200Response */ public class CreateSourceRegulation200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateSourceRegulationV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateSourceRegulation200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateSourceRegulationV1Output data; - public CreateSourceRegulation200Response data(CreateSourceRegulationV1Output data) { - - this.data = data; - return this; - } + public CreateSourceRegulation200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateSourceRegulation200Response data(CreateSourceRegulationV1Output data) { - public CreateSourceRegulationV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateSourceRegulationV1Output getData() { + return data; + } - public void setData(CreateSourceRegulationV1Output data) { - this.data = data; - } + public void setData(CreateSourceRegulationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSourceRegulation200Response createSourceRegulation200Response = + (CreateSourceRegulation200Response) o; + return Objects.equals(this.data, createSourceRegulation200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSourceRegulation200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateSourceRegulation200Response createSourceRegulation200Response = (CreateSourceRegulation200Response) o; - return Objects.equals(this.data, createSourceRegulation200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateSourceRegulation200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateSourceRegulation200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateSourceRegulation200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSourceRegulation200Response is not found in the empty JSON string", CreateSourceRegulation200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateSourceRegulation200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSourceRegulation200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateSourceRegulation200Response is" + + " not found in the empty JSON string", + CreateSourceRegulation200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateSourceRegulation200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSourceRegulation200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSourceRegulation200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateSourceRegulation200Response` 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()) { + CreateSourceRegulationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateSourceRegulation200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateSourceRegulation200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateSourceRegulation200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateSourceRegulation200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateSourceRegulation200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSourceRegulation200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSourceRegulation200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateSourceRegulation200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSourceRegulation200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSourceRegulation200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSourceRegulation200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSourceRegulation200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateSourceRegulation200Response + */ + public static CreateSourceRegulation200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSourceRegulation200Response.class); } - } - - /** - * Create an instance of CreateSourceRegulation200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateSourceRegulation200Response - * @throws IOException if the JSON string is invalid with respect to CreateSourceRegulation200Response - */ - public static CreateSourceRegulation200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateSourceRegulation200Response.class); - } - - /** - * Convert an instance of CreateSourceRegulation200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateSourceRegulation200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateSourceRegulationV1Input.java b/src/main/java/com/segment/publicapi/models/CreateSourceRegulationV1Input.java index f5eae79f..bf30bf87 100644 --- a/src/main/java/com/segment/publicapi/models/CreateSourceRegulationV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateSourceRegulationV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,385 +9,406 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** The input to create a Source-scoped regulation. */ +public class CreateSourceRegulationV1Input { + /** + * The regulation type to create. Please note that `DELETE_ARCHIVE_ONLY` is only + * supported for limited Workspaces for Source-scoped regulations. + */ + @JsonAdapter(RegulationTypeEnum.Adapter.class) + public enum RegulationTypeEnum { + DELETE_ARCHIVE_ONLY("DELETE_ARCHIVE_ONLY"), -/** - * The input to create a Source-scoped regulation. - */ -@ApiModel(description = "The input to create a Source-scoped regulation.") + DELETE_INTERNAL("DELETE_INTERNAL"), -public class CreateSourceRegulationV1Input { - /** - * The regulation type to create. - */ - @JsonAdapter(RegulationTypeEnum.Adapter.class) - public enum RegulationTypeEnum { - BULK_DELETE_ONLY("BULK_DELETE_ONLY"), - - DELETE_INTERNAL("DELETE_INTERNAL"), - - DELETE_ONLY("DELETE_ONLY"), - - SUPPRESS_ONLY("SUPPRESS_ONLY"), - - SUPPRESS_WITH_DELETE("SUPPRESS_WITH_DELETE"), - - UNSUPPRESS("UNSUPPRESS"); - - private String value; - - RegulationTypeEnum(String value) { - this.value = value; - } + DELETE_ONLY("DELETE_ONLY"), - public String getValue() { - return value; - } + SUPPRESS_ONLY("SUPPRESS_ONLY"), - @Override - public String toString() { - return String.valueOf(value); - } + SUPPRESS_WITH_DELETE("SUPPRESS_WITH_DELETE"), + + SUPPRESS_WITH_DELETE_INTERNAL("SUPPRESS_WITH_DELETE_INTERNAL"), - public static RegulationTypeEnum fromValue(String value) { - for (RegulationTypeEnum b : RegulationTypeEnum.values()) { - if (b.value.equals(value)) { - return b; + UNSUPPRESS("UNSUPPRESS"); + + private String value; + + RegulationTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final RegulationTypeEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RegulationTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return RegulationTypeEnum.fromValue(value); - } + @Override + public String toString() { + return String.valueOf(value); + } + + public static RegulationTypeEnum fromValue(String value) { + for (RegulationTypeEnum b : RegulationTypeEnum.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 RegulationTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RegulationTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RegulationTypeEnum.fromValue(value); + } + } } - } - public static final String SERIALIZED_NAME_REGULATION_TYPE = "regulationType"; - @SerializedName(SERIALIZED_NAME_REGULATION_TYPE) - private RegulationTypeEnum regulationType; + public static final String SERIALIZED_NAME_REGULATION_TYPE = "regulationType"; - /** - * The subject type. - */ - @JsonAdapter(SubjectTypeEnum.Adapter.class) - public enum SubjectTypeEnum { - USER_ID("USER_ID"); + @SerializedName(SERIALIZED_NAME_REGULATION_TYPE) + private RegulationTypeEnum regulationType; - private String value; + /** + * The subject type. Note: `ANONYMOUS_ID` is only supported for limited Workspaces for + * Source-scoped regulations. `ANONYMOUS_ID` is only supported when regulationType is + * `DELETE_ARCHIVE_ONLY`. + */ + @JsonAdapter(SubjectTypeEnum.Adapter.class) + public enum SubjectTypeEnum { + ANONYMOUS_ID("ANONYMOUS_ID"), - SubjectTypeEnum(String value) { - this.value = value; - } + USER_ID("USER_ID"); - public String getValue() { - return value; - } + private String value; - @Override - public String toString() { - return String.valueOf(value); - } + SubjectTypeEnum(String value) { + this.value = value; + } - public static SubjectTypeEnum fromValue(String value) { - for (SubjectTypeEnum b : SubjectTypeEnum.values()) { - if (b.value.equals(value)) { - return b; + public String getValue() { + return value; } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final SubjectTypeEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public SubjectTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return SubjectTypeEnum.fromValue(value); - } - } - } + @Override + public String toString() { + return String.valueOf(value); + } - public static final String SERIALIZED_NAME_SUBJECT_TYPE = "subjectType"; - @SerializedName(SERIALIZED_NAME_SUBJECT_TYPE) - private SubjectTypeEnum subjectType; + public static SubjectTypeEnum fromValue(String value) { + for (SubjectTypeEnum b : SubjectTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public static final String SERIALIZED_NAME_SUBJECT_IDS = "subjectIds"; - @SerializedName(SERIALIZED_NAME_SUBJECT_IDS) - private List subjectIds = null; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SubjectTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SubjectTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SubjectTypeEnum.fromValue(value); + } + } + } - public CreateSourceRegulationV1Input() { - } + public static final String SERIALIZED_NAME_SUBJECT_TYPE = "subjectType"; - public CreateSourceRegulationV1Input regulationType(RegulationTypeEnum regulationType) { - - this.regulationType = regulationType; - return this; - } + @SerializedName(SERIALIZED_NAME_SUBJECT_TYPE) + private SubjectTypeEnum subjectType; - /** - * The regulation type to create. - * @return regulationType - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The regulation type to create.") + public static final String SERIALIZED_NAME_SUBJECT_IDS = "subjectIds"; - public RegulationTypeEnum getRegulationType() { - return regulationType; - } + @SerializedName(SERIALIZED_NAME_SUBJECT_IDS) + private List subjectIds = new ArrayList<>(); + public CreateSourceRegulationV1Input() {} - public void setRegulationType(RegulationTypeEnum regulationType) { - this.regulationType = regulationType; - } + public CreateSourceRegulationV1Input regulationType(RegulationTypeEnum regulationType) { + this.regulationType = regulationType; + return this; + } - public CreateSourceRegulationV1Input subjectType(SubjectTypeEnum subjectType) { - - this.subjectType = subjectType; - return this; - } + /** + * The regulation type to create. Please note that `DELETE_ARCHIVE_ONLY` is only + * supported for limited Workspaces for Source-scoped regulations. + * + * @return regulationType + */ + @javax.annotation.Nonnull + public RegulationTypeEnum getRegulationType() { + return regulationType; + } - /** - * The subject type. - * @return subjectType - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The subject type.") + public void setRegulationType(RegulationTypeEnum regulationType) { + this.regulationType = regulationType; + } - public SubjectTypeEnum getSubjectType() { - return subjectType; - } + public CreateSourceRegulationV1Input subjectType(SubjectTypeEnum subjectType) { + this.subjectType = subjectType; + return this; + } - public void setSubjectType(SubjectTypeEnum subjectType) { - this.subjectType = subjectType; - } + /** + * The subject type. Note: `ANONYMOUS_ID` is only supported for limited Workspaces for + * Source-scoped regulations. `ANONYMOUS_ID` is only supported when regulationType is + * `DELETE_ARCHIVE_ONLY`. + * + * @return subjectType + */ + @javax.annotation.Nonnull + public SubjectTypeEnum getSubjectType() { + return subjectType; + } + public void setSubjectType(SubjectTypeEnum subjectType) { + this.subjectType = subjectType; + } - public CreateSourceRegulationV1Input subjectIds(List subjectIds) { - - this.subjectIds = subjectIds; - return this; - } + public CreateSourceRegulationV1Input subjectIds(List subjectIds) { - public CreateSourceRegulationV1Input addSubjectIdsItem(String subjectIdsItem) { - if (this.subjectIds == null) { - this.subjectIds = new ArrayList<>(); + this.subjectIds = subjectIds; + return this; } - this.subjectIds.add(subjectIdsItem); - return this; - } - - /** - * The user or object ids of the subjects to regulate. Config API note: equal to `parent` but allows an array. - * @return subjectIds - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The user or object ids of the subjects to regulate. Config API note: equal to `parent` but allows an array.") - public List getSubjectIds() { - return subjectIds; - } + public CreateSourceRegulationV1Input addSubjectIdsItem(String subjectIdsItem) { + if (this.subjectIds == null) { + this.subjectIds = new ArrayList<>(); + } + this.subjectIds.add(subjectIdsItem); + return this; + } + /** + * The list of `userId` or `objectId` or `anonymousId` values of + * the subjects to regulate. Config API note: equal to `parent` but allows an array. + * + * @return subjectIds + */ + @javax.annotation.Nonnull + public List getSubjectIds() { + return subjectIds; + } - public void setSubjectIds(List subjectIds) { - this.subjectIds = subjectIds; - } + public void setSubjectIds(List subjectIds) { + this.subjectIds = subjectIds; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSourceRegulationV1Input createSourceRegulationV1Input = + (CreateSourceRegulationV1Input) o; + return Objects.equals(this.regulationType, createSourceRegulationV1Input.regulationType) + && Objects.equals(this.subjectType, createSourceRegulationV1Input.subjectType) + && Objects.equals(this.subjectIds, createSourceRegulationV1Input.subjectIds); + } + @Override + public int hashCode() { + return Objects.hash(regulationType, subjectType, subjectIds); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSourceRegulationV1Input {\n"); + sb.append(" regulationType: ").append(toIndentedString(regulationType)).append("\n"); + sb.append(" subjectType: ").append(toIndentedString(subjectType)).append("\n"); + sb.append(" subjectIds: ").append(toIndentedString(subjectIds)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateSourceRegulationV1Input createSourceRegulationV1Input = (CreateSourceRegulationV1Input) o; - return Objects.equals(this.regulationType, createSourceRegulationV1Input.regulationType) && - Objects.equals(this.subjectType, createSourceRegulationV1Input.subjectType) && - Objects.equals(this.subjectIds, createSourceRegulationV1Input.subjectIds); - } - - @Override - public int hashCode() { - return Objects.hash(regulationType, subjectType, subjectIds); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateSourceRegulationV1Input {\n"); - sb.append(" regulationType: ").append(toIndentedString(regulationType)).append("\n"); - sb.append(" subjectType: ").append(toIndentedString(subjectType)).append("\n"); - sb.append(" subjectIds: ").append(toIndentedString(subjectIds)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("regulationType"); + openapiFields.add("subjectType"); + openapiFields.add("subjectIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("regulationType"); + openapiRequiredFields.add("subjectType"); + openapiRequiredFields.add("subjectIds"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("regulationType"); - openapiFields.add("subjectType"); - openapiFields.add("subjectIds"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("regulationType"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateSourceRegulationV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateSourceRegulationV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSourceRegulationV1Input is not found in the empty JSON string", CreateSourceRegulationV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateSourceRegulationV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSourceRegulationV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateSourceRegulationV1Input is not" + + " found in the empty JSON string", + CreateSourceRegulationV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateSourceRegulationV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSourceRegulationV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSourceRegulationV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateSourceRegulationV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateSourceRegulationV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSourceRegulationV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("regulationType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `regulationType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("regulationType").toString())); + } + if (!jsonObj.get("subjectType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `subjectType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("subjectType").toString())); + } + // ensure the required json array is present + if (jsonObj.get("subjectIds") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("subjectIds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `subjectIds` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("subjectIds").toString())); } - } - if (!jsonObj.get("regulationType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `regulationType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("regulationType").toString())); - } - if ((jsonObj.get("subjectType") != null && !jsonObj.get("subjectType").isJsonNull()) && !jsonObj.get("subjectType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `subjectType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subjectType").toString())); - } - // ensure the optional json data is an array if present - if (jsonObj.get("subjectIds") != null && !jsonObj.get("subjectIds").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `subjectIds` to be an array in the JSON string but got `%s`", jsonObj.get("subjectIds").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateSourceRegulationV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateSourceRegulationV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateSourceRegulationV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateSourceRegulationV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateSourceRegulationV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateSourceRegulationV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateSourceRegulationV1Input - * @throws IOException if the JSON string is invalid with respect to CreateSourceRegulationV1Input - */ - public static CreateSourceRegulationV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateSourceRegulationV1Input.class); - } - - /** - * Convert an instance of CreateSourceRegulationV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSourceRegulationV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSourceRegulationV1Input' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateSourceRegulationV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSourceRegulationV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSourceRegulationV1Input read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSourceRegulationV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSourceRegulationV1Input + * @throws IOException if the JSON string is invalid with respect to + * CreateSourceRegulationV1Input + */ + public static CreateSourceRegulationV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSourceRegulationV1Input.class); + } + + /** + * Convert an instance of CreateSourceRegulationV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateSourceRegulationV1Output.java b/src/main/java/com/segment/publicapi/models/CreateSourceRegulationV1Output.java index faf92c92..121571cf 100644 --- a/src/main/java/com/segment/publicapi/models/CreateSourceRegulationV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateSourceRegulationV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,208 +9,205 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The output of a create Source regulation call. - */ -@ApiModel(description = "The output of a create Source regulation call.") - +/** The output of a create Source regulation call. */ public class CreateSourceRegulationV1Output { - public static final String SERIALIZED_NAME_REGULATE_ID = "regulateId"; - @SerializedName(SERIALIZED_NAME_REGULATE_ID) - private String regulateId; + public static final String SERIALIZED_NAME_REGULATE_ID = "regulateId"; - public CreateSourceRegulationV1Output() { - } + @SerializedName(SERIALIZED_NAME_REGULATE_ID) + private String regulateId; - public CreateSourceRegulationV1Output regulateId(String regulateId) { - - this.regulateId = regulateId; - return this; - } + public CreateSourceRegulationV1Output() {} - /** - * The id of the created regulation. - * @return regulateId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the created regulation.") + public CreateSourceRegulationV1Output regulateId(String regulateId) { - public String getRegulateId() { - return regulateId; - } + this.regulateId = regulateId; + return this; + } + /** + * The id of the created regulation. + * + * @return regulateId + */ + @javax.annotation.Nonnull + public String getRegulateId() { + return regulateId; + } - public void setRegulateId(String regulateId) { - this.regulateId = regulateId; - } + public void setRegulateId(String regulateId) { + this.regulateId = regulateId; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSourceRegulationV1Output createSourceRegulationV1Output = + (CreateSourceRegulationV1Output) o; + return Objects.equals(this.regulateId, createSourceRegulationV1Output.regulateId); + } + @Override + public int hashCode() { + return Objects.hash(regulateId); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSourceRegulationV1Output {\n"); + sb.append(" regulateId: ").append(toIndentedString(regulateId)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateSourceRegulationV1Output createSourceRegulationV1Output = (CreateSourceRegulationV1Output) o; - return Objects.equals(this.regulateId, createSourceRegulationV1Output.regulateId); - } - - @Override - public int hashCode() { - return Objects.hash(regulateId); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateSourceRegulationV1Output {\n"); - sb.append(" regulateId: ").append(toIndentedString(regulateId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("regulateId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("regulateId"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("regulateId"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("regulateId"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateSourceRegulationV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateSourceRegulationV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSourceRegulationV1Output is not found in the empty JSON string", CreateSourceRegulationV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateSourceRegulationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSourceRegulationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateSourceRegulationV1Output is not" + + " found in the empty JSON string", + CreateSourceRegulationV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateSourceRegulationV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSourceRegulationV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSourceRegulationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateSourceRegulationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateSourceRegulationV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSourceRegulationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("regulateId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `regulateId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("regulateId").toString())); } - } - if (!jsonObj.get("regulateId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `regulateId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("regulateId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateSourceRegulationV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateSourceRegulationV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateSourceRegulationV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateSourceRegulationV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateSourceRegulationV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateSourceRegulationV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateSourceRegulationV1Output - * @throws IOException if the JSON string is invalid with respect to CreateSourceRegulationV1Output - */ - public static CreateSourceRegulationV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateSourceRegulationV1Output.class); - } - - /** - * Convert an instance of CreateSourceRegulationV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSourceRegulationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSourceRegulationV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateSourceRegulationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSourceRegulationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSourceRegulationV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSourceRegulationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSourceRegulationV1Output + * @throws IOException if the JSON string is invalid with respect to + * CreateSourceRegulationV1Output + */ + public static CreateSourceRegulationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSourceRegulationV1Output.class); + } + + /** + * Convert an instance of CreateSourceRegulationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateSourceV1Input.java b/src/main/java/com/segment/publicapi/models/CreateSourceV1Input.java index 3ca61c52..bec9dbca 100644 --- a/src/main/java/com/segment/publicapi/models/CreateSourceV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateSourceV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,304 +9,335 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Create a new Source based on a set of parameters. */ +public class CreateSourceV1Input { + public static final String SERIALIZED_NAME_SLUG = "slug"; -/** - * Create a new Source based on a set of parameters. - */ -@ApiModel(description = "Create a new Source based on a set of parameters.") + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; -public class CreateSourceV1Input { - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public static final String SERIALIZED_NAME_METADATA_ID = "metadataId"; - @SerializedName(SERIALIZED_NAME_METADATA_ID) - private String metadataId; + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; + public static final String SERIALIZED_NAME_METADATA_ID = "metadataId"; - public CreateSourceV1Input() { - } + @SerializedName(SERIALIZED_NAME_METADATA_ID) + private String metadataId; - public CreateSourceV1Input slug(String slug) { - - this.slug = slug; - return this; - } + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - /** - * The slug by which to identify the Source in the Segment app. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug by which to identify the Source in the Segment app.") + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; - public String getSlug() { - return slug; - } + public static final String SERIALIZED_NAME_DISCONNECT_ALL_WAREHOUSES = + "disconnectAllWarehouses"; + @SerializedName(SERIALIZED_NAME_DISCONNECT_ALL_WAREHOUSES) + private Boolean disconnectAllWarehouses; - public void setSlug(String slug) { - this.slug = slug; - } + public CreateSourceV1Input() {} + public CreateSourceV1Input slug(String slug) { - public CreateSourceV1Input enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + this.slug = slug; + return this; + } - /** - * Enable to allow this Source to send data. Defaults to true. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Enable to allow this Source to send data. Defaults to true.") + /** + * The slug by which to identify the Source in the Segment app. + * + * @return slug + */ + @javax.annotation.Nonnull + public String getSlug() { + return slug; + } - public Boolean getEnabled() { - return enabled; - } + public void setSlug(String slug) { + this.slug = slug; + } + public CreateSourceV1Input enabled(Boolean enabled) { - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + this.enabled = enabled; + return this; + } + /** + * Enable to allow this Source to send data. Defaults to true. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } - public CreateSourceV1Input metadataId(String metadataId) { - - this.metadataId = metadataId; - return this; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - /** - * The id of the Source metadata from which this instance of the Source derives. All Source metadata is available under `/catalog/sources`. - * @return metadataId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source metadata from which this instance of the Source derives. All Source metadata is available under `/catalog/sources`.") + public CreateSourceV1Input metadataId(String metadataId) { - public String getMetadataId() { - return metadataId; - } + this.metadataId = metadataId; + return this; + } + /** + * The id of the Source metadata from which this instance of the Source derives. All Source + * metadata is available under `/catalog/sources`. + * + * @return metadataId + */ + @javax.annotation.Nonnull + public String getMetadataId() { + return metadataId; + } - public void setMetadataId(String metadataId) { - this.metadataId = metadataId; - } + public void setMetadataId(String metadataId) { + this.metadataId = metadataId; + } + public CreateSourceV1Input settings(Map settings) { - public CreateSourceV1Input settings(Map settings) { - - this.settings = settings; - return this; - } + this.settings = settings; + return this; + } - /** - * A key-value object that contains instance-specific settings for the Source. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A key-value object that contains instance-specific settings for the Source.") + public CreateSourceV1Input putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + + /** + * A key-value object that contains instance-specific settings for a Source. The + * `options` field in the Source metadata defines the schema of this object. + * + * @return settings + */ + @javax.annotation.Nullable + public Map getSettings() { + return settings; + } - public Map getSettings() { - return settings; - } + public void setSettings(Map settings) { + this.settings = settings; + } + public CreateSourceV1Input disconnectAllWarehouses(Boolean disconnectAllWarehouses) { - public void setSettings(Map settings) { - this.settings = settings; - } + this.disconnectAllWarehouses = disconnectAllWarehouses; + return this; + } + /** + * Whether to disconnect all Warehouses from the Source. + * + * @return disconnectAllWarehouses + */ + @javax.annotation.Nullable + public Boolean getDisconnectAllWarehouses() { + return disconnectAllWarehouses; + } + public void setDisconnectAllWarehouses(Boolean disconnectAllWarehouses) { + this.disconnectAllWarehouses = disconnectAllWarehouses; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSourceV1Input createSourceV1Input = (CreateSourceV1Input) o; + return Objects.equals(this.slug, createSourceV1Input.slug) + && Objects.equals(this.enabled, createSourceV1Input.enabled) + && Objects.equals(this.metadataId, createSourceV1Input.metadataId) + && Objects.equals(this.settings, createSourceV1Input.settings) + && Objects.equals( + this.disconnectAllWarehouses, createSourceV1Input.disconnectAllWarehouses); } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public int hashCode() { + return Objects.hash(slug, enabled, metadataId, settings, disconnectAllWarehouses); } - CreateSourceV1Input createSourceV1Input = (CreateSourceV1Input) o; - return Objects.equals(this.slug, createSourceV1Input.slug) && - Objects.equals(this.enabled, createSourceV1Input.enabled) && - Objects.equals(this.metadataId, createSourceV1Input.metadataId) && - Objects.equals(this.settings, createSourceV1Input.settings); - } - - @Override - public int hashCode() { - return Objects.hash(slug, enabled, metadataId, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateSourceV1Input {\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" metadataId: ").append(toIndentedString(metadataId)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSourceV1Input {\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" metadataId: ").append(toIndentedString(metadataId)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" disconnectAllWarehouses: ") + .append(toIndentedString(disconnectAllWarehouses)) + .append("\n"); + sb.append("}"); + return sb.toString(); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("slug"); - openapiFields.add("enabled"); - openapiFields.add("metadataId"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("metadataId"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateSourceV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateSourceV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSourceV1Input is not found in the empty JSON string", CreateSourceV1Input.openapiRequiredFields.toString())); + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - } + return o.toString().replace("\n", "\n "); + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateSourceV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSourceV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("slug"); + openapiFields.add("enabled"); + openapiFields.add("metadataId"); + openapiFields.add("settings"); + openapiFields.add("disconnectAllWarehouses"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("slug"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("metadataId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSourceV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSourceV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateSourceV1Input is not found in" + + " the empty JSON string", + CreateSourceV1Input.openapiRequiredFields.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateSourceV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSourceV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateSourceV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSourceV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").toString())); + } + if (!jsonObj.get("metadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `metadataId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("metadataId").toString())); } - } - if (!jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); - } - if (!jsonObj.get("metadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `metadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metadataId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateSourceV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateSourceV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateSourceV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateSourceV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateSourceV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateSourceV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateSourceV1Input - * @throws IOException if the JSON string is invalid with respect to CreateSourceV1Input - */ - public static CreateSourceV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateSourceV1Input.class); - } - - /** - * Convert an instance of CreateSourceV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSourceV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSourceV1Input' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateSourceV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSourceV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSourceV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSourceV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSourceV1Input + * @throws IOException if the JSON string is invalid with respect to CreateSourceV1Input + */ + public static CreateSourceV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSourceV1Input.class); + } + + /** + * Convert an instance of CreateSourceV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateSourceV1Output.java b/src/main/java/com/segment/publicapi/models/CreateSourceV1Output.java index f2d72c75..bd937135 100644 --- a/src/main/java/com/segment/publicapi/models/CreateSourceV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateSourceV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Source5; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a newly created Source. - */ -@ApiModel(description = "Returns a newly created Source.") - +/** Returns a newly created Source. */ public class CreateSourceV1Output { - public static final String SERIALIZED_NAME_SOURCE = "source"; - @SerializedName(SERIALIZED_NAME_SOURCE) - private Source5 source; + public static final String SERIALIZED_NAME_SOURCE = "source"; - public CreateSourceV1Output() { - } + @SerializedName(SERIALIZED_NAME_SOURCE) + private SourceV1 source; - public CreateSourceV1Output source(Source5 source) { - - this.source = source; - return this; - } + public CreateSourceV1Output() {} - /** - * Get source - * @return source - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateSourceV1Output source(SourceV1 source) { - public Source5 getSource() { - return source; - } + this.source = source; + return this; + } + /** + * Get source + * + * @return source + */ + @javax.annotation.Nonnull + public SourceV1 getSource() { + return source; + } - public void setSource(Source5 source) { - this.source = source; - } + public void setSource(SourceV1 source) { + this.source = source; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSourceV1Output createSourceV1Output = (CreateSourceV1Output) o; + return Objects.equals(this.source, createSourceV1Output.source); + } + @Override + public int hashCode() { + return Objects.hash(source); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSourceV1Output {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateSourceV1Output createSourceV1Output = (CreateSourceV1Output) o; - return Objects.equals(this.source, createSourceV1Output.source); - } - - @Override - public int hashCode() { - return Objects.hash(source); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateSourceV1Output {\n"); - sb.append(" source: ").append(toIndentedString(source)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); } - return o.toString().replace("\n", "\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"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("source"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateSourceV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateSourceV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSourceV1Output is not found in the empty JSON string", CreateSourceV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSourceV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSourceV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateSourceV1Output is not found in" + + " the empty JSON string", + CreateSourceV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateSourceV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSourceV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSourceV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateSourceV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateSourceV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSourceV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `source` + SourceV1.validateJsonElement(jsonObj.get("source")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateSourceV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateSourceV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateSourceV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateSourceV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateSourceV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSourceV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSourceV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateSourceV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSourceV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSourceV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSourceV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSourceV1Output + * @throws IOException if the JSON string is invalid with respect to CreateSourceV1Output + */ + public static CreateSourceV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSourceV1Output.class); } - } - - /** - * Create an instance of CreateSourceV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateSourceV1Output - * @throws IOException if the JSON string is invalid with respect to CreateSourceV1Output - */ - public static CreateSourceV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateSourceV1Output.class); - } - - /** - * Convert an instance of CreateSourceV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateSourceV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateTrackingPlan200Response.java b/src/main/java/com/segment/publicapi/models/CreateTrackingPlan200Response.java index 6478d140..c3a88907 100644 --- a/src/main/java/com/segment/publicapi/models/CreateTrackingPlan200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateTrackingPlan200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateTrackingPlanV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateTrackingPlan200Response - */ - +/** CreateTrackingPlan200Response */ public class CreateTrackingPlan200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateTrackingPlanV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateTrackingPlan200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateTrackingPlanV1Output data; - public CreateTrackingPlan200Response data(CreateTrackingPlanV1Output data) { - - this.data = data; - return this; - } + public CreateTrackingPlan200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateTrackingPlan200Response data(CreateTrackingPlanV1Output data) { - public CreateTrackingPlanV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateTrackingPlanV1Output getData() { + return data; + } - public void setData(CreateTrackingPlanV1Output data) { - this.data = data; - } + public void setData(CreateTrackingPlanV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTrackingPlan200Response createTrackingPlan200Response = + (CreateTrackingPlan200Response) o; + return Objects.equals(this.data, createTrackingPlan200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTrackingPlan200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateTrackingPlan200Response createTrackingPlan200Response = (CreateTrackingPlan200Response) o; - return Objects.equals(this.data, createTrackingPlan200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateTrackingPlan200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateTrackingPlan200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateTrackingPlan200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateTrackingPlan200Response is not found in the empty JSON string", CreateTrackingPlan200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateTrackingPlan200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTrackingPlan200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateTrackingPlan200Response is not" + + " found in the empty JSON string", + CreateTrackingPlan200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateTrackingPlan200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTrackingPlan200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTrackingPlan200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateTrackingPlan200Response` 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()) { + CreateTrackingPlanV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateTrackingPlan200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateTrackingPlan200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateTrackingPlan200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateTrackingPlan200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateTrackingPlan200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTrackingPlan200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTrackingPlan200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateTrackingPlan200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTrackingPlan200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTrackingPlan200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTrackingPlan200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTrackingPlan200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateTrackingPlan200Response + */ + public static CreateTrackingPlan200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTrackingPlan200Response.class); } - } - - /** - * Create an instance of CreateTrackingPlan200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateTrackingPlan200Response - * @throws IOException if the JSON string is invalid with respect to CreateTrackingPlan200Response - */ - public static CreateTrackingPlan200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateTrackingPlan200Response.class); - } - - /** - * Convert an instance of CreateTrackingPlan200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateTrackingPlan200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateTrackingPlanV1Input.java b/src/main/java/com/segment/publicapi/models/CreateTrackingPlanV1Input.java index 06c420fe..c87b1feb 100644 --- a/src/main/java/com/segment/publicapi/models/CreateTrackingPlanV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateTrackingPlanV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,326 +9,325 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Creates a Tracking Plan in the Workspace. */ +public class CreateTrackingPlanV1Input { + public static final String SERIALIZED_NAME_NAME = "name"; -/** - * Creates a Tracking Plan in the Workspace. - */ -@ApiModel(description = "Creates a Tracking Plan in the Workspace.") + @SerializedName(SERIALIZED_NAME_NAME) + private String name; -public class CreateTrackingPlanV1Input { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - /** - * The Tracking Plan's type. - */ - @JsonAdapter(TypeEnum.Adapter.class) - public enum TypeEnum { - LIVE("LIVE"), - - PROPERTY_LIBRARY("PROPERTY_LIBRARY"), - - RULE_LIBRARY("RULE_LIBRARY"), - - TEMPLATE("TEMPLATE"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - public String getValue() { - return value; - } + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - @Override - public String toString() { - return String.valueOf(value); - } + /** The Tracking Plan's type. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ENGAGE("ENGAGE"), - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } + LIVE("LIVE"), - 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); - } - } - } + PROPERTY_LIBRARY("PROPERTY_LIBRARY"), - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - private TypeEnum type; + RULE_LIBRARY("RULE_LIBRARY"), - public CreateTrackingPlanV1Input() { - } + TEMPLATE("TEMPLATE"); - public CreateTrackingPlanV1Input name(String name) { - - this.name = name; - return this; - } + private String value; - /** - * The Tracking Plan's name. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Tracking Plan's name. Config API note: equal to `displayName`.") + TypeEnum(String value) { + this.value = value; + } - public String getName() { - return name; - } + public String getValue() { + return value; + } + @Override + public String toString() { + return String.valueOf(value); + } - public void setName(String name) { - this.name = name; - } + 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 CreateTrackingPlanV1Input description(String description) { - - this.description = description; - return this; - } + public static final String SERIALIZED_NAME_TYPE = "type"; - /** - * The Tracking Plan's description. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Tracking Plan's description.") + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; - public String getDescription() { - return description; - } + public CreateTrackingPlanV1Input() {} + public CreateTrackingPlanV1Input name(String name) { - public void setDescription(String description) { - this.description = description; - } + this.name = name; + return this; + } + /** + * The Tracking Plan's name. Config API note: equal to `displayName`. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public CreateTrackingPlanV1Input type(TypeEnum type) { - - this.type = type; - return this; - } + public void setName(String name) { + this.name = name; + } - /** - * The Tracking Plan's type. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Tracking Plan's type.") + public CreateTrackingPlanV1Input description(String description) { - public TypeEnum getType() { - return type; - } + this.description = description; + return this; + } + + /** + * The Tracking Plan's description. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public CreateTrackingPlanV1Input type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * The Tracking Plan's type. + * + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } - public void setType(TypeEnum type) { - this.type = 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; + } + CreateTrackingPlanV1Input createTrackingPlanV1Input = (CreateTrackingPlanV1Input) o; + return Objects.equals(this.name, createTrackingPlanV1Input.name) + && Objects.equals(this.description, createTrackingPlanV1Input.description) + && Objects.equals(this.type, createTrackingPlanV1Input.type); + } + @Override + public int hashCode() { + return Objects.hash(name, description, type); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTrackingPlanV1Input {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateTrackingPlanV1Input createTrackingPlanV1Input = (CreateTrackingPlanV1Input) o; - return Objects.equals(this.name, createTrackingPlanV1Input.name) && - Objects.equals(this.description, createTrackingPlanV1Input.description) && - Objects.equals(this.type, createTrackingPlanV1Input.type); - } - - @Override - public int hashCode() { - return Objects.hash(name, description, type); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateTrackingPlanV1Input {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).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"; + + 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("description"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("type"); } - return o.toString().replace("\n", "\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("description"); - openapiFields.add("type"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("type"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateTrackingPlanV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateTrackingPlanV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateTrackingPlanV1Input is not found in the empty JSON string", CreateTrackingPlanV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateTrackingPlanV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTrackingPlanV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateTrackingPlanV1Input is not found" + + " in the empty JSON string", + CreateTrackingPlanV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateTrackingPlanV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTrackingPlanV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTrackingPlanV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateTrackingPlanV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateTrackingPlanV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTrackingPlanV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("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 (!CreateTrackingPlanV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTrackingPlanV1Input' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateTrackingPlanV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTrackingPlanV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTrackingPlanV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("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("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 (!CreateTrackingPlanV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateTrackingPlanV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateTrackingPlanV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateTrackingPlanV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateTrackingPlanV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateTrackingPlanV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateTrackingPlanV1Input - * @throws IOException if the JSON string is invalid with respect to CreateTrackingPlanV1Input - */ - public static CreateTrackingPlanV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateTrackingPlanV1Input.class); - } - - /** - * Convert an instance of CreateTrackingPlanV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of CreateTrackingPlanV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTrackingPlanV1Input + * @throws IOException if the JSON string is invalid with respect to CreateTrackingPlanV1Input + */ + public static CreateTrackingPlanV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTrackingPlanV1Input.class); + } + + /** + * Convert an instance of CreateTrackingPlanV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateTrackingPlanV1Output.java b/src/main/java/com/segment/publicapi/models/CreateTrackingPlanV1Output.java index e2269ee8..d0bb83f3 100644 --- a/src/main/java/com/segment/publicapi/models/CreateTrackingPlanV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateTrackingPlanV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.TrackingPlan1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Result of a CreateTrackingPlan call. - */ -@ApiModel(description = "Result of a CreateTrackingPlan call.") - +/** Result of a CreateTrackingPlan call. */ public class CreateTrackingPlanV1Output { - public static final String SERIALIZED_NAME_TRACKING_PLAN = "trackingPlan"; - @SerializedName(SERIALIZED_NAME_TRACKING_PLAN) - private TrackingPlan1 trackingPlan; + public static final String SERIALIZED_NAME_TRACKING_PLAN = "trackingPlan"; - public CreateTrackingPlanV1Output() { - } + @SerializedName(SERIALIZED_NAME_TRACKING_PLAN) + private TrackingPlanV1 trackingPlan; - public CreateTrackingPlanV1Output trackingPlan(TrackingPlan1 trackingPlan) { - - this.trackingPlan = trackingPlan; - return this; - } + public CreateTrackingPlanV1Output() {} - /** - * Get trackingPlan - * @return trackingPlan - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateTrackingPlanV1Output trackingPlan(TrackingPlanV1 trackingPlan) { - public TrackingPlan1 getTrackingPlan() { - return trackingPlan; - } + this.trackingPlan = trackingPlan; + return this; + } + /** + * Get trackingPlan + * + * @return trackingPlan + */ + @javax.annotation.Nonnull + public TrackingPlanV1 getTrackingPlan() { + return trackingPlan; + } - public void setTrackingPlan(TrackingPlan1 trackingPlan) { - this.trackingPlan = trackingPlan; - } + public void setTrackingPlan(TrackingPlanV1 trackingPlan) { + this.trackingPlan = trackingPlan; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTrackingPlanV1Output createTrackingPlanV1Output = (CreateTrackingPlanV1Output) o; + return Objects.equals(this.trackingPlan, createTrackingPlanV1Output.trackingPlan); + } + @Override + public int hashCode() { + return Objects.hash(trackingPlan); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTrackingPlanV1Output {\n"); + sb.append(" trackingPlan: ").append(toIndentedString(trackingPlan)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateTrackingPlanV1Output createTrackingPlanV1Output = (CreateTrackingPlanV1Output) o; - return Objects.equals(this.trackingPlan, createTrackingPlanV1Output.trackingPlan); - } - - @Override - public int hashCode() { - return Objects.hash(trackingPlan); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateTrackingPlanV1Output {\n"); - sb.append(" trackingPlan: ").append(toIndentedString(trackingPlan)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("trackingPlan"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("trackingPlan"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("trackingPlan"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("trackingPlan"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateTrackingPlanV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateTrackingPlanV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateTrackingPlanV1Output is not found in the empty JSON string", CreateTrackingPlanV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateTrackingPlanV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTrackingPlanV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateTrackingPlanV1Output is not" + + " found in the empty JSON string", + CreateTrackingPlanV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateTrackingPlanV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTrackingPlanV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTrackingPlanV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateTrackingPlanV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateTrackingPlanV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTrackingPlanV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `trackingPlan` + TrackingPlanV1.validateJsonElement(jsonObj.get("trackingPlan")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateTrackingPlanV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateTrackingPlanV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateTrackingPlanV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateTrackingPlanV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateTrackingPlanV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTrackingPlanV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTrackingPlanV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateTrackingPlanV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTrackingPlanV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTrackingPlanV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTrackingPlanV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTrackingPlanV1Output + * @throws IOException if the JSON string is invalid with respect to CreateTrackingPlanV1Output + */ + public static CreateTrackingPlanV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTrackingPlanV1Output.class); } - } - - /** - * Create an instance of CreateTrackingPlanV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateTrackingPlanV1Output - * @throws IOException if the JSON string is invalid with respect to CreateTrackingPlanV1Output - */ - public static CreateTrackingPlanV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateTrackingPlanV1Output.class); - } - - /** - * Convert an instance of CreateTrackingPlanV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateTrackingPlanV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateTransformation200Response.java b/src/main/java/com/segment/publicapi/models/CreateTransformation200Response.java index 308fe4de..77794da3 100644 --- a/src/main/java/com/segment/publicapi/models/CreateTransformation200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateTransformation200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateTransformationBetaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateTransformation200Response - */ - +/** CreateTransformation200Response */ public class CreateTransformation200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateTransformationBetaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateTransformation200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateTransformationV1Output data; - public CreateTransformation200Response data(CreateTransformationBetaOutput data) { - - this.data = data; - return this; - } + public CreateTransformation200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateTransformation200Response data(CreateTransformationV1Output data) { - public CreateTransformationBetaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateTransformationV1Output getData() { + return data; + } - public void setData(CreateTransformationBetaOutput data) { - this.data = data; - } + public void setData(CreateTransformationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTransformation200Response createTransformation200Response = + (CreateTransformation200Response) o; + return Objects.equals(this.data, createTransformation200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTransformation200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateTransformation200Response createTransformation200Response = (CreateTransformation200Response) o; - return Objects.equals(this.data, createTransformation200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateTransformation200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateTransformation200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateTransformation200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateTransformation200Response is not found in the empty JSON string", CreateTransformation200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateTransformation200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTransformation200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateTransformation200Response is not" + + " found in the empty JSON string", + CreateTransformation200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateTransformation200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTransformation200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTransformation200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateTransformation200Response` 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()) { + CreateTransformationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateTransformation200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateTransformation200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateTransformation200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateTransformation200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateTransformation200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTransformation200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTransformation200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateTransformation200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTransformation200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTransformation200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTransformation200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTransformation200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateTransformation200Response + */ + public static CreateTransformation200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTransformation200Response.class); } - } - - /** - * Create an instance of CreateTransformation200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateTransformation200Response - * @throws IOException if the JSON string is invalid with respect to CreateTransformation200Response - */ - public static CreateTransformation200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateTransformation200Response.class); - } - - /** - * Convert an instance of CreateTransformation200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateTransformation200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateTransformationBetaInput.java b/src/main/java/com/segment/publicapi/models/CreateTransformationBetaInput.java index 9de9a154..813c93e8 100644 --- a/src/main/java/com/segment/publicapi/models/CreateTransformationBetaInput.java +++ b/src/main/java/com/segment/publicapi/models/CreateTransformationBetaInput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,423 +9,523 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PropertyRenameBeta; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** The input to create a Transformation. */ +public class CreateTransformationBetaInput { + public static final String SERIALIZED_NAME_NAME = "name"; -/** - * The input to create a Transformation. - */ -@ApiModel(description = "The input to create a Transformation.") + @SerializedName(SERIALIZED_NAME_NAME) + private String name; -public class CreateTransformationBetaInput { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; - public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) - private String destinationMetadataId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; + public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; - public static final String SERIALIZED_NAME_NEW_EVENT_NAME = "newEventName"; - @SerializedName(SERIALIZED_NAME_NEW_EVENT_NAME) - private String newEventName; + @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) + private String destinationMetadataId; - public static final String SERIALIZED_NAME_PROPERTY_RENAMES = "propertyRenames"; - @SerializedName(SERIALIZED_NAME_PROPERTY_RENAMES) - private List propertyRenames = null; + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public CreateTransformationBetaInput() { - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public CreateTransformationBetaInput name(String name) { - - this.name = name; - return this; - } + public static final String SERIALIZED_NAME_IF = "if"; - /** - * The name of the Transformation. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the Transformation.") + @SerializedName(SERIALIZED_NAME_IF) + private String _if; - public String getName() { - return name; - } + public static final String SERIALIZED_NAME_NEW_EVENT_NAME = "newEventName"; + @SerializedName(SERIALIZED_NAME_NEW_EVENT_NAME) + private String newEventName; - public void setName(String name) { - this.name = name; - } + public static final String SERIALIZED_NAME_PROPERTY_RENAMES = "propertyRenames"; + @SerializedName(SERIALIZED_NAME_PROPERTY_RENAMES) + private List propertyRenames; - public CreateTransformationBetaInput sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + public static final String SERIALIZED_NAME_PROPERTY_VALUE_TRANSFORMATIONS = + "propertyValueTransformations"; - /** - * The Source to be associated with the Transformation. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source to be associated with the Transformation.") + @SerializedName(SERIALIZED_NAME_PROPERTY_VALUE_TRANSFORMATIONS) + private List propertyValueTransformations; - public String getSourceId() { - return sourceId; - } + public CreateTransformationBetaInput() {} + public CreateTransformationBetaInput name(String name) { - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + this.name = name; + return this; + } + /** + * The name of the Transformation. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public CreateTransformationBetaInput destinationMetadataId(String destinationMetadataId) { - - this.destinationMetadataId = destinationMetadataId; - return this; - } + public void setName(String name) { + this.name = name; + } + + public CreateTransformationBetaInput sourceId(String sourceId) { + + this.sourceId = sourceId; + return this; + } + + /** + * The Source to be associated with the Transformation. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public CreateTransformationBetaInput destinationMetadataId(String destinationMetadataId) { + + this.destinationMetadataId = destinationMetadataId; + return this; + } + + /** + * The optional Destination metadata id to be associated with the Transformation. + * + * @return destinationMetadataId + */ + @javax.annotation.Nullable + public String getDestinationMetadataId() { + return destinationMetadataId; + } + + public void setDestinationMetadataId(String destinationMetadataId) { + this.destinationMetadataId = destinationMetadataId; + } + + public CreateTransformationBetaInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } - /** - * The optional Destination metadata id to be associated with the Transformation. - * @return destinationMetadataId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The optional Destination metadata id to be associated with the Transformation.") + /** + * If the Transformation should be enabled. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } - public String getDestinationMetadataId() { - return destinationMetadataId; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + public CreateTransformationBetaInput _if(String _if) { - public void setDestinationMetadataId(String destinationMetadataId) { - this.destinationMetadataId = destinationMetadataId; - } + this._if = _if; + return this; + } + /** + * If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard + * event matchers, use the following: Track -\\> + * \"event='\\<eventName\\>'\" Identify -\\> + * \"type='identify'\" Group -\\> + * \"type='group'\" + * + * @return _if + */ + @javax.annotation.Nonnull + public String getIf() { + return _if; + } - public CreateTransformationBetaInput enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public void setIf(String _if) { + this._if = _if; + } - /** - * If the Transformation should be enabled. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "If the Transformation should be enabled.") + public CreateTransformationBetaInput newEventName(String newEventName) { - public Boolean getEnabled() { - return enabled; - } + this.newEventName = newEventName; + return this; + } + /** + * Optional new event name for renaming events. Works only for 'track' event type. + * + * @return newEventName + */ + @javax.annotation.Nullable + public String getNewEventName() { + return newEventName; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public void setNewEventName(String newEventName) { + this.newEventName = newEventName; + } + public CreateTransformationBetaInput propertyRenames(List propertyRenames) { - public CreateTransformationBetaInput _if(String _if) { - - this._if = _if; - return this; - } + this.propertyRenames = propertyRenames; + return this; + } - /** - * If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> \"event='\\<eventName\\>'\" Identify -\\> \"type='identify'\" Group -\\> \"type='group'\" - * @return _if - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> \"event='\\'\" Identify -\\> \"type='identify'\" Group -\\> \"type='group'\"") - - public String getIf() { - return _if; - } - - - public void setIf(String _if) { - this._if = _if; - } - - - public CreateTransformationBetaInput newEventName(String newEventName) { - - this.newEventName = newEventName; - return this; - } - - /** - * Optional new event name for renaming events. Works only for 'track' event type. - * @return newEventName - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Optional new event name for renaming events. Works only for 'track' event type.") - - public String getNewEventName() { - return newEventName; - } - - - public void setNewEventName(String newEventName) { - this.newEventName = newEventName; - } - - - public CreateTransformationBetaInput propertyRenames(List propertyRenames) { - - this.propertyRenames = propertyRenames; - return this; - } - - public CreateTransformationBetaInput addPropertyRenamesItem(PropertyRenameBeta propertyRenamesItem) { - if (this.propertyRenames == null) { - this.propertyRenames = new ArrayList<>(); - } - this.propertyRenames.add(propertyRenamesItem); - return this; - } - - /** - * Optional array for renaming properties collected by your events. - * @return propertyRenames - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Optional array for renaming properties collected by your events.") - - public List getPropertyRenames() { - return propertyRenames; - } - - - public void setPropertyRenames(List propertyRenames) { - this.propertyRenames = propertyRenames; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateTransformationBetaInput createTransformationBetaInput = (CreateTransformationBetaInput) o; - return Objects.equals(this.name, createTransformationBetaInput.name) && - Objects.equals(this.sourceId, createTransformationBetaInput.sourceId) && - Objects.equals(this.destinationMetadataId, createTransformationBetaInput.destinationMetadataId) && - Objects.equals(this.enabled, createTransformationBetaInput.enabled) && - Objects.equals(this._if, createTransformationBetaInput._if) && - Objects.equals(this.newEventName, createTransformationBetaInput.newEventName) && - Objects.equals(this.propertyRenames, createTransformationBetaInput.propertyRenames); - } - - @Override - public int hashCode() { - return Objects.hash(name, sourceId, destinationMetadataId, enabled, _if, newEventName, propertyRenames); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateTransformationBetaInput {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" destinationMetadataId: ").append(toIndentedString(destinationMetadataId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" newEventName: ").append(toIndentedString(newEventName)).append("\n"); - sb.append(" propertyRenames: ").append(toIndentedString(propertyRenames)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("sourceId"); - openapiFields.add("destinationMetadataId"); - openapiFields.add("enabled"); - openapiFields.add("if"); - openapiFields.add("newEventName"); - openapiFields.add("propertyRenames"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("if"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateTransformationBetaInput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateTransformationBetaInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateTransformationBetaInput is not found in the empty JSON string", CreateTransformationBetaInput.openapiRequiredFields.toString())); + public CreateTransformationBetaInput addPropertyRenamesItem( + PropertyRenameBeta propertyRenamesItem) { + if (this.propertyRenames == null) { + this.propertyRenames = new ArrayList<>(); } - } + this.propertyRenames.add(propertyRenamesItem); + return this; + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateTransformationBetaInput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTransformationBetaInput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + /** + * Optional array for renaming properties collected by your events. + * + * @return propertyRenames + */ + @javax.annotation.Nullable + public List getPropertyRenames() { + return propertyRenames; + } + + public void setPropertyRenames(List propertyRenames) { + this.propertyRenames = propertyRenames; + } + + public CreateTransformationBetaInput propertyValueTransformations( + List propertyValueTransformations) { + + this.propertyValueTransformations = propertyValueTransformations; + return this; + } + + public CreateTransformationBetaInput addPropertyValueTransformationsItem( + PropertyValueTransformationBeta propertyValueTransformationsItem) { + if (this.propertyValueTransformations == null) { + this.propertyValueTransformations = new ArrayList<>(); } - } + this.propertyValueTransformations.add(propertyValueTransformationsItem); + return this; + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateTransformationBetaInput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + /** + * Optional array for transforming properties and values collected by your events. Limited to 10 + * properties. + * + * @return propertyValueTransformations + */ + @javax.annotation.Nullable + public List getPropertyValueTransformations() { + return propertyValueTransformations; + } + + public void setPropertyValueTransformations( + List propertyValueTransformations) { + this.propertyValueTransformations = propertyValueTransformations; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - } - 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("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if ((jsonObj.get("destinationMetadataId") != null && !jsonObj.get("destinationMetadataId").isJsonNull()) && !jsonObj.get("destinationMetadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationMetadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationMetadataId").toString())); - } - if (!jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - if ((jsonObj.get("newEventName") != null && !jsonObj.get("newEventName").isJsonNull()) && !jsonObj.get("newEventName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `newEventName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("newEventName").toString())); - } - if (jsonObj.get("propertyRenames") != null && !jsonObj.get("propertyRenames").isJsonNull()) { - JsonArray jsonArraypropertyRenames = jsonObj.getAsJsonArray("propertyRenames"); - if (jsonArraypropertyRenames != null) { - // ensure the json data is an array - if (!jsonObj.get("propertyRenames").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `propertyRenames` to be an array in the JSON string but got `%s`", jsonObj.get("propertyRenames").toString())); - } + if (o == null || getClass() != o.getClass()) { + return false; } - } - } + CreateTransformationBetaInput createTransformationBetaInput = + (CreateTransformationBetaInput) o; + return Objects.equals(this.name, createTransformationBetaInput.name) + && Objects.equals(this.sourceId, createTransformationBetaInput.sourceId) + && Objects.equals( + this.destinationMetadataId, + createTransformationBetaInput.destinationMetadataId) + && Objects.equals(this.enabled, createTransformationBetaInput.enabled) + && Objects.equals(this._if, createTransformationBetaInput._if) + && Objects.equals(this.newEventName, createTransformationBetaInput.newEventName) + && Objects.equals( + this.propertyRenames, createTransformationBetaInput.propertyRenames) + && Objects.equals( + this.propertyValueTransformations, + createTransformationBetaInput.propertyValueTransformations); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateTransformationBetaInput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateTransformationBetaInput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateTransformationBetaInput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateTransformationBetaInput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateTransformationBetaInput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of CreateTransformationBetaInput given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateTransformationBetaInput - * @throws IOException if the JSON string is invalid with respect to CreateTransformationBetaInput - */ - public static CreateTransformationBetaInput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateTransformationBetaInput.class); - } - - /** - * Convert an instance of CreateTransformationBetaInput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public int hashCode() { + return Objects.hash( + name, + sourceId, + destinationMetadataId, + enabled, + _if, + newEventName, + propertyRenames, + propertyValueTransformations); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTransformationBetaInput {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" destinationMetadataId: ") + .append(toIndentedString(destinationMetadataId)) + .append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" newEventName: ").append(toIndentedString(newEventName)).append("\n"); + sb.append(" propertyRenames: ").append(toIndentedString(propertyRenames)).append("\n"); + sb.append(" propertyValueTransformations: ") + .append(toIndentedString(propertyValueTransformations)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("sourceId"); + openapiFields.add("destinationMetadataId"); + openapiFields.add("enabled"); + openapiFields.add("if"); + openapiFields.add("newEventName"); + openapiFields.add("propertyRenames"); + openapiFields.add("propertyValueTransformations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("if"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateTransformationBetaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTransformationBetaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateTransformationBetaInput is not" + + " found in the empty JSON string", + CreateTransformationBetaInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTransformationBetaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateTransformationBetaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTransformationBetaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if ((jsonObj.get("destinationMetadataId") != null + && !jsonObj.get("destinationMetadataId").isJsonNull()) + && !jsonObj.get("destinationMetadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `destinationMetadataId` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("destinationMetadataId").toString())); + } + if (!jsonObj.get("if").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `if` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("if").toString())); + } + if ((jsonObj.get("newEventName") != null && !jsonObj.get("newEventName").isJsonNull()) + && !jsonObj.get("newEventName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `newEventName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("newEventName").toString())); + } + if (jsonObj.get("propertyRenames") != null + && !jsonObj.get("propertyRenames").isJsonNull()) { + JsonArray jsonArraypropertyRenames = jsonObj.getAsJsonArray("propertyRenames"); + if (jsonArraypropertyRenames != null) { + // ensure the json data is an array + if (!jsonObj.get("propertyRenames").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyRenames` to be an array in the" + + " JSON string but got `%s`", + jsonObj.get("propertyRenames").toString())); + } + + // validate the optional field `propertyRenames` (array) + for (int i = 0; i < jsonArraypropertyRenames.size(); i++) { + PropertyRenameBeta.validateJsonElement(jsonArraypropertyRenames.get(i)); + } + ; + } + } + if (jsonObj.get("propertyValueTransformations") != null + && !jsonObj.get("propertyValueTransformations").isJsonNull()) { + JsonArray jsonArraypropertyValueTransformations = + jsonObj.getAsJsonArray("propertyValueTransformations"); + if (jsonArraypropertyValueTransformations != null) { + // ensure the json data is an array + if (!jsonObj.get("propertyValueTransformations").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyValueTransformations` to be an" + + " array in the JSON string but got `%s`", + jsonObj.get("propertyValueTransformations").toString())); + } + + // validate the optional field `propertyValueTransformations` (array) + for (int i = 0; i < jsonArraypropertyValueTransformations.size(); i++) { + PropertyValueTransformationBeta.validateJsonElement( + jsonArraypropertyValueTransformations.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTransformationBetaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTransformationBetaInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateTransformationBetaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTransformationBetaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTransformationBetaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTransformationBetaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTransformationBetaInput + * @throws IOException if the JSON string is invalid with respect to + * CreateTransformationBetaInput + */ + public static CreateTransformationBetaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTransformationBetaInput.class); + } + + /** + * Convert an instance of CreateTransformationBetaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateTransformationBetaOutput.java b/src/main/java/com/segment/publicapi/models/CreateTransformationBetaOutput.java index fac7e493..60f3c737 100644 --- a/src/main/java/com/segment/publicapi/models/CreateTransformationBetaOutput.java +++ b/src/main/java/com/segment/publicapi/models/CreateTransformationBetaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,200 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Transformation2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The output of a created Transformation. - */ -@ApiModel(description = "The output of a created Transformation.") - +/** The output of a created Transformation. */ public class CreateTransformationBetaOutput { - public static final String SERIALIZED_NAME_TRANSFORMATION = "transformation"; - @SerializedName(SERIALIZED_NAME_TRANSFORMATION) - private Transformation2 transformation; + public static final String SERIALIZED_NAME_TRANSFORMATION = "transformation"; - public CreateTransformationBetaOutput() { - } + @SerializedName(SERIALIZED_NAME_TRANSFORMATION) + private TransformationBeta transformation; - public CreateTransformationBetaOutput transformation(Transformation2 transformation) { - - this.transformation = transformation; - return this; - } + public CreateTransformationBetaOutput() {} - /** - * Get transformation - * @return transformation - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateTransformationBetaOutput transformation(TransformationBeta transformation) { - public Transformation2 getTransformation() { - return transformation; - } + this.transformation = transformation; + return this; + } + /** + * Get transformation + * + * @return transformation + */ + @javax.annotation.Nonnull + public TransformationBeta getTransformation() { + return transformation; + } - public void setTransformation(Transformation2 transformation) { - this.transformation = transformation; - } + public void setTransformation(TransformationBeta transformation) { + this.transformation = transformation; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTransformationBetaOutput createTransformationBetaOutput = + (CreateTransformationBetaOutput) o; + return Objects.equals(this.transformation, createTransformationBetaOutput.transformation); + } + @Override + public int hashCode() { + return Objects.hash(transformation); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTransformationBetaOutput {\n"); + sb.append(" transformation: ").append(toIndentedString(transformation)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateTransformationBetaOutput createTransformationBetaOutput = (CreateTransformationBetaOutput) o; - return Objects.equals(this.transformation, createTransformationBetaOutput.transformation); - } - - @Override - public int hashCode() { - return Objects.hash(transformation); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateTransformationBetaOutput {\n"); - sb.append(" transformation: ").append(toIndentedString(transformation)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transformation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("transformation"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("transformation"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("transformation"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateTransformationBetaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateTransformationBetaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateTransformationBetaOutput is not found in the empty JSON string", CreateTransformationBetaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateTransformationBetaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTransformationBetaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateTransformationBetaOutput is not" + + " found in the empty JSON string", + CreateTransformationBetaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateTransformationBetaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTransformationBetaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTransformationBetaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateTransformationBetaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateTransformationBetaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTransformationBetaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `transformation` + TransformationBeta.validateJsonElement(jsonObj.get("transformation")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateTransformationBetaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateTransformationBetaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateTransformationBetaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateTransformationBetaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateTransformationBetaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTransformationBetaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTransformationBetaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateTransformationBetaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTransformationBetaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTransformationBetaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTransformationBetaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTransformationBetaOutput + * @throws IOException if the JSON string is invalid with respect to + * CreateTransformationBetaOutput + */ + public static CreateTransformationBetaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTransformationBetaOutput.class); } - } - - /** - * Create an instance of CreateTransformationBetaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateTransformationBetaOutput - * @throws IOException if the JSON string is invalid with respect to CreateTransformationBetaOutput - */ - public static CreateTransformationBetaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateTransformationBetaOutput.class); - } - - /** - * Convert an instance of CreateTransformationBetaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateTransformationBetaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateTransformationV1Input.java b/src/main/java/com/segment/publicapi/models/CreateTransformationV1Input.java new file mode 100644 index 00000000..ae2ef47d --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateTransformationV1Input.java @@ -0,0 +1,709 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** The input to create a Transformation. */ +public class CreateTransformationV1Input { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; + + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; + + public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; + + @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) + private String destinationMetadataId; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_IF = "if"; + + @SerializedName(SERIALIZED_NAME_IF) + private String _if; + + public static final String SERIALIZED_NAME_DROP = "drop"; + + @SerializedName(SERIALIZED_NAME_DROP) + private Boolean drop; + + public static final String SERIALIZED_NAME_NEW_EVENT_NAME = "newEventName"; + + @SerializedName(SERIALIZED_NAME_NEW_EVENT_NAME) + private String newEventName; + + public static final String SERIALIZED_NAME_PROPERTY_RENAMES = "propertyRenames"; + + @SerializedName(SERIALIZED_NAME_PROPERTY_RENAMES) + private List propertyRenames; + + public static final String SERIALIZED_NAME_PROPERTY_VALUE_TRANSFORMATIONS = + "propertyValueTransformations"; + + @SerializedName(SERIALIZED_NAME_PROPERTY_VALUE_TRANSFORMATIONS) + private List propertyValueTransformations; + + public static final String SERIALIZED_NAME_FQL_DEFINED_PROPERTIES = "fqlDefinedProperties"; + + @SerializedName(SERIALIZED_NAME_FQL_DEFINED_PROPERTIES) + private List fqlDefinedProperties; + + public static final String SERIALIZED_NAME_ALLOW_PROPERTIES = "allowProperties"; + + @SerializedName(SERIALIZED_NAME_ALLOW_PROPERTIES) + private List allowProperties; + + public static final String SERIALIZED_NAME_HASH_PROPERTIES_CONFIGURATION = + "hashPropertiesConfiguration"; + + @SerializedName(SERIALIZED_NAME_HASH_PROPERTIES_CONFIGURATION) + private HashPropertiesConfiguration hashPropertiesConfiguration; + + public CreateTransformationV1Input() {} + + public CreateTransformationV1Input name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the Transformation. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreateTransformationV1Input sourceId(String sourceId) { + + this.sourceId = sourceId; + return this; + } + + /** + * The Source to be associated with the Transformation. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public CreateTransformationV1Input destinationMetadataId(String destinationMetadataId) { + + this.destinationMetadataId = destinationMetadataId; + return this; + } + + /** + * The optional Destination metadata id to be associated with the Transformation. + * + * @return destinationMetadataId + */ + @javax.annotation.Nullable + public String getDestinationMetadataId() { + return destinationMetadataId; + } + + public void setDestinationMetadataId(String destinationMetadataId) { + this.destinationMetadataId = destinationMetadataId; + } + + public CreateTransformationV1Input enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * If the Transformation should be enabled. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public CreateTransformationV1Input _if(String _if) { + + this._if = _if; + return this; + } + + /** + * If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard + * event matchers, use the following: Track -\\> + * \"event='\\<eventName\\>'\" Identify -\\> + * \"type='identify'\" Group -\\> + * \"type='group'\" + * + * @return _if + */ + @javax.annotation.Nonnull + public String getIf() { + return _if; + } + + public void setIf(String _if) { + this._if = _if; + } + + public CreateTransformationV1Input drop(Boolean drop) { + + this.drop = drop; + return this; + } + + /** + * Optional boolean value if the Transformation should drop the event entirely when the if + * statement matches, ignores all other transforms. + * + * @return drop + */ + @javax.annotation.Nullable + public Boolean getDrop() { + return drop; + } + + public void setDrop(Boolean drop) { + this.drop = drop; + } + + public CreateTransformationV1Input newEventName(String newEventName) { + + this.newEventName = newEventName; + return this; + } + + /** + * Optional new event name for renaming events. Works only for 'track' event type. + * + * @return newEventName + */ + @javax.annotation.Nullable + public String getNewEventName() { + return newEventName; + } + + public void setNewEventName(String newEventName) { + this.newEventName = newEventName; + } + + public CreateTransformationV1Input propertyRenames(List propertyRenames) { + + this.propertyRenames = propertyRenames; + return this; + } + + public CreateTransformationV1Input addPropertyRenamesItem( + PropertyRenameV1 propertyRenamesItem) { + if (this.propertyRenames == null) { + this.propertyRenames = new ArrayList<>(); + } + this.propertyRenames.add(propertyRenamesItem); + return this; + } + + /** + * Optional array for renaming properties collected by your events. + * + * @return propertyRenames + */ + @javax.annotation.Nullable + public List getPropertyRenames() { + return propertyRenames; + } + + public void setPropertyRenames(List propertyRenames) { + this.propertyRenames = propertyRenames; + } + + public CreateTransformationV1Input propertyValueTransformations( + List propertyValueTransformations) { + + this.propertyValueTransformations = propertyValueTransformations; + return this; + } + + public CreateTransformationV1Input addPropertyValueTransformationsItem( + PropertyValueTransformationV1 propertyValueTransformationsItem) { + if (this.propertyValueTransformations == null) { + this.propertyValueTransformations = new ArrayList<>(); + } + this.propertyValueTransformations.add(propertyValueTransformationsItem); + return this; + } + + /** + * Optional array for transforming properties and values collected by your events. Limited to 10 + * properties. + * + * @return propertyValueTransformations + */ + @javax.annotation.Nullable + public List getPropertyValueTransformations() { + return propertyValueTransformations; + } + + public void setPropertyValueTransformations( + List propertyValueTransformations) { + this.propertyValueTransformations = propertyValueTransformations; + } + + public CreateTransformationV1Input fqlDefinedProperties( + List fqlDefinedProperties) { + + this.fqlDefinedProperties = fqlDefinedProperties; + return this; + } + + public CreateTransformationV1Input addFqlDefinedPropertiesItem( + FQLDefinedPropertyV1 fqlDefinedPropertiesItem) { + if (this.fqlDefinedProperties == null) { + this.fqlDefinedProperties = new ArrayList<>(); + } + this.fqlDefinedProperties.add(fqlDefinedPropertiesItem); + return this; + } + + /** + * Optional array for defining new properties in + * [FQL](https://segment.com/docs/config-api/fql/). Currently limited to 1 property. + * + * @return fqlDefinedProperties + */ + @javax.annotation.Nullable + public List getFqlDefinedProperties() { + return fqlDefinedProperties; + } + + public void setFqlDefinedProperties(List fqlDefinedProperties) { + this.fqlDefinedProperties = fqlDefinedProperties; + } + + public CreateTransformationV1Input allowProperties(List allowProperties) { + + this.allowProperties = allowProperties; + return this; + } + + public CreateTransformationV1Input addAllowPropertiesItem(String allowPropertiesItem) { + if (this.allowProperties == null) { + this.allowProperties = new ArrayList<>(); + } + this.allowProperties.add(allowPropertiesItem); + return this; + } + + /** + * Optional array for allowing properties from your events. + * + * @return allowProperties + */ + @javax.annotation.Nullable + public List getAllowProperties() { + return allowProperties; + } + + public void setAllowProperties(List allowProperties) { + this.allowProperties = allowProperties; + } + + public CreateTransformationV1Input hashPropertiesConfiguration( + HashPropertiesConfiguration hashPropertiesConfiguration) { + + this.hashPropertiesConfiguration = hashPropertiesConfiguration; + return this; + } + + /** + * Get hashPropertiesConfiguration + * + * @return hashPropertiesConfiguration + */ + @javax.annotation.Nullable + public HashPropertiesConfiguration getHashPropertiesConfiguration() { + return hashPropertiesConfiguration; + } + + public void setHashPropertiesConfiguration( + HashPropertiesConfiguration hashPropertiesConfiguration) { + this.hashPropertiesConfiguration = hashPropertiesConfiguration; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTransformationV1Input createTransformationV1Input = (CreateTransformationV1Input) o; + return Objects.equals(this.name, createTransformationV1Input.name) + && Objects.equals(this.sourceId, createTransformationV1Input.sourceId) + && Objects.equals( + this.destinationMetadataId, + createTransformationV1Input.destinationMetadataId) + && Objects.equals(this.enabled, createTransformationV1Input.enabled) + && Objects.equals(this._if, createTransformationV1Input._if) + && Objects.equals(this.drop, createTransformationV1Input.drop) + && Objects.equals(this.newEventName, createTransformationV1Input.newEventName) + && Objects.equals(this.propertyRenames, createTransformationV1Input.propertyRenames) + && Objects.equals( + this.propertyValueTransformations, + createTransformationV1Input.propertyValueTransformations) + && Objects.equals( + this.fqlDefinedProperties, createTransformationV1Input.fqlDefinedProperties) + && Objects.equals(this.allowProperties, createTransformationV1Input.allowProperties) + && Objects.equals( + this.hashPropertiesConfiguration, + createTransformationV1Input.hashPropertiesConfiguration); + } + + @Override + public int hashCode() { + return Objects.hash( + name, + sourceId, + destinationMetadataId, + enabled, + _if, + drop, + newEventName, + propertyRenames, + propertyValueTransformations, + fqlDefinedProperties, + allowProperties, + hashPropertiesConfiguration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTransformationV1Input {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" destinationMetadataId: ") + .append(toIndentedString(destinationMetadataId)) + .append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" drop: ").append(toIndentedString(drop)).append("\n"); + sb.append(" newEventName: ").append(toIndentedString(newEventName)).append("\n"); + sb.append(" propertyRenames: ").append(toIndentedString(propertyRenames)).append("\n"); + sb.append(" propertyValueTransformations: ") + .append(toIndentedString(propertyValueTransformations)) + .append("\n"); + sb.append(" fqlDefinedProperties: ") + .append(toIndentedString(fqlDefinedProperties)) + .append("\n"); + sb.append(" allowProperties: ").append(toIndentedString(allowProperties)).append("\n"); + sb.append(" hashPropertiesConfiguration: ") + .append(toIndentedString(hashPropertiesConfiguration)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("sourceId"); + openapiFields.add("destinationMetadataId"); + openapiFields.add("enabled"); + openapiFields.add("if"); + openapiFields.add("drop"); + openapiFields.add("newEventName"); + openapiFields.add("propertyRenames"); + openapiFields.add("propertyValueTransformations"); + openapiFields.add("fqlDefinedProperties"); + openapiFields.add("allowProperties"); + openapiFields.add("hashPropertiesConfiguration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("if"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateTransformationV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTransformationV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateTransformationV1Input is not" + + " found in the empty JSON string", + CreateTransformationV1Input.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTransformationV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateTransformationV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTransformationV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if ((jsonObj.get("destinationMetadataId") != null + && !jsonObj.get("destinationMetadataId").isJsonNull()) + && !jsonObj.get("destinationMetadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `destinationMetadataId` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("destinationMetadataId").toString())); + } + if (!jsonObj.get("if").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `if` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("if").toString())); + } + if ((jsonObj.get("newEventName") != null && !jsonObj.get("newEventName").isJsonNull()) + && !jsonObj.get("newEventName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `newEventName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("newEventName").toString())); + } + if (jsonObj.get("propertyRenames") != null + && !jsonObj.get("propertyRenames").isJsonNull()) { + JsonArray jsonArraypropertyRenames = jsonObj.getAsJsonArray("propertyRenames"); + if (jsonArraypropertyRenames != null) { + // ensure the json data is an array + if (!jsonObj.get("propertyRenames").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyRenames` to be an array in the" + + " JSON string but got `%s`", + jsonObj.get("propertyRenames").toString())); + } + + // validate the optional field `propertyRenames` (array) + for (int i = 0; i < jsonArraypropertyRenames.size(); i++) { + PropertyRenameV1.validateJsonElement(jsonArraypropertyRenames.get(i)); + } + ; + } + } + if (jsonObj.get("propertyValueTransformations") != null + && !jsonObj.get("propertyValueTransformations").isJsonNull()) { + JsonArray jsonArraypropertyValueTransformations = + jsonObj.getAsJsonArray("propertyValueTransformations"); + if (jsonArraypropertyValueTransformations != null) { + // ensure the json data is an array + if (!jsonObj.get("propertyValueTransformations").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyValueTransformations` to be an" + + " array in the JSON string but got `%s`", + jsonObj.get("propertyValueTransformations").toString())); + } + + // validate the optional field `propertyValueTransformations` (array) + for (int i = 0; i < jsonArraypropertyValueTransformations.size(); i++) { + PropertyValueTransformationV1.validateJsonElement( + jsonArraypropertyValueTransformations.get(i)); + } + ; + } + } + if (jsonObj.get("fqlDefinedProperties") != null + && !jsonObj.get("fqlDefinedProperties").isJsonNull()) { + JsonArray jsonArrayfqlDefinedProperties = + jsonObj.getAsJsonArray("fqlDefinedProperties"); + if (jsonArrayfqlDefinedProperties != null) { + // ensure the json data is an array + if (!jsonObj.get("fqlDefinedProperties").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fqlDefinedProperties` to be an array in" + + " the JSON string but got `%s`", + jsonObj.get("fqlDefinedProperties").toString())); + } + + // validate the optional field `fqlDefinedProperties` (array) + for (int i = 0; i < jsonArrayfqlDefinedProperties.size(); i++) { + FQLDefinedPropertyV1.validateJsonElement(jsonArrayfqlDefinedProperties.get(i)); + } + ; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("allowProperties") != null + && !jsonObj.get("allowProperties").isJsonNull() + && !jsonObj.get("allowProperties").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `allowProperties` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("allowProperties").toString())); + } + // validate the optional field `hashPropertiesConfiguration` + if (jsonObj.get("hashPropertiesConfiguration") != null + && !jsonObj.get("hashPropertiesConfiguration").isJsonNull()) { + HashPropertiesConfiguration.validateJsonElement( + jsonObj.get("hashPropertiesConfiguration")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTransformationV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTransformationV1Input' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateTransformationV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTransformationV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTransformationV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTransformationV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTransformationV1Input + * @throws IOException if the JSON string is invalid with respect to CreateTransformationV1Input + */ + public static CreateTransformationV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTransformationV1Input.class); + } + + /** + * Convert an instance of CreateTransformationV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateTransformationV1Output.java b/src/main/java/com/segment/publicapi/models/CreateTransformationV1Output.java new file mode 100644 index 00000000..95364c3f --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateTransformationV1Output.java @@ -0,0 +1,207 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** The output of a created Transformation. */ +public class CreateTransformationV1Output { + public static final String SERIALIZED_NAME_TRANSFORMATION = "transformation"; + + @SerializedName(SERIALIZED_NAME_TRANSFORMATION) + private TransformationV1 transformation; + + public CreateTransformationV1Output() {} + + public CreateTransformationV1Output transformation(TransformationV1 transformation) { + + this.transformation = transformation; + return this; + } + + /** + * Get transformation + * + * @return transformation + */ + @javax.annotation.Nonnull + public TransformationV1 getTransformation() { + return transformation; + } + + public void setTransformation(TransformationV1 transformation) { + this.transformation = transformation; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTransformationV1Output createTransformationV1Output = + (CreateTransformationV1Output) o; + return Objects.equals(this.transformation, createTransformationV1Output.transformation); + } + + @Override + public int hashCode() { + return Objects.hash(transformation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTransformationV1Output {\n"); + sb.append(" transformation: ").append(toIndentedString(transformation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transformation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("transformation"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateTransformationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTransformationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateTransformationV1Output is not" + + " found in the empty JSON string", + CreateTransformationV1Output.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTransformationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateTransformationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTransformationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `transformation` + TransformationV1.validateJsonElement(jsonObj.get("transformation")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTransformationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTransformationV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateTransformationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTransformationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTransformationV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTransformationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTransformationV1Output + * @throws IOException if the JSON string is invalid with respect to + * CreateTransformationV1Output + */ + public static CreateTransformationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTransformationV1Output.class); + } + + /** + * Convert an instance of CreateTransformationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateUserGroup200Response.java b/src/main/java/com/segment/publicapi/models/CreateUserGroup200Response.java index 34938a21..6f36bcbb 100644 --- a/src/main/java/com/segment/publicapi/models/CreateUserGroup200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateUserGroup200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateUserGroupV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateUserGroup200Response - */ - +/** CreateUserGroup200Response */ public class CreateUserGroup200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateUserGroupV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateUserGroup200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateUserGroupV1Output data; - public CreateUserGroup200Response data(CreateUserGroupV1Output data) { - - this.data = data; - return this; - } + public CreateUserGroup200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateUserGroup200Response data(CreateUserGroupV1Output data) { - public CreateUserGroupV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateUserGroupV1Output getData() { + return data; + } - public void setData(CreateUserGroupV1Output data) { - this.data = data; - } + public void setData(CreateUserGroupV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateUserGroup200Response createUserGroup200Response = (CreateUserGroup200Response) o; + return Objects.equals(this.data, createUserGroup200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateUserGroup200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateUserGroup200Response createUserGroup200Response = (CreateUserGroup200Response) o; - return Objects.equals(this.data, createUserGroup200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateUserGroup200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateUserGroup200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateUserGroup200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateUserGroup200Response is not found in the empty JSON string", CreateUserGroup200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateUserGroup200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateUserGroup200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateUserGroup200Response is not" + + " found in the empty JSON string", + CreateUserGroup200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateUserGroup200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateUserGroup200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateUserGroup200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateUserGroup200Response` 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()) { + CreateUserGroupV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateUserGroup200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateUserGroup200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateUserGroup200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateUserGroup200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateUserGroup200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateUserGroup200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateUserGroup200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateUserGroup200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateUserGroup200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateUserGroup200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateUserGroup200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateUserGroup200Response + * @throws IOException if the JSON string is invalid with respect to CreateUserGroup200Response + */ + public static CreateUserGroup200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateUserGroup200Response.class); } - } - - /** - * Create an instance of CreateUserGroup200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateUserGroup200Response - * @throws IOException if the JSON string is invalid with respect to CreateUserGroup200Response - */ - public static CreateUserGroup200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateUserGroup200Response.class); - } - - /** - * Convert an instance of CreateUserGroup200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateUserGroup200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateUserGroupV1Input.java b/src/main/java/com/segment/publicapi/models/CreateUserGroupV1Input.java index ebfade04..0e3046a0 100644 --- a/src/main/java/com/segment/publicapi/models/CreateUserGroupV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateUserGroupV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,208 +9,199 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Creates a user group, used to bundle permissions for its members, within a Workspace. - */ -@ApiModel(description = "Creates a user group, used to bundle permissions for its members, within a Workspace.") - +/** Creates a user group, used to bundle permissions for its members, within a Workspace. */ public class CreateUserGroupV1Input { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_NAME = "name"; - public CreateUserGroupV1Input() { - } + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public CreateUserGroupV1Input name(String name) { - - this.name = name; - return this; - } + public CreateUserGroupV1Input() {} - /** - * The name of the user group to create. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the user group to create.") + public CreateUserGroupV1Input name(String name) { - public String getName() { - return name; - } + this.name = name; + return this; + } + /** + * The name of the user group to create. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public void setName(String name) { - this.name = 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; + } + CreateUserGroupV1Input createUserGroupV1Input = (CreateUserGroupV1Input) o; + return Objects.equals(this.name, createUserGroupV1Input.name); + } + @Override + public int hashCode() { + return Objects.hash(name); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateUserGroupV1Input {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateUserGroupV1Input createUserGroupV1Input = (CreateUserGroupV1Input) o; - return Objects.equals(this.name, createUserGroupV1Input.name); - } - - @Override - public int hashCode() { - return Objects.hash(name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateUserGroupV1Input {\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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); } - return o.toString().replace("\n", "\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"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateUserGroupV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateUserGroupV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateUserGroupV1Input is not found in the empty JSON string", CreateUserGroupV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateUserGroupV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateUserGroupV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateUserGroupV1Input is not found in" + + " the empty JSON string", + CreateUserGroupV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateUserGroupV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateUserGroupV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateUserGroupV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateUserGroupV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateUserGroupV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateUserGroupV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!CreateUserGroupV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateUserGroupV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateUserGroupV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateUserGroupV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateUserGroupV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateUserGroupV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateUserGroupV1Input - * @throws IOException if the JSON string is invalid with respect to CreateUserGroupV1Input - */ - public static CreateUserGroupV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateUserGroupV1Input.class); - } - - /** - * Convert an instance of CreateUserGroupV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateUserGroupV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateUserGroupV1Input' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateUserGroupV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateUserGroupV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateUserGroupV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateUserGroupV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateUserGroupV1Input + * @throws IOException if the JSON string is invalid with respect to CreateUserGroupV1Input + */ + public static CreateUserGroupV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateUserGroupV1Input.class); + } + + /** + * Convert an instance of CreateUserGroupV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateUserGroupV1Output.java b/src/main/java/com/segment/publicapi/models/CreateUserGroupV1Output.java index f84f99c3..4d955da9 100644 --- a/src/main/java/com/segment/publicapi/models/CreateUserGroupV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateUserGroupV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UserGroup; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the newly created user group. - */ -@ApiModel(description = "Returns the newly created user group.") - +/** Returns the newly created user group. */ public class CreateUserGroupV1Output { - public static final String SERIALIZED_NAME_USER_GROUP = "userGroup"; - @SerializedName(SERIALIZED_NAME_USER_GROUP) - private UserGroup userGroup; + public static final String SERIALIZED_NAME_USER_GROUP = "userGroup"; - public CreateUserGroupV1Output() { - } + @SerializedName(SERIALIZED_NAME_USER_GROUP) + private UserGroupV1 userGroup; - public CreateUserGroupV1Output userGroup(UserGroup userGroup) { - - this.userGroup = userGroup; - return this; - } + public CreateUserGroupV1Output() {} - /** - * Get userGroup - * @return userGroup - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateUserGroupV1Output userGroup(UserGroupV1 userGroup) { - public UserGroup getUserGroup() { - return userGroup; - } + this.userGroup = userGroup; + return this; + } + /** + * Get userGroup + * + * @return userGroup + */ + @javax.annotation.Nonnull + public UserGroupV1 getUserGroup() { + return userGroup; + } - public void setUserGroup(UserGroup userGroup) { - this.userGroup = userGroup; - } + public void setUserGroup(UserGroupV1 userGroup) { + this.userGroup = userGroup; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateUserGroupV1Output createUserGroupV1Output = (CreateUserGroupV1Output) o; + return Objects.equals(this.userGroup, createUserGroupV1Output.userGroup); + } + @Override + public int hashCode() { + return Objects.hash(userGroup); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateUserGroupV1Output {\n"); + sb.append(" userGroup: ").append(toIndentedString(userGroup)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateUserGroupV1Output createUserGroupV1Output = (CreateUserGroupV1Output) o; - return Objects.equals(this.userGroup, createUserGroupV1Output.userGroup); - } - - @Override - public int hashCode() { - return Objects.hash(userGroup); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateUserGroupV1Output {\n"); - sb.append(" userGroup: ").append(toIndentedString(userGroup)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("userGroup"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("userGroup"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("userGroup"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("userGroup"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateUserGroupV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateUserGroupV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateUserGroupV1Output is not found in the empty JSON string", CreateUserGroupV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateUserGroupV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateUserGroupV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateUserGroupV1Output is not found" + + " in the empty JSON string", + CreateUserGroupV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateUserGroupV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateUserGroupV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateUserGroupV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateUserGroupV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateUserGroupV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateUserGroupV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `userGroup` + UserGroupV1.validateJsonElement(jsonObj.get("userGroup")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateUserGroupV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateUserGroupV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateUserGroupV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateUserGroupV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateUserGroupV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateUserGroupV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateUserGroupV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateUserGroupV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateUserGroupV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateUserGroupV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateUserGroupV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateUserGroupV1Output + * @throws IOException if the JSON string is invalid with respect to CreateUserGroupV1Output + */ + public static CreateUserGroupV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateUserGroupV1Output.class); } - } - - /** - * Create an instance of CreateUserGroupV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateUserGroupV1Output - * @throws IOException if the JSON string is invalid with respect to CreateUserGroupV1Output - */ - public static CreateUserGroupV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateUserGroupV1Output.class); - } - - /** - * Convert an instance of CreateUserGroupV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateUserGroupV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateValidationInWarehouse200Response.java b/src/main/java/com/segment/publicapi/models/CreateValidationInWarehouse200Response.java index 2f5237eb..28fb2845 100644 --- a/src/main/java/com/segment/publicapi/models/CreateValidationInWarehouse200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateValidationInWarehouse200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateValidationInWarehouseV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateValidationInWarehouse200Response - */ - +/** CreateValidationInWarehouse200Response */ public class CreateValidationInWarehouse200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateValidationInWarehouseV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateValidationInWarehouse200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateValidationInWarehouseV1Output data; - public CreateValidationInWarehouse200Response data(CreateValidationInWarehouseV1Output data) { - - this.data = data; - return this; - } + public CreateValidationInWarehouse200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateValidationInWarehouse200Response data(CreateValidationInWarehouseV1Output data) { - public CreateValidationInWarehouseV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateValidationInWarehouseV1Output getData() { + return data; + } - public void setData(CreateValidationInWarehouseV1Output data) { - this.data = data; - } + public void setData(CreateValidationInWarehouseV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateValidationInWarehouse200Response createValidationInWarehouse200Response = + (CreateValidationInWarehouse200Response) o; + return Objects.equals(this.data, createValidationInWarehouse200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateValidationInWarehouse200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateValidationInWarehouse200Response createValidationInWarehouse200Response = (CreateValidationInWarehouse200Response) o; - return Objects.equals(this.data, createValidationInWarehouse200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateValidationInWarehouse200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateValidationInWarehouse200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateValidationInWarehouse200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateValidationInWarehouse200Response is not found in the empty JSON string", CreateValidationInWarehouse200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateValidationInWarehouse200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateValidationInWarehouse200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateValidationInWarehouse200Response" + + " is not found in the empty JSON string", + CreateValidationInWarehouse200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateValidationInWarehouse200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateValidationInWarehouse200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateValidationInWarehouse200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateValidationInWarehouse200Response` 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()) { + CreateValidationInWarehouseV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateValidationInWarehouse200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateValidationInWarehouse200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateValidationInWarehouse200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateValidationInWarehouse200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateValidationInWarehouse200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateValidationInWarehouse200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateValidationInWarehouse200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateValidationInWarehouse200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CreateValidationInWarehouse200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateValidationInWarehouse200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateValidationInWarehouse200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateValidationInWarehouse200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateValidationInWarehouse200Response + */ + public static CreateValidationInWarehouse200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateValidationInWarehouse200Response.class); } - } - - /** - * Create an instance of CreateValidationInWarehouse200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateValidationInWarehouse200Response - * @throws IOException if the JSON string is invalid with respect to CreateValidationInWarehouse200Response - */ - public static CreateValidationInWarehouse200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateValidationInWarehouse200Response.class); - } - - /** - * Convert an instance of CreateValidationInWarehouse200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateValidationInWarehouse200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateValidationInWarehouseV1Input.java b/src/main/java/com/segment/publicapi/models/CreateValidationInWarehouseV1Input.java index 9a9c276f..abdc9c87 100644 --- a/src/main/java/com/segment/publicapi/models/CreateValidationInWarehouseV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateValidationInWarehouseV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,240 +9,245 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Verifies a set of Warehouse credentials by attempting to connect to it. */ +public class CreateValidationInWarehouseV1Input { + public static final String SERIALIZED_NAME_METADATA_ID = "metadataId"; -/** - * Verifies a set of Warehouse credentials by attempting to connect to it. - */ -@ApiModel(description = "Verifies a set of Warehouse credentials by attempting to connect to it.") + @SerializedName(SERIALIZED_NAME_METADATA_ID) + private String metadataId; -public class CreateValidationInWarehouseV1Input { - public static final String SERIALIZED_NAME_METADATA_ID = "metadataId"; - @SerializedName(SERIALIZED_NAME_METADATA_ID) - private String metadataId; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; - - public CreateValidationInWarehouseV1Input() { - } - - public CreateValidationInWarehouseV1Input metadataId(String metadataId) { - - this.metadataId = metadataId; - return this; - } - - /** - * The id of the Warehouse metadata type. - * @return metadataId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Warehouse metadata type.") - - public String getMetadataId() { - return metadataId; - } - - - public void setMetadataId(String metadataId) { - this.metadataId = metadataId; - } - - - public CreateValidationInWarehouseV1Input settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The settings to check. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The settings to check.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input = (CreateValidationInWarehouseV1Input) o; - return Objects.equals(this.metadataId, createValidationInWarehouseV1Input.metadataId) && - Objects.equals(this.settings, createValidationInWarehouseV1Input.settings); - } - - @Override - public int hashCode() { - return Objects.hash(metadataId, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateValidationInWarehouseV1Input {\n"); - sb.append(" metadataId: ").append(toIndentedString(metadataId)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("metadataId"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("metadataId"); - openapiRequiredFields.add("settings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateValidationInWarehouseV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateValidationInWarehouseV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateValidationInWarehouseV1Input is not found in the empty JSON string", CreateValidationInWarehouseV1Input.openapiRequiredFields.toString())); - } - } + public static final String SERIALIZED_NAME_SETTINGS = "settings"; + + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; + + public CreateValidationInWarehouseV1Input() {} + + public CreateValidationInWarehouseV1Input metadataId(String metadataId) { + + this.metadataId = metadataId; + return this; + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateValidationInWarehouseV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateValidationInWarehouseV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + /** + * The id of the Warehouse metadata type. + * + * @return metadataId + */ + @javax.annotation.Nonnull + public String getMetadataId() { + return metadataId; + } + + public void setMetadataId(String metadataId) { + this.metadataId = metadataId; + } + + public CreateValidationInWarehouseV1Input settings(Map settings) { + + this.settings = settings; + return this; + } + + public CreateValidationInWarehouseV1Input putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); } - } + this.settings.put(key, settingsItem); + return this; + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateValidationInWarehouseV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + /** + * A key-value object that contains instance-specific Warehouse settings. + * + * @return settings + */ + @javax.annotation.Nonnull + public Map getSettings() { + return settings; + } + + public void setSettings(Map settings) { + this.settings = settings; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - } - if (!jsonObj.get("metadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `metadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metadataId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateValidationInWarehouseV1Input createValidationInWarehouseV1Input = + (CreateValidationInWarehouseV1Input) o; + return Objects.equals(this.metadataId, createValidationInWarehouseV1Input.metadataId) + && Objects.equals(this.settings, createValidationInWarehouseV1Input.settings); + } + @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateValidationInWarehouseV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateValidationInWarehouseV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateValidationInWarehouseV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateValidationInWarehouseV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateValidationInWarehouseV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of CreateValidationInWarehouseV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateValidationInWarehouseV1Input - * @throws IOException if the JSON string is invalid with respect to CreateValidationInWarehouseV1Input - */ - public static CreateValidationInWarehouseV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateValidationInWarehouseV1Input.class); - } - - /** - * Convert an instance of CreateValidationInWarehouseV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public int hashCode() { + return Objects.hash(metadataId, settings); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateValidationInWarehouseV1Input {\n"); + sb.append(" metadataId: ").append(toIndentedString(metadataId)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("metadataId"); + openapiFields.add("settings"); + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("metadataId"); + openapiRequiredFields.add("settings"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateValidationInWarehouseV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateValidationInWarehouseV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateValidationInWarehouseV1Input is" + + " not found in the empty JSON string", + CreateValidationInWarehouseV1Input.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateValidationInWarehouseV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateValidationInWarehouseV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateValidationInWarehouseV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("metadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `metadataId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("metadataId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateValidationInWarehouseV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateValidationInWarehouseV1Input' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateValidationInWarehouseV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateValidationInWarehouseV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateValidationInWarehouseV1Input read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateValidationInWarehouseV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateValidationInWarehouseV1Input + * @throws IOException if the JSON string is invalid with respect to + * CreateValidationInWarehouseV1Input + */ + public static CreateValidationInWarehouseV1Input fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateValidationInWarehouseV1Input.class); + } + + /** + * Convert an instance of CreateValidationInWarehouseV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateValidationInWarehouseV1Output.java b/src/main/java/com/segment/publicapi/models/CreateValidationInWarehouseV1Output.java index f7f9b6c1..4c5ba05e 100644 --- a/src/main/java/com/segment/publicapi/models/CreateValidationInWarehouseV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateValidationInWarehouseV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,255 +9,254 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Returns the status of a Warehouse connection settings after an attempt to connect to it. */ +public class CreateValidationInWarehouseV1Output { + /** Represents the status for the current connection settings. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + CONNECTED("CONNECTED"), -/** - * Returns the status of a Warehouse connection settings after an attempt to connect to it. - */ -@ApiModel(description = "Returns the status of a Warehouse connection settings after an attempt to connect to it.") + FAILED("FAILED"); -public class CreateValidationInWarehouseV1Output { - /** - * Represents the status for the current connection settings. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - CONNECTED("CONNECTED"), - - FAILED("FAILED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } + private String value; - public String getValue() { - return value; - } + StatusEnum(String value) { + this.value = value; + } - @Override - public String toString() { - return String.valueOf(value); - } + public String getValue() { + return value; + } - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; + @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 + "'"); } - } - 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 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_STATUS = "status"; - public CreateValidationInWarehouseV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public CreateValidationInWarehouseV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public CreateValidationInWarehouseV1Output() {} - /** - * Represents the status for the current connection settings. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Represents the status for the current connection settings.") + public CreateValidationInWarehouseV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * Represents the status for the current connection settings. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + CreateValidationInWarehouseV1Output createValidationInWarehouseV1Output = + (CreateValidationInWarehouseV1Output) o; + return Objects.equals(this.status, createValidationInWarehouseV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateValidationInWarehouseV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateValidationInWarehouseV1Output createValidationInWarehouseV1Output = (CreateValidationInWarehouseV1Output) o; - return Objects.equals(this.status, createValidationInWarehouseV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateValidationInWarehouseV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateValidationInWarehouseV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateValidationInWarehouseV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateValidationInWarehouseV1Output is not found in the empty JSON string", CreateValidationInWarehouseV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateValidationInWarehouseV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateValidationInWarehouseV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateValidationInWarehouseV1Output is" + + " not found in the empty JSON string", + CreateValidationInWarehouseV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateValidationInWarehouseV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateValidationInWarehouseV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateValidationInWarehouseV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateValidationInWarehouseV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateValidationInWarehouseV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateValidationInWarehouseV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!CreateValidationInWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateValidationInWarehouseV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateValidationInWarehouseV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateValidationInWarehouseV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateValidationInWarehouseV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateValidationInWarehouseV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateValidationInWarehouseV1Output - * @throws IOException if the JSON string is invalid with respect to CreateValidationInWarehouseV1Output - */ - public static CreateValidationInWarehouseV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateValidationInWarehouseV1Output.class); - } - - /** - * Convert an instance of CreateValidationInWarehouseV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateValidationInWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateValidationInWarehouseV1Output' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateValidationInWarehouseV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateValidationInWarehouseV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateValidationInWarehouseV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateValidationInWarehouseV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateValidationInWarehouseV1Output + * @throws IOException if the JSON string is invalid with respect to + * CreateValidationInWarehouseV1Output + */ + public static CreateValidationInWarehouseV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateValidationInWarehouseV1Output.class); + } + + /** + * Convert an instance of CreateValidationInWarehouseV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateWarehouse200Response.java b/src/main/java/com/segment/publicapi/models/CreateWarehouse200Response.java deleted file mode 100644 index ed5411ae..00000000 --- a/src/main/java/com/segment/publicapi/models/CreateWarehouse200Response.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateWarehouseV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * CreateWarehouse200Response - */ - -public class CreateWarehouse200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateWarehouseV1Output data; - - public CreateWarehouse200Response() { - } - - public CreateWarehouse200Response data(CreateWarehouseV1Output data) { - - this.data = data; - return this; - } - - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public CreateWarehouseV1Output getData() { - return data; - } - - - public void setData(CreateWarehouseV1Output data) { - this.data = data; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateWarehouse200Response createWarehouse200Response = (CreateWarehouse200Response) o; - return Objects.equals(this.data, createWarehouse200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateWarehouse200Response {\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateWarehouse200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateWarehouse200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWarehouse200Response is not found in the empty JSON string", CreateWarehouse200Response.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateWarehouse200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWarehouse200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateWarehouse200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateWarehouse200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateWarehouse200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateWarehouse200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateWarehouse200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of CreateWarehouse200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateWarehouse200Response - * @throws IOException if the JSON string is invalid with respect to CreateWarehouse200Response - */ - public static CreateWarehouse200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateWarehouse200Response.class); - } - - /** - * Convert an instance of CreateWarehouse200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/CreateWarehouse201Response.java b/src/main/java/com/segment/publicapi/models/CreateWarehouse201Response.java new file mode 100644 index 00000000..b25a925e --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateWarehouse201Response.java @@ -0,0 +1,194 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateWarehouse201Response */ +public class CreateWarehouse201Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateWarehouseV1Output data; + + public CreateWarehouse201Response() {} + + public CreateWarehouse201Response data(CreateWarehouseV1Output data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateWarehouseV1Output getData() { + return data; + } + + public void setData(CreateWarehouseV1Output data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWarehouse201Response createWarehouse201Response = (CreateWarehouse201Response) o; + return Objects.equals(this.data, createWarehouse201Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWarehouse201Response {\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 CreateWarehouse201Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWarehouse201Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateWarehouse201Response is not" + + " found in the empty JSON string", + CreateWarehouse201Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWarehouse201Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateWarehouse201Response` 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()) { + CreateWarehouseV1Output.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWarehouse201Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWarehouse201Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateWarehouse201Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWarehouse201Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWarehouse201Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWarehouse201Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWarehouse201Response + * @throws IOException if the JSON string is invalid with respect to CreateWarehouse201Response + */ + public static CreateWarehouse201Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWarehouse201Response.class); + } + + /** + * Convert an instance of CreateWarehouse201Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateWarehouseV1Input.java b/src/main/java/com/segment/publicapi/models/CreateWarehouseV1Input.java index 76107a6e..b8ee44b7 100644 --- a/src/main/java/com/segment/publicapi/models/CreateWarehouseV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateWarehouseV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,303 +9,332 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Create a new Warehouse based on a set of parameters. */ +public class CreateWarehouseV1Input { + public static final String SERIALIZED_NAME_METADATA_ID = "metadataId"; -/** - * Create a new Warehouse based on a set of parameters. - */ -@ApiModel(description = "Create a new Warehouse based on a set of parameters.") + @SerializedName(SERIALIZED_NAME_METADATA_ID) + private String metadataId; -public class CreateWarehouseV1Input { - public static final String SERIALIZED_NAME_METADATA_ID = "metadataId"; - @SerializedName(SERIALIZED_NAME_METADATA_ID) - private String metadataId; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public CreateWarehouseV1Input() { - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public CreateWarehouseV1Input metadataId(String metadataId) { - - this.metadataId = metadataId; - return this; - } + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - /** - * The Warehouse metadata to use. - * @return metadataId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Warehouse metadata to use.") + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; - public String getMetadataId() { - return metadataId; - } + public static final String SERIALIZED_NAME_DISCONNECT_ALL_SOURCES = "disconnectAllSources"; + @SerializedName(SERIALIZED_NAME_DISCONNECT_ALL_SOURCES) + private Boolean disconnectAllSources; - public void setMetadataId(String metadataId) { - this.metadataId = metadataId; - } + public CreateWarehouseV1Input() {} + public CreateWarehouseV1Input metadataId(String metadataId) { - public CreateWarehouseV1Input name(String name) { - - this.name = name; - return this; - } + this.metadataId = metadataId; + return this; + } - /** - * An optional human-readable name for this Warehouse. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An optional human-readable name for this Warehouse.") + /** + * The Warehouse metadata to use. + * + * @return metadataId + */ + @javax.annotation.Nonnull + public String getMetadataId() { + return metadataId; + } - public String getName() { - return name; - } + public void setMetadataId(String metadataId) { + this.metadataId = metadataId; + } + public CreateWarehouseV1Input name(String name) { - public void setName(String name) { - this.name = name; - } + this.name = name; + return this; + } + /** + * An optional human-readable name for this Warehouse. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - public CreateWarehouseV1Input enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public void setName(String name) { + this.name = name; + } - /** - * Enable to allow this Warehouse to receive data. Defaults to true. - * @return enabled - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow this Warehouse to receive data. Defaults to true.") + public CreateWarehouseV1Input enabled(Boolean enabled) { - public Boolean getEnabled() { - return enabled; - } + this.enabled = enabled; + return this; + } + /** + * Enable to allow this Warehouse to receive data. Defaults to true. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + public CreateWarehouseV1Input settings(Map settings) { - public CreateWarehouseV1Input settings(Map settings) { - - this.settings = settings; - return this; - } + this.settings = settings; + return this; + } - /** - * A key-value object that contains instance-specific settings for a Warehouse. Different kinds of Warehouses require different settings. The required and optional settings for a Warehouse are described in the `options` object of the associated Warehouse metadata. You can find the full list of Warehouse metadata and related settings information in the `/catalog/warehouses` endpoint. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A key-value object that contains instance-specific settings for a Warehouse. Different kinds of Warehouses require different settings. The required and optional settings for a Warehouse are described in the `options` object of the associated Warehouse metadata. You can find the full list of Warehouse metadata and related settings information in the `/catalog/warehouses` endpoint.") + public CreateWarehouseV1Input putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + + /** + * A key-value object that contains instance-specific Warehouse settings. + * + * @return settings + */ + @javax.annotation.Nonnull + public Map getSettings() { + return settings; + } - public Map getSettings() { - return settings; - } + public void setSettings(Map settings) { + this.settings = settings; + } + public CreateWarehouseV1Input disconnectAllSources(Boolean disconnectAllSources) { - public void setSettings(Map settings) { - this.settings = settings; - } + this.disconnectAllSources = disconnectAllSources; + return this; + } + /** + * Whether to disconnect all Sources from this Warehouse. + * + * @return disconnectAllSources + */ + @javax.annotation.Nullable + public Boolean getDisconnectAllSources() { + return disconnectAllSources; + } + public void setDisconnectAllSources(Boolean disconnectAllSources) { + this.disconnectAllSources = disconnectAllSources; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWarehouseV1Input createWarehouseV1Input = (CreateWarehouseV1Input) o; + return Objects.equals(this.metadataId, createWarehouseV1Input.metadataId) + && Objects.equals(this.name, createWarehouseV1Input.name) + && Objects.equals(this.enabled, createWarehouseV1Input.enabled) + && Objects.equals(this.settings, createWarehouseV1Input.settings) + && Objects.equals( + this.disconnectAllSources, createWarehouseV1Input.disconnectAllSources); } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public int hashCode() { + return Objects.hash(metadataId, name, enabled, settings, disconnectAllSources); } - CreateWarehouseV1Input createWarehouseV1Input = (CreateWarehouseV1Input) o; - return Objects.equals(this.metadataId, createWarehouseV1Input.metadataId) && - Objects.equals(this.name, createWarehouseV1Input.name) && - Objects.equals(this.enabled, createWarehouseV1Input.enabled) && - Objects.equals(this.settings, createWarehouseV1Input.settings); - } - - @Override - public int hashCode() { - return Objects.hash(metadataId, name, enabled, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateWarehouseV1Input {\n"); - sb.append(" metadataId: ").append(toIndentedString(metadataId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWarehouseV1Input {\n"); + sb.append(" metadataId: ").append(toIndentedString(metadataId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" disconnectAllSources: ") + .append(toIndentedString(disconnectAllSources)) + .append("\n"); + sb.append("}"); + return sb.toString(); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("metadataId"); - openapiFields.add("name"); - openapiFields.add("enabled"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("metadataId"); - openapiRequiredFields.add("settings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateWarehouseV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateWarehouseV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWarehouseV1Input is not found in the empty JSON string", CreateWarehouseV1Input.openapiRequiredFields.toString())); + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - } + return o.toString().replace("\n", "\n "); + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateWarehouseV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWarehouseV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("metadataId"); + openapiFields.add("name"); + openapiFields.add("enabled"); + openapiFields.add("settings"); + openapiFields.add("disconnectAllSources"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("metadataId"); + openapiRequiredFields.add("settings"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateWarehouseV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWarehouseV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateWarehouseV1Input is not found in" + + " the empty JSON string", + CreateWarehouseV1Input.openapiRequiredFields.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateWarehouseV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWarehouseV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateWarehouseV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateWarehouseV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("metadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `metadataId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("metadataId").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("metadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `metadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metadataId").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 (!CreateWarehouseV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateWarehouseV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateWarehouseV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateWarehouseV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateWarehouseV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateWarehouseV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateWarehouseV1Input - * @throws IOException if the JSON string is invalid with respect to CreateWarehouseV1Input - */ - public static CreateWarehouseV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateWarehouseV1Input.class); - } - - /** - * Convert an instance of CreateWarehouseV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWarehouseV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWarehouseV1Input' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateWarehouseV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWarehouseV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWarehouseV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWarehouseV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWarehouseV1Input + * @throws IOException if the JSON string is invalid with respect to CreateWarehouseV1Input + */ + public static CreateWarehouseV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWarehouseV1Input.class); + } + + /** + * Convert an instance of CreateWarehouseV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateWarehouseV1Output.java b/src/main/java/com/segment/publicapi/models/CreateWarehouseV1Output.java index a5d4da62..fc2eeba1 100644 --- a/src/main/java/com/segment/publicapi/models/CreateWarehouseV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateWarehouseV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Warehouse1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the newly created Warehouse. - */ -@ApiModel(description = "Returns the newly created Warehouse.") - +/** Returns the newly created Warehouse. */ public class CreateWarehouseV1Output { - public static final String SERIALIZED_NAME_WAREHOUSE = "warehouse"; - @SerializedName(SERIALIZED_NAME_WAREHOUSE) - private Warehouse1 warehouse; + public static final String SERIALIZED_NAME_WAREHOUSE = "warehouse"; - public CreateWarehouseV1Output() { - } + @SerializedName(SERIALIZED_NAME_WAREHOUSE) + private WarehouseV1 warehouse; - public CreateWarehouseV1Output warehouse(Warehouse1 warehouse) { - - this.warehouse = warehouse; - return this; - } + public CreateWarehouseV1Output() {} - /** - * Get warehouse - * @return warehouse - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public CreateWarehouseV1Output warehouse(WarehouseV1 warehouse) { - public Warehouse1 getWarehouse() { - return warehouse; - } + this.warehouse = warehouse; + return this; + } + /** + * Get warehouse + * + * @return warehouse + */ + @javax.annotation.Nonnull + public WarehouseV1 getWarehouse() { + return warehouse; + } - public void setWarehouse(Warehouse1 warehouse) { - this.warehouse = warehouse; - } + public void setWarehouse(WarehouseV1 warehouse) { + this.warehouse = warehouse; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWarehouseV1Output createWarehouseV1Output = (CreateWarehouseV1Output) o; + return Objects.equals(this.warehouse, createWarehouseV1Output.warehouse); + } + @Override + public int hashCode() { + return Objects.hash(warehouse); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWarehouseV1Output {\n"); + sb.append(" warehouse: ").append(toIndentedString(warehouse)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateWarehouseV1Output createWarehouseV1Output = (CreateWarehouseV1Output) o; - return Objects.equals(this.warehouse, createWarehouseV1Output.warehouse); - } - - @Override - public int hashCode() { - return Objects.hash(warehouse); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateWarehouseV1Output {\n"); - sb.append(" warehouse: ").append(toIndentedString(warehouse)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("warehouse"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("warehouse"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("warehouse"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("warehouse"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateWarehouseV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateWarehouseV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWarehouseV1Output is not found in the empty JSON string", CreateWarehouseV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateWarehouseV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWarehouseV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateWarehouseV1Output is not found" + + " in the empty JSON string", + CreateWarehouseV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateWarehouseV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWarehouseV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWarehouseV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateWarehouseV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateWarehouseV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateWarehouseV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `warehouse` + WarehouseV1.validateJsonElement(jsonObj.get("warehouse")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateWarehouseV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateWarehouseV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateWarehouseV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateWarehouseV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWarehouseV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateWarehouseV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWarehouseV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWarehouseV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWarehouseV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWarehouseV1Output + * @throws IOException if the JSON string is invalid with respect to CreateWarehouseV1Output + */ + public static CreateWarehouseV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWarehouseV1Output.class); } - } - - /** - * Create an instance of CreateWarehouseV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateWarehouseV1Output - * @throws IOException if the JSON string is invalid with respect to CreateWarehouseV1Output - */ - public static CreateWarehouseV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateWarehouseV1Output.class); - } - - /** - * Convert an instance of CreateWarehouseV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateWarehouseV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateWorkspaceRegulation200Response.java b/src/main/java/com/segment/publicapi/models/CreateWorkspaceRegulation200Response.java index 19377d4a..a0d1faa2 100644 --- a/src/main/java/com/segment/publicapi/models/CreateWorkspaceRegulation200Response.java +++ b/src/main/java/com/segment/publicapi/models/CreateWorkspaceRegulation200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.CreateWorkspaceRegulationV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * CreateWorkspaceRegulation200Response - */ - +/** CreateWorkspaceRegulation200Response */ public class CreateWorkspaceRegulation200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private CreateWorkspaceRegulationV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public CreateWorkspaceRegulation200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private CreateWorkspaceRegulationV1Output data; - public CreateWorkspaceRegulation200Response data(CreateWorkspaceRegulationV1Output data) { - - this.data = data; - return this; - } + public CreateWorkspaceRegulation200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public CreateWorkspaceRegulation200Response data(CreateWorkspaceRegulationV1Output data) { - public CreateWorkspaceRegulationV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateWorkspaceRegulationV1Output getData() { + return data; + } - public void setData(CreateWorkspaceRegulationV1Output data) { - this.data = data; - } + public void setData(CreateWorkspaceRegulationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWorkspaceRegulation200Response createWorkspaceRegulation200Response = + (CreateWorkspaceRegulation200Response) o; + return Objects.equals(this.data, createWorkspaceRegulation200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWorkspaceRegulation200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateWorkspaceRegulation200Response createWorkspaceRegulation200Response = (CreateWorkspaceRegulation200Response) o; - return Objects.equals(this.data, createWorkspaceRegulation200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateWorkspaceRegulation200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateWorkspaceRegulation200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateWorkspaceRegulation200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWorkspaceRegulation200Response is not found in the empty JSON string", CreateWorkspaceRegulation200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateWorkspaceRegulation200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWorkspaceRegulation200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateWorkspaceRegulation200Response" + + " is not found in the empty JSON string", + CreateWorkspaceRegulation200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateWorkspaceRegulation200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWorkspaceRegulation200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWorkspaceRegulation200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateWorkspaceRegulation200Response` 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()) { + CreateWorkspaceRegulationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateWorkspaceRegulation200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateWorkspaceRegulation200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateWorkspaceRegulation200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateWorkspaceRegulation200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateWorkspaceRegulation200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWorkspaceRegulation200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWorkspaceRegulation200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateWorkspaceRegulation200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, CreateWorkspaceRegulation200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWorkspaceRegulation200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWorkspaceRegulation200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWorkspaceRegulation200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateWorkspaceRegulation200Response + */ + public static CreateWorkspaceRegulation200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWorkspaceRegulation200Response.class); } - } - - /** - * Create an instance of CreateWorkspaceRegulation200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateWorkspaceRegulation200Response - * @throws IOException if the JSON string is invalid with respect to CreateWorkspaceRegulation200Response - */ - public static CreateWorkspaceRegulation200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateWorkspaceRegulation200Response.class); - } - - /** - * Convert an instance of CreateWorkspaceRegulation200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of CreateWorkspaceRegulation200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateWorkspaceRegulationV1Input.java b/src/main/java/com/segment/publicapi/models/CreateWorkspaceRegulationV1Input.java index 5256527e..0f9ebe36 100644 --- a/src/main/java/com/segment/publicapi/models/CreateWorkspaceRegulationV1Input.java +++ b/src/main/java/com/segment/publicapi/models/CreateWorkspaceRegulationV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,388 +9,394 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** The input to create a Workspace regulation. */ +public class CreateWorkspaceRegulationV1Input { + /** The regulation type to create. */ + @JsonAdapter(RegulationTypeEnum.Adapter.class) + public enum RegulationTypeEnum { + DELETE_INTERNAL("DELETE_INTERNAL"), -/** - * The input to create a Workspace regulation. - */ -@ApiModel(description = "The input to create a Workspace regulation.") + DELETE_ONLY("DELETE_ONLY"), -public class CreateWorkspaceRegulationV1Input { - /** - * The regulation type to create. - */ - @JsonAdapter(RegulationTypeEnum.Adapter.class) - public enum RegulationTypeEnum { - BULK_DELETE_ONLY("BULK_DELETE_ONLY"), - - DELETE_INTERNAL("DELETE_INTERNAL"), - - DELETE_ONLY("DELETE_ONLY"), - - SUPPRESS_ONLY("SUPPRESS_ONLY"), - - SUPPRESS_WITH_DELETE("SUPPRESS_WITH_DELETE"), - - UNSUPPRESS("UNSUPPRESS"); - - private String value; - - RegulationTypeEnum(String value) { - this.value = value; - } + SUPPRESS_ONLY("SUPPRESS_ONLY"), - public String getValue() { - return value; - } + SUPPRESS_WITH_DELETE("SUPPRESS_WITH_DELETE"), - @Override - public String toString() { - return String.valueOf(value); - } + SUPPRESS_WITH_DELETE_INTERNAL("SUPPRESS_WITH_DELETE_INTERNAL"), - public static RegulationTypeEnum fromValue(String value) { - for (RegulationTypeEnum b : RegulationTypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } + UNSUPPRESS("UNSUPPRESS"); - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final RegulationTypeEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RegulationTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return RegulationTypeEnum.fromValue(value); - } - } - } + private String value; - public static final String SERIALIZED_NAME_REGULATION_TYPE = "regulationType"; - @SerializedName(SERIALIZED_NAME_REGULATION_TYPE) - private RegulationTypeEnum regulationType; + RegulationTypeEnum(String value) { + this.value = value; + } - /** - * The subject type. Use `objectId` for Cloud Source regulations. - */ - @JsonAdapter(SubjectTypeEnum.Adapter.class) - public enum SubjectTypeEnum { - OBJECT_ID("OBJECT_ID"), - - USER_ID("USER_ID"); + public String getValue() { + return value; + } - private String value; + @Override + public String toString() { + return String.valueOf(value); + } - SubjectTypeEnum(String value) { - this.value = value; - } + public static RegulationTypeEnum fromValue(String value) { + for (RegulationTypeEnum b : RegulationTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public String getValue() { - return value; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RegulationTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RegulationTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RegulationTypeEnum.fromValue(value); + } + } } - @Override - public String toString() { - return String.valueOf(value); - } + public static final String SERIALIZED_NAME_REGULATION_TYPE = "regulationType"; + + @SerializedName(SERIALIZED_NAME_REGULATION_TYPE) + private RegulationTypeEnum regulationType; + + /** The subject type. Use `objectId` for Cloud Source regulations. */ + @JsonAdapter(SubjectTypeEnum.Adapter.class) + public enum SubjectTypeEnum { + OBJECT_ID("OBJECT_ID"), + + USER_ID("USER_ID"); + + private String value; - public static SubjectTypeEnum fromValue(String value) { - for (SubjectTypeEnum b : SubjectTypeEnum.values()) { - if (b.value.equals(value)) { - return b; + SubjectTypeEnum(String value) { + this.value = value; } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final SubjectTypeEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public SubjectTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return SubjectTypeEnum.fromValue(value); - } - } - } + public String getValue() { + return value; + } - public static final String SERIALIZED_NAME_SUBJECT_TYPE = "subjectType"; - @SerializedName(SERIALIZED_NAME_SUBJECT_TYPE) - private SubjectTypeEnum subjectType; + @Override + public String toString() { + return String.valueOf(value); + } - public static final String SERIALIZED_NAME_SUBJECT_IDS = "subjectIds"; - @SerializedName(SERIALIZED_NAME_SUBJECT_IDS) - private List subjectIds = new ArrayList<>(); + public static SubjectTypeEnum fromValue(String value) { + for (SubjectTypeEnum b : SubjectTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public CreateWorkspaceRegulationV1Input() { - } + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SubjectTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SubjectTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SubjectTypeEnum.fromValue(value); + } + } + } - public CreateWorkspaceRegulationV1Input regulationType(RegulationTypeEnum regulationType) { - - this.regulationType = regulationType; - return this; - } + public static final String SERIALIZED_NAME_SUBJECT_TYPE = "subjectType"; - /** - * The regulation type to create. - * @return regulationType - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The regulation type to create.") + @SerializedName(SERIALIZED_NAME_SUBJECT_TYPE) + private SubjectTypeEnum subjectType; - public RegulationTypeEnum getRegulationType() { - return regulationType; - } + public static final String SERIALIZED_NAME_SUBJECT_IDS = "subjectIds"; + @SerializedName(SERIALIZED_NAME_SUBJECT_IDS) + private List subjectIds = new ArrayList<>(); - public void setRegulationType(RegulationTypeEnum regulationType) { - this.regulationType = regulationType; - } + public CreateWorkspaceRegulationV1Input() {} + public CreateWorkspaceRegulationV1Input regulationType(RegulationTypeEnum regulationType) { - public CreateWorkspaceRegulationV1Input subjectType(SubjectTypeEnum subjectType) { - - this.subjectType = subjectType; - return this; - } + this.regulationType = regulationType; + return this; + } - /** - * The subject type. Use `objectId` for Cloud Source regulations. - * @return subjectType - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The subject type. Use `objectId` for Cloud Source regulations.") + /** + * The regulation type to create. + * + * @return regulationType + */ + @javax.annotation.Nonnull + public RegulationTypeEnum getRegulationType() { + return regulationType; + } - public SubjectTypeEnum getSubjectType() { - return subjectType; - } + public void setRegulationType(RegulationTypeEnum regulationType) { + this.regulationType = regulationType; + } + public CreateWorkspaceRegulationV1Input subjectType(SubjectTypeEnum subjectType) { - public void setSubjectType(SubjectTypeEnum subjectType) { - this.subjectType = subjectType; - } + this.subjectType = subjectType; + return this; + } + /** + * The subject type. Use `objectId` for Cloud Source regulations. + * + * @return subjectType + */ + @javax.annotation.Nonnull + public SubjectTypeEnum getSubjectType() { + return subjectType; + } - public CreateWorkspaceRegulationV1Input subjectIds(List subjectIds) { - - this.subjectIds = subjectIds; - return this; - } + public void setSubjectType(SubjectTypeEnum subjectType) { + this.subjectType = subjectType; + } - public CreateWorkspaceRegulationV1Input addSubjectIdsItem(String subjectIdsItem) { - this.subjectIds.add(subjectIdsItem); - return this; - } + public CreateWorkspaceRegulationV1Input subjectIds(List subjectIds) { - /** - * The user or object ids of the subjects to regulate. Config API note: equal to `parent` but allows an array. - * @return subjectIds - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The user or object ids of the subjects to regulate. Config API note: equal to `parent` but allows an array.") + this.subjectIds = subjectIds; + return this; + } - public List getSubjectIds() { - return subjectIds; - } + public CreateWorkspaceRegulationV1Input addSubjectIdsItem(String subjectIdsItem) { + if (this.subjectIds == null) { + this.subjectIds = new ArrayList<>(); + } + this.subjectIds.add(subjectIdsItem); + return this; + } + /** + * The list of `userId` or `objectId` values of the subjects to regulate. + * Config API note: equal to `parent` but allows an array. + * + * @return subjectIds + */ + @javax.annotation.Nonnull + public List getSubjectIds() { + return subjectIds; + } - public void setSubjectIds(List subjectIds) { - this.subjectIds = subjectIds; - } + public void setSubjectIds(List subjectIds) { + this.subjectIds = subjectIds; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input = + (CreateWorkspaceRegulationV1Input) o; + return Objects.equals(this.regulationType, createWorkspaceRegulationV1Input.regulationType) + && Objects.equals(this.subjectType, createWorkspaceRegulationV1Input.subjectType) + && Objects.equals(this.subjectIds, createWorkspaceRegulationV1Input.subjectIds); + } + @Override + public int hashCode() { + return Objects.hash(regulationType, subjectType, subjectIds); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWorkspaceRegulationV1Input {\n"); + sb.append(" regulationType: ").append(toIndentedString(regulationType)).append("\n"); + sb.append(" subjectType: ").append(toIndentedString(subjectType)).append("\n"); + sb.append(" subjectIds: ").append(toIndentedString(subjectIds)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateWorkspaceRegulationV1Input createWorkspaceRegulationV1Input = (CreateWorkspaceRegulationV1Input) o; - return Objects.equals(this.regulationType, createWorkspaceRegulationV1Input.regulationType) && - Objects.equals(this.subjectType, createWorkspaceRegulationV1Input.subjectType) && - Objects.equals(this.subjectIds, createWorkspaceRegulationV1Input.subjectIds); - } - - @Override - public int hashCode() { - return Objects.hash(regulationType, subjectType, subjectIds); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateWorkspaceRegulationV1Input {\n"); - sb.append(" regulationType: ").append(toIndentedString(regulationType)).append("\n"); - sb.append(" subjectType: ").append(toIndentedString(subjectType)).append("\n"); - sb.append(" subjectIds: ").append(toIndentedString(subjectIds)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("regulationType"); + openapiFields.add("subjectType"); + openapiFields.add("subjectIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("regulationType"); + openapiRequiredFields.add("subjectType"); + openapiRequiredFields.add("subjectIds"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("regulationType"); - openapiFields.add("subjectType"); - openapiFields.add("subjectIds"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("regulationType"); - openapiRequiredFields.add("subjectType"); - openapiRequiredFields.add("subjectIds"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateWorkspaceRegulationV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateWorkspaceRegulationV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWorkspaceRegulationV1Input is not found in the empty JSON string", CreateWorkspaceRegulationV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateWorkspaceRegulationV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWorkspaceRegulationV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateWorkspaceRegulationV1Input is" + + " not found in the empty JSON string", + CreateWorkspaceRegulationV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateWorkspaceRegulationV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWorkspaceRegulationV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWorkspaceRegulationV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateWorkspaceRegulationV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateWorkspaceRegulationV1Input.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateWorkspaceRegulationV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("regulationType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `regulationType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("regulationType").toString())); + } + if (!jsonObj.get("subjectType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `subjectType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("subjectType").toString())); + } + // ensure the required json array is present + if (jsonObj.get("subjectIds") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("subjectIds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `subjectIds` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("subjectIds").toString())); } - } - if (!jsonObj.get("regulationType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `regulationType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("regulationType").toString())); - } - if (!jsonObj.get("subjectType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `subjectType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subjectType").toString())); - } - // ensure the required json array is present - if (jsonObj.get("subjectIds") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("subjectIds").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `subjectIds` to be an array in the JSON string but got `%s`", jsonObj.get("subjectIds").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateWorkspaceRegulationV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateWorkspaceRegulationV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateWorkspaceRegulationV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateWorkspaceRegulationV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateWorkspaceRegulationV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateWorkspaceRegulationV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateWorkspaceRegulationV1Input - * @throws IOException if the JSON string is invalid with respect to CreateWorkspaceRegulationV1Input - */ - public static CreateWorkspaceRegulationV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateWorkspaceRegulationV1Input.class); - } - - /** - * Convert an instance of CreateWorkspaceRegulationV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWorkspaceRegulationV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWorkspaceRegulationV1Input' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateWorkspaceRegulationV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWorkspaceRegulationV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWorkspaceRegulationV1Input read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWorkspaceRegulationV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWorkspaceRegulationV1Input + * @throws IOException if the JSON string is invalid with respect to + * CreateWorkspaceRegulationV1Input + */ + public static CreateWorkspaceRegulationV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWorkspaceRegulationV1Input.class); + } + + /** + * Convert an instance of CreateWorkspaceRegulationV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateWorkspaceRegulationV1Output.java b/src/main/java/com/segment/publicapi/models/CreateWorkspaceRegulationV1Output.java index 4abc1ce7..43d66795 100644 --- a/src/main/java/com/segment/publicapi/models/CreateWorkspaceRegulationV1Output.java +++ b/src/main/java/com/segment/publicapi/models/CreateWorkspaceRegulationV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,208 +9,206 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The output of a create Workspace regulation call. - */ -@ApiModel(description = "The output of a create Workspace regulation call.") - +/** The output of a create Workspace regulation call. */ public class CreateWorkspaceRegulationV1Output { - public static final String SERIALIZED_NAME_REGULATE_ID = "regulateId"; - @SerializedName(SERIALIZED_NAME_REGULATE_ID) - private String regulateId; + public static final String SERIALIZED_NAME_REGULATE_ID = "regulateId"; - public CreateWorkspaceRegulationV1Output() { - } + @SerializedName(SERIALIZED_NAME_REGULATE_ID) + private String regulateId; - public CreateWorkspaceRegulationV1Output regulateId(String regulateId) { - - this.regulateId = regulateId; - return this; - } + public CreateWorkspaceRegulationV1Output() {} - /** - * The id of the created regulation. - * @return regulateId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the created regulation.") + public CreateWorkspaceRegulationV1Output regulateId(String regulateId) { - public String getRegulateId() { - return regulateId; - } + this.regulateId = regulateId; + return this; + } + /** + * The id of the created regulation. + * + * @return regulateId + */ + @javax.annotation.Nonnull + public String getRegulateId() { + return regulateId; + } - public void setRegulateId(String regulateId) { - this.regulateId = regulateId; - } + public void setRegulateId(String regulateId) { + this.regulateId = regulateId; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWorkspaceRegulationV1Output createWorkspaceRegulationV1Output = + (CreateWorkspaceRegulationV1Output) o; + return Objects.equals(this.regulateId, createWorkspaceRegulationV1Output.regulateId); + } + @Override + public int hashCode() { + return Objects.hash(regulateId); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWorkspaceRegulationV1Output {\n"); + sb.append(" regulateId: ").append(toIndentedString(regulateId)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - CreateWorkspaceRegulationV1Output createWorkspaceRegulationV1Output = (CreateWorkspaceRegulationV1Output) o; - return Objects.equals(this.regulateId, createWorkspaceRegulationV1Output.regulateId); - } - - @Override - public int hashCode() { - return Objects.hash(regulateId); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateWorkspaceRegulationV1Output {\n"); - sb.append(" regulateId: ").append(toIndentedString(regulateId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("regulateId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("regulateId"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("regulateId"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("regulateId"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to CreateWorkspaceRegulationV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!CreateWorkspaceRegulationV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWorkspaceRegulationV1Output is not found in the empty JSON string", CreateWorkspaceRegulationV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateWorkspaceRegulationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWorkspaceRegulationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateWorkspaceRegulationV1Output is" + + " not found in the empty JSON string", + CreateWorkspaceRegulationV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!CreateWorkspaceRegulationV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWorkspaceRegulationV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWorkspaceRegulationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateWorkspaceRegulationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateWorkspaceRegulationV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateWorkspaceRegulationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("regulateId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `regulateId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("regulateId").toString())); } - } - if (!jsonObj.get("regulateId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `regulateId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("regulateId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateWorkspaceRegulationV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateWorkspaceRegulationV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateWorkspaceRegulationV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateWorkspaceRegulationV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateWorkspaceRegulationV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of CreateWorkspaceRegulationV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateWorkspaceRegulationV1Output - * @throws IOException if the JSON string is invalid with respect to CreateWorkspaceRegulationV1Output - */ - public static CreateWorkspaceRegulationV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateWorkspaceRegulationV1Output.class); - } - - /** - * Convert an instance of CreateWorkspaceRegulationV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWorkspaceRegulationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWorkspaceRegulationV1Output' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateWorkspaceRegulationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWorkspaceRegulationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWorkspaceRegulationV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWorkspaceRegulationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWorkspaceRegulationV1Output + * @throws IOException if the JSON string is invalid with respect to + * CreateWorkspaceRegulationV1Output + */ + public static CreateWorkspaceRegulationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWorkspaceRegulationV1Output.class); + } + + /** + * Convert an instance of CreateWorkspaceRegulationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateWriteKeyForSource200Response.java b/src/main/java/com/segment/publicapi/models/CreateWriteKeyForSource200Response.java new file mode 100644 index 00000000..fab72fab --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateWriteKeyForSource200Response.java @@ -0,0 +1,201 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** CreateWriteKeyForSource200Response */ +public class CreateWriteKeyForSource200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private CreateWriteKeyForSourceAlphaOutput data; + + public CreateWriteKeyForSource200Response() {} + + public CreateWriteKeyForSource200Response data(CreateWriteKeyForSourceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public CreateWriteKeyForSourceAlphaOutput getData() { + return data; + } + + public void setData(CreateWriteKeyForSourceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWriteKeyForSource200Response createWriteKeyForSource200Response = + (CreateWriteKeyForSource200Response) o; + return Objects.equals(this.data, createWriteKeyForSource200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWriteKeyForSource200Response {\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 + * CreateWriteKeyForSource200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWriteKeyForSource200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateWriteKeyForSource200Response is" + + " not found in the empty JSON string", + CreateWriteKeyForSource200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWriteKeyForSource200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateWriteKeyForSource200Response` 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()) { + CreateWriteKeyForSourceAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWriteKeyForSource200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWriteKeyForSource200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateWriteKeyForSource200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWriteKeyForSource200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWriteKeyForSource200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWriteKeyForSource200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWriteKeyForSource200Response + * @throws IOException if the JSON string is invalid with respect to + * CreateWriteKeyForSource200Response + */ + public static CreateWriteKeyForSource200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWriteKeyForSource200Response.class); + } + + /** + * Convert an instance of CreateWriteKeyForSource200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/CreateWriteKeyForSourceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/CreateWriteKeyForSourceAlphaOutput.java new file mode 100644 index 00000000..901f94dd --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/CreateWriteKeyForSourceAlphaOutput.java @@ -0,0 +1,210 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Returns the updated Source. */ +public class CreateWriteKeyForSourceAlphaOutput { + public static final String SERIALIZED_NAME_SOURCE = "source"; + + @SerializedName(SERIALIZED_NAME_SOURCE) + private SourceAlpha source; + + public CreateWriteKeyForSourceAlphaOutput() {} + + public CreateWriteKeyForSourceAlphaOutput source(SourceAlpha source) { + + this.source = source; + return this; + } + + /** + * Get source + * + * @return source + */ + @javax.annotation.Nonnull + public SourceAlpha getSource() { + return source; + } + + public void setSource(SourceAlpha source) { + this.source = source; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWriteKeyForSourceAlphaOutput createWriteKeyForSourceAlphaOutput = + (CreateWriteKeyForSourceAlphaOutput) o; + return Objects.equals(this.source, createWriteKeyForSourceAlphaOutput.source); + } + + @Override + public int hashCode() { + return Objects.hash(source); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWriteKeyForSourceAlphaOutput {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * CreateWriteKeyForSourceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWriteKeyForSourceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in CreateWriteKeyForSourceAlphaOutput is" + + " not found in the empty JSON string", + CreateWriteKeyForSourceAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWriteKeyForSourceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `CreateWriteKeyForSourceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateWriteKeyForSourceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `source` + SourceAlpha.validateJsonElement(jsonObj.get("source")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWriteKeyForSourceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWriteKeyForSourceAlphaOutput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateWriteKeyForSourceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWriteKeyForSourceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWriteKeyForSourceAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWriteKeyForSourceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWriteKeyForSourceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * CreateWriteKeyForSourceAlphaOutput + */ + public static CreateWriteKeyForSourceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWriteKeyForSourceAlphaOutput.class); + } + + /** + * Convert an instance of CreateWriteKeyForSourceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DbtModelSyncTrigger.java b/src/main/java/com/segment/publicapi/models/DbtModelSyncTrigger.java new file mode 100644 index 00000000..78d96c4b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DbtModelSyncTrigger.java @@ -0,0 +1,279 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Defines the dbt Model Sync Trigger. */ +public class DbtModelSyncTrigger { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; + + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public DbtModelSyncTrigger() {} + + public DbtModelSyncTrigger id(String id) { + + this.id = id; + return this; + } + + /** + * The id of the dbt model sync. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public DbtModelSyncTrigger sourceId(String sourceId) { + + this.sourceId = sourceId; + return this; + } + + /** + * The Source id that was triggered. + * + * @return sourceId + */ + @javax.annotation.Nullable + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public DbtModelSyncTrigger status(String status) { + + this.status = status; + return this; + } + + /** + * The status of the trigger. + * + * @return status + */ + @javax.annotation.Nonnull + 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; + } + DbtModelSyncTrigger dbtModelSyncTrigger = (DbtModelSyncTrigger) o; + return Objects.equals(this.id, dbtModelSyncTrigger.id) + && Objects.equals(this.sourceId, dbtModelSyncTrigger.sourceId) + && Objects.equals(this.status, dbtModelSyncTrigger.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, sourceId, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DbtModelSyncTrigger {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).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("id"); + openapiFields.add("sourceId"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + 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 DbtModelSyncTrigger + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DbtModelSyncTrigger.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DbtModelSyncTrigger is not found in" + + " the empty JSON string", + DbtModelSyncTrigger.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DbtModelSyncTrigger.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DbtModelSyncTrigger` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DbtModelSyncTrigger.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId") != null && !jsonObj.get("sourceId").isJsonNull()) + && !jsonObj.get("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DbtModelSyncTrigger.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DbtModelSyncTrigger' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DbtModelSyncTrigger.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DbtModelSyncTrigger value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DbtModelSyncTrigger read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DbtModelSyncTrigger given an JSON string + * + * @param jsonString JSON string + * @return An instance of DbtModelSyncTrigger + * @throws IOException if the JSON string is invalid with respect to DbtModelSyncTrigger + */ + public static DbtModelSyncTrigger fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DbtModelSyncTrigger.class); + } + + /** + * Convert an instance of DbtModelSyncTrigger to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteActivationAlphaOutput.java b/src/main/java/com/segment/publicapi/models/DeleteActivationAlphaOutput.java new file mode 100644 index 00000000..403303bf --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeleteActivationAlphaOutput.java @@ -0,0 +1,209 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output for deleting an activation. */ +public class DeleteActivationAlphaOutput { + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public DeleteActivationAlphaOutput() {} + + public DeleteActivationAlphaOutput status(String status) { + + this.status = status; + return this; + } + + /** + * Deletion status. + * + * @return status + */ + @javax.annotation.Nonnull + 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; + } + DeleteActivationAlphaOutput deleteActivationAlphaOutput = (DeleteActivationAlphaOutput) o; + return Objects.equals(this.status, deleteActivationAlphaOutput.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteActivationAlphaOutput {\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(); + 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 + * DeleteActivationAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteActivationAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteActivationAlphaOutput is not" + + " found in the empty JSON string", + DeleteActivationAlphaOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteActivationAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteActivationAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteActivationAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!DeleteActivationAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteActivationAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteActivationAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteActivationAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteActivationAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteActivationAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteActivationAlphaOutput + * @throws IOException if the JSON string is invalid with respect to DeleteActivationAlphaOutput + */ + public static DeleteActivationAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteActivationAlphaOutput.class); + } + + /** + * Convert an instance of DeleteActivationAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteDestination200Response.java b/src/main/java/com/segment/publicapi/models/DeleteDestination200Response.java index dea6ea0a..6e29dfa7 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteDestination200Response.java +++ b/src/main/java/com/segment/publicapi/models/DeleteDestination200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,190 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteDestinationV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteDestination200Response - */ - +/** DeleteDestination200Response */ public class DeleteDestination200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteDestinationV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteDestination200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteDestinationV1Output data; - public DeleteDestination200Response data(DeleteDestinationV1Output data) { - - this.data = data; - return this; - } + public DeleteDestination200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteDestination200Response data(DeleteDestinationV1Output data) { - public DeleteDestinationV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteDestinationV1Output getData() { + return data; + } - public void setData(DeleteDestinationV1Output data) { - this.data = data; - } + public void setData(DeleteDestinationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteDestination200Response deleteDestination200Response = + (DeleteDestination200Response) o; + return Objects.equals(this.data, deleteDestination200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteDestination200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteDestination200Response deleteDestination200Response = (DeleteDestination200Response) o; - return Objects.equals(this.data, deleteDestination200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteDestination200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteDestination200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteDestination200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteDestination200Response is not found in the empty JSON string", DeleteDestination200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DeleteDestination200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteDestination200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteDestination200Response is not" + + " found in the empty JSON string", + DeleteDestination200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteDestination200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteDestination200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteDestination200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteDestination200Response` 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()) { + DeleteDestinationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteDestination200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteDestination200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteDestination200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteDestination200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteDestination200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteDestination200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteDestination200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeleteDestination200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteDestination200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteDestination200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteDestination200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteDestination200Response + * @throws IOException if the JSON string is invalid with respect to + * DeleteDestination200Response + */ + public static DeleteDestination200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteDestination200Response.class); } - } - - /** - * Create an instance of DeleteDestination200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteDestination200Response - * @throws IOException if the JSON string is invalid with respect to DeleteDestination200Response - */ - public static DeleteDestination200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteDestination200Response.class); - } - - /** - * Convert an instance of DeleteDestination200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteDestination200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteDestinationV1Output.java b/src/main/java/com/segment/publicapi/models/DeleteDestinationV1Output.java index e94147b2..e3e975e1 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteDestinationV1Output.java +++ b/src/main/java/com/segment/publicapi/models/DeleteDestinationV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,245 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the status of a Destination deletion. - */ -@ApiModel(description = "Returns the status of a Destination deletion.") - +/** Returns the status of a Destination deletion. */ public class DeleteDestinationV1Output { - /** - * The status of the Warehouse deletion operation. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The status of the Warehouse deletion operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteDestinationV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteDestinationV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteDestinationV1Output() {} - /** - * The status of the Warehouse deletion operation. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The status of the Warehouse deletion operation.") + public DeleteDestinationV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The status of the Warehouse deletion operation. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteDestinationV1Output deleteDestinationV1Output = (DeleteDestinationV1Output) o; + return Objects.equals(this.status, deleteDestinationV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteDestinationV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteDestinationV1Output deleteDestinationV1Output = (DeleteDestinationV1Output) o; - return Objects.equals(this.status, deleteDestinationV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteDestinationV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteDestinationV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteDestinationV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteDestinationV1Output is not found in the empty JSON string", DeleteDestinationV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteDestinationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteDestinationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteDestinationV1Output is not found" + + " in the empty JSON string", + DeleteDestinationV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteDestinationV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteDestinationV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteDestinationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteDestinationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteDestinationV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteDestinationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteDestinationV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteDestinationV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteDestinationV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteDestinationV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteDestinationV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteDestinationV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteDestinationV1Output - * @throws IOException if the JSON string is invalid with respect to DeleteDestinationV1Output - */ - public static DeleteDestinationV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteDestinationV1Output.class); - } - - /** - * Convert an instance of DeleteDestinationV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteDestinationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteDestinationV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteDestinationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteDestinationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteDestinationV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteDestinationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteDestinationV1Output + * @throws IOException if the JSON string is invalid with respect to DeleteDestinationV1Output + */ + public static DeleteDestinationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteDestinationV1Output.class); + } + + /** + * Convert an instance of DeleteDestinationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteFilterById200Response.java b/src/main/java/com/segment/publicapi/models/DeleteFilterById200Response.java new file mode 100644 index 00000000..31fc8c71 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeleteFilterById200Response.java @@ -0,0 +1,195 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** DeleteFilterById200Response */ +public class DeleteFilterById200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteFilterByIdOutput data; + + public DeleteFilterById200Response() {} + + public DeleteFilterById200Response data(DeleteFilterByIdOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteFilterByIdOutput getData() { + return data; + } + + public void setData(DeleteFilterByIdOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteFilterById200Response deleteFilterById200Response = (DeleteFilterById200Response) o; + return Objects.equals(this.data, deleteFilterById200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteFilterById200Response {\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 + * DeleteFilterById200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteFilterById200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteFilterById200Response is not" + + " found in the empty JSON string", + DeleteFilterById200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteFilterById200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteFilterById200Response` 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()) { + DeleteFilterByIdOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteFilterById200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteFilterById200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteFilterById200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteFilterById200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteFilterById200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteFilterById200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteFilterById200Response + * @throws IOException if the JSON string is invalid with respect to DeleteFilterById200Response + */ + public static DeleteFilterById200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteFilterById200Response.class); + } + + /** + * Convert an instance of DeleteFilterById200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteFilterByIdOutput.java b/src/main/java/com/segment/publicapi/models/DeleteFilterByIdOutput.java new file mode 100644 index 00000000..ce3c15ed --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeleteFilterByIdOutput.java @@ -0,0 +1,200 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output for DeleteFilterById. */ +public class DeleteFilterByIdOutput { + public static final String SERIALIZED_NAME_DELETED = "deleted"; + + @SerializedName(SERIALIZED_NAME_DELETED) + private Boolean deleted; + + public DeleteFilterByIdOutput() {} + + public DeleteFilterByIdOutput deleted(Boolean deleted) { + + this.deleted = deleted; + return this; + } + + /** + * Filter deleted by filter id. + * + * @return deleted + */ + @javax.annotation.Nonnull + public Boolean getDeleted() { + return deleted; + } + + public void setDeleted(Boolean deleted) { + this.deleted = deleted; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteFilterByIdOutput deleteFilterByIdOutput = (DeleteFilterByIdOutput) o; + return Objects.equals(this.deleted, deleteFilterByIdOutput.deleted); + } + + @Override + public int hashCode() { + return Objects.hash(deleted); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteFilterByIdOutput {\n"); + sb.append(" deleted: ").append(toIndentedString(deleted)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("deleted"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("deleted"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteFilterByIdOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteFilterByIdOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteFilterByIdOutput is not found in" + + " the empty JSON string", + DeleteFilterByIdOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteFilterByIdOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteFilterByIdOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteFilterByIdOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!DeleteFilterByIdOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteFilterByIdOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteFilterByIdOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteFilterByIdOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteFilterByIdOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteFilterByIdOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteFilterByIdOutput + * @throws IOException if the JSON string is invalid with respect to DeleteFilterByIdOutput + */ + public static DeleteFilterByIdOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteFilterByIdOutput.class); + } + + /** + * Convert an instance of DeleteFilterByIdOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteFunction200Response.java b/src/main/java/com/segment/publicapi/models/DeleteFunction200Response.java index cf9f0057..06aab391 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteFunction200Response.java +++ b/src/main/java/com/segment/publicapi/models/DeleteFunction200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteFunctionV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteFunction200Response - */ - +/** DeleteFunction200Response */ public class DeleteFunction200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteFunctionV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteFunction200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteFunctionV1Output data; - public DeleteFunction200Response data(DeleteFunctionV1Output data) { - - this.data = data; - return this; - } + public DeleteFunction200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteFunction200Response data(DeleteFunctionV1Output data) { - public DeleteFunctionV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteFunctionV1Output getData() { + return data; + } - public void setData(DeleteFunctionV1Output data) { - this.data = data; - } + public void setData(DeleteFunctionV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteFunction200Response deleteFunction200Response = (DeleteFunction200Response) o; + return Objects.equals(this.data, deleteFunction200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteFunction200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteFunction200Response deleteFunction200Response = (DeleteFunction200Response) o; - return Objects.equals(this.data, deleteFunction200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteFunction200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteFunction200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteFunction200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteFunction200Response is not found in the empty JSON string", DeleteFunction200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteFunction200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteFunction200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteFunction200Response is not found" + + " in the empty JSON string", + DeleteFunction200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteFunction200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteFunction200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteFunction200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteFunction200Response` 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()) { + DeleteFunctionV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteFunction200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteFunction200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteFunction200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteFunction200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteFunction200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteFunction200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteFunction200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteFunction200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteFunction200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteFunction200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteFunction200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteFunction200Response + * @throws IOException if the JSON string is invalid with respect to DeleteFunction200Response + */ + public static DeleteFunction200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteFunction200Response.class); } - } - - /** - * Create an instance of DeleteFunction200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteFunction200Response - * @throws IOException if the JSON string is invalid with respect to DeleteFunction200Response - */ - public static DeleteFunction200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteFunction200Response.class); - } - - /** - * Convert an instance of DeleteFunction200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteFunction200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteFunctionV1Output.java b/src/main/java/com/segment/publicapi/models/DeleteFunctionV1Output.java index db510a17..6e585176 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteFunctionV1Output.java +++ b/src/main/java/com/segment/publicapi/models/DeleteFunctionV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,244 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Delete a single Function. - */ -@ApiModel(description = "Delete a single Function.") - +/** Delete a single Function. */ public class DeleteFunctionV1Output { - /** - * The status of the operation. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The status of the operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteFunctionV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteFunctionV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteFunctionV1Output() {} - /** - * The status of the operation. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The status of the operation.") + public DeleteFunctionV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The status of the operation. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteFunctionV1Output deleteFunctionV1Output = (DeleteFunctionV1Output) o; + return Objects.equals(this.status, deleteFunctionV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteFunctionV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteFunctionV1Output deleteFunctionV1Output = (DeleteFunctionV1Output) o; - return Objects.equals(this.status, deleteFunctionV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteFunctionV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteFunctionV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteFunctionV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteFunctionV1Output is not found in the empty JSON string", DeleteFunctionV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteFunctionV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteFunctionV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteFunctionV1Output is not found in" + + " the empty JSON string", + DeleteFunctionV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteFunctionV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteFunctionV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteFunctionV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteFunctionV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteFunctionV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteFunctionV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteFunctionV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteFunctionV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteFunctionV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteFunctionV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteFunctionV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteFunctionV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteFunctionV1Output - * @throws IOException if the JSON string is invalid with respect to DeleteFunctionV1Output - */ - public static DeleteFunctionV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteFunctionV1Output.class); - } - - /** - * Convert an instance of DeleteFunctionV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteFunctionV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteFunctionV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteFunctionV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteFunctionV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteFunctionV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteFunctionV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteFunctionV1Output + * @throws IOException if the JSON string is invalid with respect to DeleteFunctionV1Output + */ + public static DeleteFunctionV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteFunctionV1Output.class); + } + + /** + * Convert an instance of DeleteFunctionV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteInsertFunctionInstance200Response.java b/src/main/java/com/segment/publicapi/models/DeleteInsertFunctionInstance200Response.java new file mode 100644 index 00000000..7455a99d --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeleteInsertFunctionInstance200Response.java @@ -0,0 +1,206 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** DeleteInsertFunctionInstance200Response */ +public class DeleteInsertFunctionInstance200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteInsertFunctionInstanceAlphaOutput data; + + public DeleteInsertFunctionInstance200Response() {} + + public DeleteInsertFunctionInstance200Response data( + DeleteInsertFunctionInstanceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteInsertFunctionInstanceAlphaOutput getData() { + return data; + } + + public void setData(DeleteInsertFunctionInstanceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteInsertFunctionInstance200Response deleteInsertFunctionInstance200Response = + (DeleteInsertFunctionInstance200Response) o; + return Objects.equals(this.data, deleteInsertFunctionInstance200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteInsertFunctionInstance200Response {\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 + * DeleteInsertFunctionInstance200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteInsertFunctionInstance200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " DeleteInsertFunctionInstance200Response is not found in the" + + " empty JSON string", + DeleteInsertFunctionInstance200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteInsertFunctionInstance200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteInsertFunctionInstance200Response` 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()) { + DeleteInsertFunctionInstanceAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteInsertFunctionInstance200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'DeleteInsertFunctionInstance200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeleteInsertFunctionInstance200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, DeleteInsertFunctionInstance200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteInsertFunctionInstance200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteInsertFunctionInstance200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteInsertFunctionInstance200Response + * @throws IOException if the JSON string is invalid with respect to + * DeleteInsertFunctionInstance200Response + */ + public static DeleteInsertFunctionInstance200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteInsertFunctionInstance200Response.class); + } + + /** + * Convert an instance of DeleteInsertFunctionInstance200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteInsertFunctionInstanceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/DeleteInsertFunctionInstanceAlphaOutput.java new file mode 100644 index 00000000..ba280f19 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeleteInsertFunctionInstanceAlphaOutput.java @@ -0,0 +1,264 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Delete an insert Function instance. */ +public class DeleteInsertFunctionInstanceAlphaOutput { + /** The status of the operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); + + 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 DeleteInsertFunctionInstanceAlphaOutput() {} + + public DeleteInsertFunctionInstanceAlphaOutput status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The status of the operation. + * + * @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; + } + DeleteInsertFunctionInstanceAlphaOutput deleteInsertFunctionInstanceAlphaOutput = + (DeleteInsertFunctionInstanceAlphaOutput) o; + return Objects.equals(this.status, deleteInsertFunctionInstanceAlphaOutput.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteInsertFunctionInstanceAlphaOutput {\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(); + 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 + * DeleteInsertFunctionInstanceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteInsertFunctionInstanceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " DeleteInsertFunctionInstanceAlphaOutput is not found in the" + + " empty JSON string", + DeleteInsertFunctionInstanceAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteInsertFunctionInstanceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteInsertFunctionInstanceAlphaOutput` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteInsertFunctionInstanceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!DeleteInsertFunctionInstanceAlphaOutput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'DeleteInsertFunctionInstanceAlphaOutput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeleteInsertFunctionInstanceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, DeleteInsertFunctionInstanceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteInsertFunctionInstanceAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteInsertFunctionInstanceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteInsertFunctionInstanceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * DeleteInsertFunctionInstanceAlphaOutput + */ + public static DeleteInsertFunctionInstanceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteInsertFunctionInstanceAlphaOutput.class); + } + + /** + * Convert an instance of DeleteInsertFunctionInstanceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteInvites200Response.java b/src/main/java/com/segment/publicapi/models/DeleteInvites200Response.java index 7fe21153..e2d48616 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteInvites200Response.java +++ b/src/main/java/com/segment/publicapi/models/DeleteInvites200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteInvitesV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteInvites200Response - */ - +/** DeleteInvites200Response */ public class DeleteInvites200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteInvitesV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteInvites200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteInvitesV1Output data; - public DeleteInvites200Response data(DeleteInvitesV1Output data) { - - this.data = data; - return this; - } + public DeleteInvites200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteInvites200Response data(DeleteInvitesV1Output data) { - public DeleteInvitesV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteInvitesV1Output getData() { + return data; + } - public void setData(DeleteInvitesV1Output data) { - this.data = data; - } + public void setData(DeleteInvitesV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteInvites200Response deleteInvites200Response = (DeleteInvites200Response) o; + return Objects.equals(this.data, deleteInvites200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteInvites200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteInvites200Response deleteInvites200Response = (DeleteInvites200Response) o; - return Objects.equals(this.data, deleteInvites200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteInvites200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteInvites200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteInvites200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteInvites200Response is not found in the empty JSON string", DeleteInvites200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteInvites200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteInvites200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteInvites200Response is not found" + + " in the empty JSON string", + DeleteInvites200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteInvites200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteInvites200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteInvites200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteInvites200Response` 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()) { + DeleteInvitesV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteInvites200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteInvites200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteInvites200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteInvites200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteInvites200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteInvites200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteInvites200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteInvites200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteInvites200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteInvites200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteInvites200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteInvites200Response + * @throws IOException if the JSON string is invalid with respect to DeleteInvites200Response + */ + public static DeleteInvites200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteInvites200Response.class); } - } - - /** - * Create an instance of DeleteInvites200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteInvites200Response - * @throws IOException if the JSON string is invalid with respect to DeleteInvites200Response - */ - public static DeleteInvites200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteInvites200Response.class); - } - - /** - * Convert an instance of DeleteInvites200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteInvites200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteInvitesV1Output.java b/src/main/java/com/segment/publicapi/models/DeleteInvitesV1Output.java index 09c0e161..628ddd76 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteInvitesV1Output.java +++ b/src/main/java/com/segment/publicapi/models/DeleteInvitesV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,244 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the status of the removal operation. - */ -@ApiModel(description = "Returns the status of the removal operation.") - +/** Returns the status of the removal operation. */ public class DeleteInvitesV1Output { - /** - * The status of the invite deletion operation. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The status of the invite deletion operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteInvitesV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteInvitesV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteInvitesV1Output() {} - /** - * The status of the invite deletion operation. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The status of the invite deletion operation.") + public DeleteInvitesV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The status of the invite deletion operation. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteInvitesV1Output deleteInvitesV1Output = (DeleteInvitesV1Output) o; + return Objects.equals(this.status, deleteInvitesV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteInvitesV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteInvitesV1Output deleteInvitesV1Output = (DeleteInvitesV1Output) o; - return Objects.equals(this.status, deleteInvitesV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteInvitesV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteInvitesV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteInvitesV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteInvitesV1Output is not found in the empty JSON string", DeleteInvitesV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteInvitesV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteInvitesV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteInvitesV1Output is not found in" + + " the empty JSON string", + DeleteInvitesV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteInvitesV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteInvitesV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteInvitesV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteInvitesV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteInvitesV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteInvitesV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteInvitesV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteInvitesV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteInvitesV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteInvitesV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteInvitesV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteInvitesV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteInvitesV1Output - * @throws IOException if the JSON string is invalid with respect to DeleteInvitesV1Output - */ - public static DeleteInvitesV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteInvitesV1Output.class); - } - - /** - * Convert an instance of DeleteInvitesV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteInvitesV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteInvitesV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteInvitesV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteInvitesV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteInvitesV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteInvitesV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteInvitesV1Output + * @throws IOException if the JSON string is invalid with respect to DeleteInvitesV1Output + */ + public static DeleteInvitesV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteInvitesV1Output.class); + } + + /** + * Convert an instance of DeleteInvitesV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteLabel200Response.java b/src/main/java/com/segment/publicapi/models/DeleteLabel200Response.java index c79b2320..795ac931 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteLabel200Response.java +++ b/src/main/java/com/segment/publicapi/models/DeleteLabel200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,185 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteLabelAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteLabel200Response - */ - +/** DeleteLabel200Response */ public class DeleteLabel200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteLabelAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteLabel200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteLabelV1Output data; - public DeleteLabel200Response data(DeleteLabelAlphaOutput data) { - - this.data = data; - return this; - } + public DeleteLabel200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteLabel200Response data(DeleteLabelV1Output data) { - public DeleteLabelAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteLabelV1Output getData() { + return data; + } - public void setData(DeleteLabelAlphaOutput data) { - this.data = data; - } + public void setData(DeleteLabelV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteLabel200Response deleteLabel200Response = (DeleteLabel200Response) o; + return Objects.equals(this.data, deleteLabel200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteLabel200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteLabel200Response deleteLabel200Response = (DeleteLabel200Response) o; - return Objects.equals(this.data, deleteLabel200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteLabel200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteLabel200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteLabel200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteLabel200Response is not found in the empty JSON string", DeleteLabel200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteLabel200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteLabel200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteLabel200Response is not found in" + + " the empty JSON string", + DeleteLabel200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteLabel200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteLabel200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteLabel200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteLabel200Response` 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()) { + DeleteLabelV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteLabel200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteLabel200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteLabel200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteLabel200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteLabel200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteLabel200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteLabel200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteLabel200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteLabel200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteLabel200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteLabel200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteLabel200Response + * @throws IOException if the JSON string is invalid with respect to DeleteLabel200Response + */ + public static DeleteLabel200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteLabel200Response.class); } - } - - /** - * Create an instance of DeleteLabel200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteLabel200Response - * @throws IOException if the JSON string is invalid with respect to DeleteLabel200Response - */ - public static DeleteLabel200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteLabel200Response.class); - } - - /** - * Convert an instance of DeleteLabel200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteLabel200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteLabel200Response1.java b/src/main/java/com/segment/publicapi/models/DeleteLabel200Response1.java index a708c89c..d62b34e1 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteLabel200Response1.java +++ b/src/main/java/com/segment/publicapi/models/DeleteLabel200Response1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteLabelV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteLabel200Response1 - */ - +/** DeleteLabel200Response1 */ public class DeleteLabel200Response1 { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteLabelV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteLabel200Response1() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteLabelAlphaOutput data; - public DeleteLabel200Response1 data(DeleteLabelV1Output data) { - - this.data = data; - return this; - } + public DeleteLabel200Response1() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteLabel200Response1 data(DeleteLabelAlphaOutput data) { - public DeleteLabelV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteLabelAlphaOutput getData() { + return data; + } - public void setData(DeleteLabelV1Output data) { - this.data = data; - } + public void setData(DeleteLabelAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteLabel200Response1 deleteLabel200Response1 = (DeleteLabel200Response1) o; + return Objects.equals(this.data, deleteLabel200Response1.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteLabel200Response1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteLabel200Response1 deleteLabel200Response1 = (DeleteLabel200Response1) o; - return Objects.equals(this.data, deleteLabel200Response1.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteLabel200Response1 {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteLabel200Response1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteLabel200Response1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteLabel200Response1 is not found in the empty JSON string", DeleteLabel200Response1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteLabel200Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteLabel200Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteLabel200Response1 is not found" + + " in the empty JSON string", + DeleteLabel200Response1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteLabel200Response1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteLabel200Response1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteLabel200Response1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteLabel200Response1` 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()) { + DeleteLabelAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteLabel200Response1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteLabel200Response1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteLabel200Response1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteLabel200Response1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteLabel200Response1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteLabel200Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteLabel200Response1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteLabel200Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteLabel200Response1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteLabel200Response1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteLabel200Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteLabel200Response1 + * @throws IOException if the JSON string is invalid with respect to DeleteLabel200Response1 + */ + public static DeleteLabel200Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteLabel200Response1.class); } - } - - /** - * Create an instance of DeleteLabel200Response1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteLabel200Response1 - * @throws IOException if the JSON string is invalid with respect to DeleteLabel200Response1 - */ - public static DeleteLabel200Response1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteLabel200Response1.class); - } - - /** - * Convert an instance of DeleteLabel200Response1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteLabel200Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteLabelAlphaOutput.java b/src/main/java/com/segment/publicapi/models/DeleteLabelAlphaOutput.java index 01fed1a1..68c165ed 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteLabelAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/DeleteLabelAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,244 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the status of a label deletion. - */ -@ApiModel(description = "Returns the status of a label deletion.") - +/** Returns the status of a label deletion. */ public class DeleteLabelAlphaOutput { - /** - * The status of the label deletion operation. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The status of the label deletion operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteLabelAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteLabelAlphaOutput status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteLabelAlphaOutput() {} - /** - * The status of the label deletion operation. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The status of the label deletion operation.") + public DeleteLabelAlphaOutput status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The status of the label deletion operation. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteLabelAlphaOutput deleteLabelAlphaOutput = (DeleteLabelAlphaOutput) o; + return Objects.equals(this.status, deleteLabelAlphaOutput.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteLabelAlphaOutput {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteLabelAlphaOutput deleteLabelAlphaOutput = (DeleteLabelAlphaOutput) o; - return Objects.equals(this.status, deleteLabelAlphaOutput.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteLabelAlphaOutput {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteLabelAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteLabelAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteLabelAlphaOutput is not found in the empty JSON string", DeleteLabelAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteLabelAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteLabelAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteLabelAlphaOutput is not found in" + + " the empty JSON string", + DeleteLabelAlphaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteLabelAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteLabelAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteLabelAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteLabelAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteLabelAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteLabelAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteLabelAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteLabelAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteLabelAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteLabelAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteLabelAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteLabelAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteLabelAlphaOutput - * @throws IOException if the JSON string is invalid with respect to DeleteLabelAlphaOutput - */ - public static DeleteLabelAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteLabelAlphaOutput.class); - } - - /** - * Convert an instance of DeleteLabelAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteLabelAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteLabelAlphaOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteLabelAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteLabelAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteLabelAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteLabelAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteLabelAlphaOutput + * @throws IOException if the JSON string is invalid with respect to DeleteLabelAlphaOutput + */ + public static DeleteLabelAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteLabelAlphaOutput.class); + } + + /** + * Convert an instance of DeleteLabelAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteLabelV1Output.java b/src/main/java/com/segment/publicapi/models/DeleteLabelV1Output.java index dc65d9ad..bdc1d1db 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteLabelV1Output.java +++ b/src/main/java/com/segment/publicapi/models/DeleteLabelV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,244 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the status of a label deletion. - */ -@ApiModel(description = "Returns the status of a label deletion.") - +/** Returns the status of a label deletion. */ public class DeleteLabelV1Output { - /** - * The status of the label deletion operation. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The status of the label deletion operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteLabelV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteLabelV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteLabelV1Output() {} - /** - * The status of the label deletion operation. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The status of the label deletion operation.") + public DeleteLabelV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The status of the label deletion operation. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteLabelV1Output deleteLabelV1Output = (DeleteLabelV1Output) o; + return Objects.equals(this.status, deleteLabelV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteLabelV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteLabelV1Output deleteLabelV1Output = (DeleteLabelV1Output) o; - return Objects.equals(this.status, deleteLabelV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteLabelV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteLabelV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteLabelV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteLabelV1Output is not found in the empty JSON string", DeleteLabelV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteLabelV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteLabelV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteLabelV1Output is not found in" + + " the empty JSON string", + DeleteLabelV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteLabelV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteLabelV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteLabelV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteLabelV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteLabelV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteLabelV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteLabelV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteLabelV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteLabelV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteLabelV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteLabelV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteLabelV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteLabelV1Output - * @throws IOException if the JSON string is invalid with respect to DeleteLabelV1Output - */ - public static DeleteLabelV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteLabelV1Output.class); - } - - /** - * Convert an instance of DeleteLabelV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteLabelV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteLabelV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteLabelV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteLabelV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteLabelV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteLabelV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteLabelV1Output + * @throws IOException if the JSON string is invalid with respect to DeleteLabelV1Output + */ + public static DeleteLabelV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteLabelV1Output.class); + } + + /** + * Convert an instance of DeleteLabelV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteRegulation200Response.java b/src/main/java/com/segment/publicapi/models/DeleteRegulation200Response.java index 05fb14c1..7d940dc9 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteRegulation200Response.java +++ b/src/main/java/com/segment/publicapi/models/DeleteRegulation200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,187 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteRegulationV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteRegulation200Response - */ - +/** DeleteRegulation200Response */ public class DeleteRegulation200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteRegulationV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteRegulation200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteRegulationV1Output data; - public DeleteRegulation200Response data(DeleteRegulationV1Output data) { - - this.data = data; - return this; - } + public DeleteRegulation200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteRegulation200Response data(DeleteRegulationV1Output data) { - public DeleteRegulationV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteRegulationV1Output getData() { + return data; + } - public void setData(DeleteRegulationV1Output data) { - this.data = data; - } + public void setData(DeleteRegulationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteRegulation200Response deleteRegulation200Response = (DeleteRegulation200Response) o; + return Objects.equals(this.data, deleteRegulation200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteRegulation200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteRegulation200Response deleteRegulation200Response = (DeleteRegulation200Response) o; - return Objects.equals(this.data, deleteRegulation200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteRegulation200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteRegulation200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteRegulation200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteRegulation200Response is not found in the empty JSON string", DeleteRegulation200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DeleteRegulation200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteRegulation200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteRegulation200Response is not" + + " found in the empty JSON string", + DeleteRegulation200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteRegulation200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteRegulation200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteRegulation200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteRegulation200Response` 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()) { + DeleteRegulationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteRegulation200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteRegulation200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteRegulation200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteRegulation200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteRegulation200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteRegulation200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteRegulation200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteRegulation200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteRegulation200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteRegulation200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteRegulation200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteRegulation200Response + * @throws IOException if the JSON string is invalid with respect to DeleteRegulation200Response + */ + public static DeleteRegulation200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteRegulation200Response.class); } - } - - /** - * Create an instance of DeleteRegulation200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteRegulation200Response - * @throws IOException if the JSON string is invalid with respect to DeleteRegulation200Response - */ - public static DeleteRegulation200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteRegulation200Response.class); - } - - /** - * Convert an instance of DeleteRegulation200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteRegulation200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteRegulationV1Output.java b/src/main/java/com/segment/publicapi/models/DeleteRegulationV1Output.java index ae77dac6..8c2b4538 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteRegulationV1Output.java +++ b/src/main/java/com/segment/publicapi/models/DeleteRegulationV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,245 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The output of the delete regulation call. - */ -@ApiModel(description = "The output of the delete regulation call.") - +/** The output of the delete regulation call. */ public class DeleteRegulationV1Output { - /** - * The status of the deletion call. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The status of the deletion call. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteRegulationV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteRegulationV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteRegulationV1Output() {} - /** - * The status of the deletion call. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The status of the deletion call.") + public DeleteRegulationV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The status of the deletion call. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteRegulationV1Output deleteRegulationV1Output = (DeleteRegulationV1Output) o; + return Objects.equals(this.status, deleteRegulationV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteRegulationV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteRegulationV1Output deleteRegulationV1Output = (DeleteRegulationV1Output) o; - return Objects.equals(this.status, deleteRegulationV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteRegulationV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteRegulationV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteRegulationV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteRegulationV1Output is not found in the empty JSON string", DeleteRegulationV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteRegulationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteRegulationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteRegulationV1Output is not found" + + " in the empty JSON string", + DeleteRegulationV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteRegulationV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteRegulationV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteRegulationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteRegulationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteRegulationV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteRegulationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteRegulationV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteRegulationV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteRegulationV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteRegulationV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteRegulationV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteRegulationV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteRegulationV1Output - * @throws IOException if the JSON string is invalid with respect to DeleteRegulationV1Output - */ - public static DeleteRegulationV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteRegulationV1Output.class); - } - - /** - * Convert an instance of DeleteRegulationV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteRegulationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteRegulationV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteRegulationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteRegulationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteRegulationV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteRegulationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteRegulationV1Output + * @throws IOException if the JSON string is invalid with respect to DeleteRegulationV1Output + */ + public static DeleteRegulationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteRegulationV1Output.class); + } + + /** + * Convert an instance of DeleteRegulationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteReverseEtlModel200Response.java b/src/main/java/com/segment/publicapi/models/DeleteReverseEtlModel200Response.java new file mode 100644 index 00000000..2def1a17 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeleteReverseEtlModel200Response.java @@ -0,0 +1,199 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** DeleteReverseEtlModel200Response */ +public class DeleteReverseEtlModel200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteReverseEtlModelOutput data; + + public DeleteReverseEtlModel200Response() {} + + public DeleteReverseEtlModel200Response data(DeleteReverseEtlModelOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteReverseEtlModelOutput getData() { + return data; + } + + public void setData(DeleteReverseEtlModelOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteReverseEtlModel200Response deleteReverseEtlModel200Response = + (DeleteReverseEtlModel200Response) o; + return Objects.equals(this.data, deleteReverseEtlModel200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteReverseEtlModel200Response {\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 + * DeleteReverseEtlModel200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteReverseEtlModel200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteReverseEtlModel200Response is" + + " not found in the empty JSON string", + DeleteReverseEtlModel200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteReverseEtlModel200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteReverseEtlModel200Response` 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()) { + DeleteReverseEtlModelOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteReverseEtlModel200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteReverseEtlModel200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeleteReverseEtlModel200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteReverseEtlModel200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteReverseEtlModel200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteReverseEtlModel200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteReverseEtlModel200Response + * @throws IOException if the JSON string is invalid with respect to + * DeleteReverseEtlModel200Response + */ + public static DeleteReverseEtlModel200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteReverseEtlModel200Response.class); + } + + /** + * Convert an instance of DeleteReverseEtlModel200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteReverseEtlModelOutput.java b/src/main/java/com/segment/publicapi/models/DeleteReverseEtlModelOutput.java new file mode 100644 index 00000000..02495490 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeleteReverseEtlModelOutput.java @@ -0,0 +1,254 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Defines the result of getting a Model. */ +public class DeleteReverseEtlModelOutput { + /** The result of the deletion. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); + + 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 DeleteReverseEtlModelOutput() {} + + public DeleteReverseEtlModelOutput status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The result of the deletion. + * + * @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; + } + DeleteReverseEtlModelOutput deleteReverseEtlModelOutput = (DeleteReverseEtlModelOutput) o; + return Objects.equals(this.status, deleteReverseEtlModelOutput.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteReverseEtlModelOutput {\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(); + 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 + * DeleteReverseEtlModelOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteReverseEtlModelOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteReverseEtlModelOutput is not" + + " found in the empty JSON string", + DeleteReverseEtlModelOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteReverseEtlModelOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteReverseEtlModelOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteReverseEtlModelOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!DeleteReverseEtlModelOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteReverseEtlModelOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteReverseEtlModelOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteReverseEtlModelOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteReverseEtlModelOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteReverseEtlModelOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteReverseEtlModelOutput + * @throws IOException if the JSON string is invalid with respect to DeleteReverseEtlModelOutput + */ + public static DeleteReverseEtlModelOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteReverseEtlModelOutput.class); + } + + /** + * Convert an instance of DeleteReverseEtlModelOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteSource200Response.java b/src/main/java/com/segment/publicapi/models/DeleteSource200Response.java index 657359f9..82b91195 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteSource200Response.java +++ b/src/main/java/com/segment/publicapi/models/DeleteSource200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteSourceAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteSource200Response - */ - +/** DeleteSource200Response */ public class DeleteSource200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteSourceAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteSource200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteSourceV1Output data; - public DeleteSource200Response data(DeleteSourceAlphaOutput data) { - - this.data = data; - return this; - } + public DeleteSource200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteSource200Response data(DeleteSourceV1Output data) { - public DeleteSourceAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteSourceV1Output getData() { + return data; + } - public void setData(DeleteSourceAlphaOutput data) { - this.data = data; - } + public void setData(DeleteSourceV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteSource200Response deleteSource200Response = (DeleteSource200Response) o; + return Objects.equals(this.data, deleteSource200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteSource200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteSource200Response deleteSource200Response = (DeleteSource200Response) o; - return Objects.equals(this.data, deleteSource200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteSource200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteSource200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteSource200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteSource200Response is not found in the empty JSON string", DeleteSource200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteSource200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteSource200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteSource200Response is not found" + + " in the empty JSON string", + DeleteSource200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteSource200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteSource200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteSource200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteSource200Response` 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()) { + DeleteSourceV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteSource200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteSource200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteSource200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteSource200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteSource200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteSource200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteSource200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteSource200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteSource200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteSource200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteSource200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteSource200Response + * @throws IOException if the JSON string is invalid with respect to DeleteSource200Response + */ + public static DeleteSource200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteSource200Response.class); } - } - - /** - * Create an instance of DeleteSource200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteSource200Response - * @throws IOException if the JSON string is invalid with respect to DeleteSource200Response - */ - public static DeleteSource200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteSource200Response.class); - } - - /** - * Convert an instance of DeleteSource200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteSource200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteSource200Response1.java b/src/main/java/com/segment/publicapi/models/DeleteSource200Response1.java index f3130083..dfdfb32b 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteSource200Response1.java +++ b/src/main/java/com/segment/publicapi/models/DeleteSource200Response1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteSourceV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteSource200Response1 - */ - +/** DeleteSource200Response1 */ public class DeleteSource200Response1 { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteSourceV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteSource200Response1() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteSourceAlphaOutput data; - public DeleteSource200Response1 data(DeleteSourceV1Output data) { - - this.data = data; - return this; - } + public DeleteSource200Response1() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteSource200Response1 data(DeleteSourceAlphaOutput data) { - public DeleteSourceV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteSourceAlphaOutput getData() { + return data; + } - public void setData(DeleteSourceV1Output data) { - this.data = data; - } + public void setData(DeleteSourceAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteSource200Response1 deleteSource200Response1 = (DeleteSource200Response1) o; + return Objects.equals(this.data, deleteSource200Response1.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteSource200Response1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteSource200Response1 deleteSource200Response1 = (DeleteSource200Response1) o; - return Objects.equals(this.data, deleteSource200Response1.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteSource200Response1 {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteSource200Response1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteSource200Response1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteSource200Response1 is not found in the empty JSON string", DeleteSource200Response1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteSource200Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteSource200Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteSource200Response1 is not found" + + " in the empty JSON string", + DeleteSource200Response1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteSource200Response1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteSource200Response1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteSource200Response1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteSource200Response1` 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()) { + DeleteSourceAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteSource200Response1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteSource200Response1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteSource200Response1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteSource200Response1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteSource200Response1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteSource200Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteSource200Response1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteSource200Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteSource200Response1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteSource200Response1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteSource200Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteSource200Response1 + * @throws IOException if the JSON string is invalid with respect to DeleteSource200Response1 + */ + public static DeleteSource200Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteSource200Response1.class); } - } - - /** - * Create an instance of DeleteSource200Response1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteSource200Response1 - * @throws IOException if the JSON string is invalid with respect to DeleteSource200Response1 - */ - public static DeleteSource200Response1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteSource200Response1.class); - } - - /** - * Convert an instance of DeleteSource200Response1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteSource200Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteSourceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/DeleteSourceAlphaOutput.java index de7ff898..2ce667fd 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteSourceAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/DeleteSourceAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,245 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the status of a Source deletion. - */ -@ApiModel(description = "Returns the status of a Source deletion.") - +/** Returns the status of a Source deletion. */ public class DeleteSourceAlphaOutput { - /** - * The status of the Source deletion operation. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The status of the Source deletion operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteSourceAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteSourceAlphaOutput status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteSourceAlphaOutput() {} - /** - * The status of the Source deletion operation. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The status of the Source deletion operation.") + public DeleteSourceAlphaOutput status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The status of the Source deletion operation. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteSourceAlphaOutput deleteSourceAlphaOutput = (DeleteSourceAlphaOutput) o; + return Objects.equals(this.status, deleteSourceAlphaOutput.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteSourceAlphaOutput {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteSourceAlphaOutput deleteSourceAlphaOutput = (DeleteSourceAlphaOutput) o; - return Objects.equals(this.status, deleteSourceAlphaOutput.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteSourceAlphaOutput {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteSourceAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteSourceAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteSourceAlphaOutput is not found in the empty JSON string", DeleteSourceAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteSourceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteSourceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteSourceAlphaOutput is not found" + + " in the empty JSON string", + DeleteSourceAlphaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteSourceAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteSourceAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteSourceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteSourceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteSourceAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteSourceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteSourceAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteSourceAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteSourceAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteSourceAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteSourceAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteSourceAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteSourceAlphaOutput - * @throws IOException if the JSON string is invalid with respect to DeleteSourceAlphaOutput - */ - public static DeleteSourceAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteSourceAlphaOutput.class); - } - - /** - * Convert an instance of DeleteSourceAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteSourceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteSourceAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteSourceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteSourceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteSourceAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteSourceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteSourceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to DeleteSourceAlphaOutput + */ + public static DeleteSourceAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteSourceAlphaOutput.class); + } + + /** + * Convert an instance of DeleteSourceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteSourceV1Output.java b/src/main/java/com/segment/publicapi/models/DeleteSourceV1Output.java index 50bc2f1f..884c4f2f 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteSourceV1Output.java +++ b/src/main/java/com/segment/publicapi/models/DeleteSourceV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,244 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the status of a Source deletion. - */ -@ApiModel(description = "Returns the status of a Source deletion.") - +/** Returns the status of a Source deletion. */ public class DeleteSourceV1Output { - /** - * The status of the Source deletion operation. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The status of the Source deletion operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteSourceV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteSourceV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteSourceV1Output() {} - /** - * The status of the Source deletion operation. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The status of the Source deletion operation.") + public DeleteSourceV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The status of the Source deletion operation. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteSourceV1Output deleteSourceV1Output = (DeleteSourceV1Output) o; + return Objects.equals(this.status, deleteSourceV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteSourceV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteSourceV1Output deleteSourceV1Output = (DeleteSourceV1Output) o; - return Objects.equals(this.status, deleteSourceV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteSourceV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteSourceV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteSourceV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteSourceV1Output is not found in the empty JSON string", DeleteSourceV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteSourceV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteSourceV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteSourceV1Output is not found in" + + " the empty JSON string", + DeleteSourceV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteSourceV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteSourceV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteSourceV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteSourceV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteSourceV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteSourceV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteSourceV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteSourceV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteSourceV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteSourceV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteSourceV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteSourceV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteSourceV1Output - * @throws IOException if the JSON string is invalid with respect to DeleteSourceV1Output - */ - public static DeleteSourceV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteSourceV1Output.class); - } - - /** - * Convert an instance of DeleteSourceV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteSourceV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteSourceV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteSourceV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteSourceV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteSourceV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteSourceV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteSourceV1Output + * @throws IOException if the JSON string is invalid with respect to DeleteSourceV1Output + */ + public static DeleteSourceV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteSourceV1Output.class); + } + + /** + * Convert an instance of DeleteSourceV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteTrackingPlan200Response.java b/src/main/java/com/segment/publicapi/models/DeleteTrackingPlan200Response.java index 8ad14f44..27ca9bb1 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteTrackingPlan200Response.java +++ b/src/main/java/com/segment/publicapi/models/DeleteTrackingPlan200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteTrackingPlanV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteTrackingPlan200Response - */ - +/** DeleteTrackingPlan200Response */ public class DeleteTrackingPlan200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteTrackingPlanV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteTrackingPlan200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteTrackingPlanV1Output data; - public DeleteTrackingPlan200Response data(DeleteTrackingPlanV1Output data) { - - this.data = data; - return this; - } + public DeleteTrackingPlan200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteTrackingPlan200Response data(DeleteTrackingPlanV1Output data) { - public DeleteTrackingPlanV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteTrackingPlanV1Output getData() { + return data; + } - public void setData(DeleteTrackingPlanV1Output data) { - this.data = data; - } + public void setData(DeleteTrackingPlanV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteTrackingPlan200Response deleteTrackingPlan200Response = + (DeleteTrackingPlan200Response) o; + return Objects.equals(this.data, deleteTrackingPlan200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteTrackingPlan200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteTrackingPlan200Response deleteTrackingPlan200Response = (DeleteTrackingPlan200Response) o; - return Objects.equals(this.data, deleteTrackingPlan200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteTrackingPlan200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteTrackingPlan200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteTrackingPlan200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteTrackingPlan200Response is not found in the empty JSON string", DeleteTrackingPlan200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DeleteTrackingPlan200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteTrackingPlan200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteTrackingPlan200Response is not" + + " found in the empty JSON string", + DeleteTrackingPlan200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteTrackingPlan200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteTrackingPlan200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteTrackingPlan200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteTrackingPlan200Response` 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()) { + DeleteTrackingPlanV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteTrackingPlan200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteTrackingPlan200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteTrackingPlan200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteTrackingPlan200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteTrackingPlan200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteTrackingPlan200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteTrackingPlan200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeleteTrackingPlan200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteTrackingPlan200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteTrackingPlan200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteTrackingPlan200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteTrackingPlan200Response + * @throws IOException if the JSON string is invalid with respect to + * DeleteTrackingPlan200Response + */ + public static DeleteTrackingPlan200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteTrackingPlan200Response.class); } - } - - /** - * Create an instance of DeleteTrackingPlan200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteTrackingPlan200Response - * @throws IOException if the JSON string is invalid with respect to DeleteTrackingPlan200Response - */ - public static DeleteTrackingPlan200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteTrackingPlan200Response.class); - } - - /** - * Convert an instance of DeleteTrackingPlan200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteTrackingPlan200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteTrackingPlanV1Output.java b/src/main/java/com/segment/publicapi/models/DeleteTrackingPlanV1Output.java index efda298a..7387ff9f 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteTrackingPlanV1Output.java +++ b/src/main/java/com/segment/publicapi/models/DeleteTrackingPlanV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,245 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Result of a DeleteTrackingPlan call. - */ -@ApiModel(description = "Result of a DeleteTrackingPlan call.") - +/** Result of a DeleteTrackingPlan call. */ public class DeleteTrackingPlanV1Output { - /** - * The operation status. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The operation status. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteTrackingPlanV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteTrackingPlanV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteTrackingPlanV1Output() {} - /** - * The operation status. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The operation status.") + public DeleteTrackingPlanV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The operation status. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteTrackingPlanV1Output deleteTrackingPlanV1Output = (DeleteTrackingPlanV1Output) o; + return Objects.equals(this.status, deleteTrackingPlanV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteTrackingPlanV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteTrackingPlanV1Output deleteTrackingPlanV1Output = (DeleteTrackingPlanV1Output) o; - return Objects.equals(this.status, deleteTrackingPlanV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteTrackingPlanV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteTrackingPlanV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteTrackingPlanV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteTrackingPlanV1Output is not found in the empty JSON string", DeleteTrackingPlanV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteTrackingPlanV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteTrackingPlanV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteTrackingPlanV1Output is not" + + " found in the empty JSON string", + DeleteTrackingPlanV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteTrackingPlanV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteTrackingPlanV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteTrackingPlanV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteTrackingPlanV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteTrackingPlanV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteTrackingPlanV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteTrackingPlanV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteTrackingPlanV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteTrackingPlanV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteTrackingPlanV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteTrackingPlanV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteTrackingPlanV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteTrackingPlanV1Output - * @throws IOException if the JSON string is invalid with respect to DeleteTrackingPlanV1Output - */ - public static DeleteTrackingPlanV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteTrackingPlanV1Output.class); - } - - /** - * Convert an instance of DeleteTrackingPlanV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteTrackingPlanV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteTrackingPlanV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteTrackingPlanV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteTrackingPlanV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteTrackingPlanV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteTrackingPlanV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteTrackingPlanV1Output + * @throws IOException if the JSON string is invalid with respect to DeleteTrackingPlanV1Output + */ + public static DeleteTrackingPlanV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteTrackingPlanV1Output.class); + } + + /** + * Convert an instance of DeleteTrackingPlanV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteTransformation200Response.java b/src/main/java/com/segment/publicapi/models/DeleteTransformation200Response.java index 7db4a34a..c679099d 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteTransformation200Response.java +++ b/src/main/java/com/segment/publicapi/models/DeleteTransformation200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteTransformationBetaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteTransformation200Response - */ - +/** DeleteTransformation200Response */ public class DeleteTransformation200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteTransformationBetaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteTransformation200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteTransformationV1Output data; - public DeleteTransformation200Response data(DeleteTransformationBetaOutput data) { - - this.data = data; - return this; - } + public DeleteTransformation200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteTransformation200Response data(DeleteTransformationV1Output data) { - public DeleteTransformationBetaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteTransformationV1Output getData() { + return data; + } - public void setData(DeleteTransformationBetaOutput data) { - this.data = data; - } + public void setData(DeleteTransformationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteTransformation200Response deleteTransformation200Response = + (DeleteTransformation200Response) o; + return Objects.equals(this.data, deleteTransformation200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteTransformation200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteTransformation200Response deleteTransformation200Response = (DeleteTransformation200Response) o; - return Objects.equals(this.data, deleteTransformation200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteTransformation200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteTransformation200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteTransformation200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteTransformation200Response is not found in the empty JSON string", DeleteTransformation200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DeleteTransformation200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteTransformation200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteTransformation200Response is not" + + " found in the empty JSON string", + DeleteTransformation200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteTransformation200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteTransformation200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteTransformation200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteTransformation200Response` 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()) { + DeleteTransformationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteTransformation200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteTransformation200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteTransformation200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteTransformation200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteTransformation200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteTransformation200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteTransformation200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeleteTransformation200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteTransformation200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteTransformation200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteTransformation200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteTransformation200Response + * @throws IOException if the JSON string is invalid with respect to + * DeleteTransformation200Response + */ + public static DeleteTransformation200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteTransformation200Response.class); } - } - - /** - * Create an instance of DeleteTransformation200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteTransformation200Response - * @throws IOException if the JSON string is invalid with respect to DeleteTransformation200Response - */ - public static DeleteTransformation200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteTransformation200Response.class); - } - - /** - * Convert an instance of DeleteTransformation200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteTransformation200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteTransformationBetaInput.java b/src/main/java/com/segment/publicapi/models/DeleteTransformationBetaInput.java new file mode 100644 index 00000000..6bf7f501 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeleteTransformationBetaInput.java @@ -0,0 +1,214 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** The input of delete Transformation. */ +public class DeleteTransformationBetaInput { + public static final String SERIALIZED_NAME_TRANSFORMATION_ID = "transformationId"; + + @SerializedName(SERIALIZED_NAME_TRANSFORMATION_ID) + private String transformationId; + + public DeleteTransformationBetaInput() {} + + public DeleteTransformationBetaInput transformationId(String transformationId) { + + this.transformationId = transformationId; + return this; + } + + /** + * The Transformation id. + * + * @return transformationId + */ + @javax.annotation.Nonnull + public String getTransformationId() { + return transformationId; + } + + public void setTransformationId(String transformationId) { + this.transformationId = transformationId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteTransformationBetaInput deleteTransformationBetaInput = + (DeleteTransformationBetaInput) o; + return Objects.equals( + this.transformationId, deleteTransformationBetaInput.transformationId); + } + + @Override + public int hashCode() { + return Objects.hash(transformationId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteTransformationBetaInput {\n"); + sb.append(" transformationId: ").append(toIndentedString(transformationId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transformationId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("transformationId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DeleteTransformationBetaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteTransformationBetaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteTransformationBetaInput is not" + + " found in the empty JSON string", + DeleteTransformationBetaInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteTransformationBetaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteTransformationBetaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteTransformationBetaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("transformationId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transformationId` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("transformationId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteTransformationBetaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteTransformationBetaInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeleteTransformationBetaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteTransformationBetaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteTransformationBetaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteTransformationBetaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteTransformationBetaInput + * @throws IOException if the JSON string is invalid with respect to + * DeleteTransformationBetaInput + */ + public static DeleteTransformationBetaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteTransformationBetaInput.class); + } + + /** + * Convert an instance of DeleteTransformationBetaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteTransformationBetaOutput.java b/src/main/java/com/segment/publicapi/models/DeleteTransformationBetaOutput.java index 900a9722..7c39362b 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteTransformationBetaOutput.java +++ b/src/main/java/com/segment/publicapi/models/DeleteTransformationBetaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,250 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The output of delete Transformation. - */ -@ApiModel(description = "The output of delete Transformation.") - +/** The output of delete Transformation. */ public class DeleteTransformationBetaOutput { - /** - * The operation status. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The operation status. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteTransformationBetaOutput() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteTransformationBetaOutput status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteTransformationBetaOutput() {} - /** - * The operation status. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The operation status.") + public DeleteTransformationBetaOutput status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The operation status. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteTransformationBetaOutput deleteTransformationBetaOutput = + (DeleteTransformationBetaOutput) o; + return Objects.equals(this.status, deleteTransformationBetaOutput.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteTransformationBetaOutput {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteTransformationBetaOutput deleteTransformationBetaOutput = (DeleteTransformationBetaOutput) o; - return Objects.equals(this.status, deleteTransformationBetaOutput.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteTransformationBetaOutput {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteTransformationBetaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteTransformationBetaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteTransformationBetaOutput is not found in the empty JSON string", DeleteTransformationBetaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DeleteTransformationBetaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteTransformationBetaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteTransformationBetaOutput is not" + + " found in the empty JSON string", + DeleteTransformationBetaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteTransformationBetaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteTransformationBetaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteTransformationBetaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteTransformationBetaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteTransformationBetaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteTransformationBetaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteTransformationBetaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteTransformationBetaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteTransformationBetaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteTransformationBetaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteTransformationBetaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteTransformationBetaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteTransformationBetaOutput - * @throws IOException if the JSON string is invalid with respect to DeleteTransformationBetaOutput - */ - public static DeleteTransformationBetaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteTransformationBetaOutput.class); - } - - /** - * Convert an instance of DeleteTransformationBetaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteTransformationBetaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteTransformationBetaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeleteTransformationBetaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteTransformationBetaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteTransformationBetaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteTransformationBetaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteTransformationBetaOutput + * @throws IOException if the JSON string is invalid with respect to + * DeleteTransformationBetaOutput + */ + public static DeleteTransformationBetaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteTransformationBetaOutput.class); + } + + /** + * Convert an instance of DeleteTransformationBetaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteTransformationV1Output.java b/src/main/java/com/segment/publicapi/models/DeleteTransformationV1Output.java new file mode 100644 index 00000000..633b7312 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeleteTransformationV1Output.java @@ -0,0 +1,257 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** The output of delete Transformation. */ +public class DeleteTransformationV1Output { + /** The operation status. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); + + 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 DeleteTransformationV1Output() {} + + public DeleteTransformationV1Output status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The operation 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; + } + DeleteTransformationV1Output deleteTransformationV1Output = + (DeleteTransformationV1Output) o; + return Objects.equals(this.status, deleteTransformationV1Output.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteTransformationV1Output {\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(); + 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 + * DeleteTransformationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteTransformationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteTransformationV1Output is not" + + " found in the empty JSON string", + DeleteTransformationV1Output.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteTransformationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteTransformationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteTransformationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!DeleteTransformationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteTransformationV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeleteTransformationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteTransformationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteTransformationV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteTransformationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteTransformationV1Output + * @throws IOException if the JSON string is invalid with respect to + * DeleteTransformationV1Output + */ + public static DeleteTransformationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteTransformationV1Output.class); + } + + /** + * Convert an instance of DeleteTransformationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteUserGroup200Response.java b/src/main/java/com/segment/publicapi/models/DeleteUserGroup200Response.java index f273034c..d62006a8 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteUserGroup200Response.java +++ b/src/main/java/com/segment/publicapi/models/DeleteUserGroup200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteUserGroupV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteUserGroup200Response - */ - +/** DeleteUserGroup200Response */ public class DeleteUserGroup200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteUserGroupV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteUserGroup200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteUserGroupV1Output data; - public DeleteUserGroup200Response data(DeleteUserGroupV1Output data) { - - this.data = data; - return this; - } + public DeleteUserGroup200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteUserGroup200Response data(DeleteUserGroupV1Output data) { - public DeleteUserGroupV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteUserGroupV1Output getData() { + return data; + } - public void setData(DeleteUserGroupV1Output data) { - this.data = data; - } + public void setData(DeleteUserGroupV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteUserGroup200Response deleteUserGroup200Response = (DeleteUserGroup200Response) o; + return Objects.equals(this.data, deleteUserGroup200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteUserGroup200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteUserGroup200Response deleteUserGroup200Response = (DeleteUserGroup200Response) o; - return Objects.equals(this.data, deleteUserGroup200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteUserGroup200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteUserGroup200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteUserGroup200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteUserGroup200Response is not found in the empty JSON string", DeleteUserGroup200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteUserGroup200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteUserGroup200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteUserGroup200Response is not" + + " found in the empty JSON string", + DeleteUserGroup200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteUserGroup200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteUserGroup200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteUserGroup200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteUserGroup200Response` 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()) { + DeleteUserGroupV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteUserGroup200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteUserGroup200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteUserGroup200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteUserGroup200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteUserGroup200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteUserGroup200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteUserGroup200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteUserGroup200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteUserGroup200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteUserGroup200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteUserGroup200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteUserGroup200Response + * @throws IOException if the JSON string is invalid with respect to DeleteUserGroup200Response + */ + public static DeleteUserGroup200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteUserGroup200Response.class); } - } - - /** - * Create an instance of DeleteUserGroup200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteUserGroup200Response - * @throws IOException if the JSON string is invalid with respect to DeleteUserGroup200Response - */ - public static DeleteUserGroup200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteUserGroup200Response.class); - } - - /** - * Convert an instance of DeleteUserGroup200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteUserGroup200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteUserGroupV1Output.java b/src/main/java/com/segment/publicapi/models/DeleteUserGroupV1Output.java index 103398b7..03fc4ba2 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteUserGroupV1Output.java +++ b/src/main/java/com/segment/publicapi/models/DeleteUserGroupV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,245 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the status of the completed deletion operation. - */ -@ApiModel(description = "Returns the status of the completed deletion operation.") - +/** Returns the status of the completed deletion operation. */ public class DeleteUserGroupV1Output { - /** - * A flag indicating the status of a successful deletion operation. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** A flag indicating the status of a successful deletion operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteUserGroupV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteUserGroupV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteUserGroupV1Output() {} - /** - * A flag indicating the status of a successful deletion operation. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A flag indicating the status of a successful deletion operation.") + public DeleteUserGroupV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * A flag indicating the status of a successful deletion operation. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteUserGroupV1Output deleteUserGroupV1Output = (DeleteUserGroupV1Output) o; + return Objects.equals(this.status, deleteUserGroupV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteUserGroupV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteUserGroupV1Output deleteUserGroupV1Output = (DeleteUserGroupV1Output) o; - return Objects.equals(this.status, deleteUserGroupV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteUserGroupV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteUserGroupV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteUserGroupV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteUserGroupV1Output is not found in the empty JSON string", DeleteUserGroupV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteUserGroupV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteUserGroupV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteUserGroupV1Output is not found" + + " in the empty JSON string", + DeleteUserGroupV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteUserGroupV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteUserGroupV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteUserGroupV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteUserGroupV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteUserGroupV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteUserGroupV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteUserGroupV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteUserGroupV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteUserGroupV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteUserGroupV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteUserGroupV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteUserGroupV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteUserGroupV1Output - * @throws IOException if the JSON string is invalid with respect to DeleteUserGroupV1Output - */ - public static DeleteUserGroupV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteUserGroupV1Output.class); - } - - /** - * Convert an instance of DeleteUserGroupV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteUserGroupV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteUserGroupV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteUserGroupV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteUserGroupV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteUserGroupV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteUserGroupV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteUserGroupV1Output + * @throws IOException if the JSON string is invalid with respect to DeleteUserGroupV1Output + */ + public static DeleteUserGroupV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteUserGroupV1Output.class); + } + + /** + * Convert an instance of DeleteUserGroupV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteUsers200Response.java b/src/main/java/com/segment/publicapi/models/DeleteUsers200Response.java index f915668e..a9748903 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteUsers200Response.java +++ b/src/main/java/com/segment/publicapi/models/DeleteUsers200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,185 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteUsersV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteUsers200Response - */ - +/** DeleteUsers200Response */ public class DeleteUsers200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteUsersV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteUsers200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteUsersV1Output data; - public DeleteUsers200Response data(DeleteUsersV1Output data) { - - this.data = data; - return this; - } + public DeleteUsers200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteUsers200Response data(DeleteUsersV1Output data) { - public DeleteUsersV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteUsersV1Output getData() { + return data; + } - public void setData(DeleteUsersV1Output data) { - this.data = data; - } + public void setData(DeleteUsersV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteUsers200Response deleteUsers200Response = (DeleteUsers200Response) o; + return Objects.equals(this.data, deleteUsers200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteUsers200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteUsers200Response deleteUsers200Response = (DeleteUsers200Response) o; - return Objects.equals(this.data, deleteUsers200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteUsers200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteUsers200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteUsers200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteUsers200Response is not found in the empty JSON string", DeleteUsers200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteUsers200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteUsers200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteUsers200Response is not found in" + + " the empty JSON string", + DeleteUsers200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteUsers200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteUsers200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteUsers200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteUsers200Response` 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()) { + DeleteUsersV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteUsers200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteUsers200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteUsers200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteUsers200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteUsers200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteUsers200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteUsers200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteUsers200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteUsers200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteUsers200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteUsers200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteUsers200Response + * @throws IOException if the JSON string is invalid with respect to DeleteUsers200Response + */ + public static DeleteUsers200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteUsers200Response.class); } - } - - /** - * Create an instance of DeleteUsers200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteUsers200Response - * @throws IOException if the JSON string is invalid with respect to DeleteUsers200Response - */ - public static DeleteUsers200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteUsers200Response.class); - } - - /** - * Convert an instance of DeleteUsers200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteUsers200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteUsersV1Output.java b/src/main/java/com/segment/publicapi/models/DeleteUsersV1Output.java index 2e17f1e0..5c4313d3 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteUsersV1Output.java +++ b/src/main/java/com/segment/publicapi/models/DeleteUsersV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,244 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the status of the removal operation. - */ -@ApiModel(description = "Returns the status of the removal operation.") - +/** Returns the status of the removal operation. */ public class DeleteUsersV1Output { - /** - * A flag that indicates the status of a successful deletion operation. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** A flag that indicates the status of a successful deletion operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteUsersV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteUsersV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteUsersV1Output() {} - /** - * A flag that indicates the status of a successful deletion operation. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A flag that indicates the status of a successful deletion operation.") + public DeleteUsersV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * A flag that indicates the status of a successful deletion operation. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteUsersV1Output deleteUsersV1Output = (DeleteUsersV1Output) o; + return Objects.equals(this.status, deleteUsersV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteUsersV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteUsersV1Output deleteUsersV1Output = (DeleteUsersV1Output) o; - return Objects.equals(this.status, deleteUsersV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteUsersV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteUsersV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteUsersV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteUsersV1Output is not found in the empty JSON string", DeleteUsersV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteUsersV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteUsersV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteUsersV1Output is not found in" + + " the empty JSON string", + DeleteUsersV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteUsersV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteUsersV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteUsersV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteUsersV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteUsersV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteUsersV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteUsersV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteUsersV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteUsersV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteUsersV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteUsersV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteUsersV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteUsersV1Output - * @throws IOException if the JSON string is invalid with respect to DeleteUsersV1Output - */ - public static DeleteUsersV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteUsersV1Output.class); - } - - /** - * Convert an instance of DeleteUsersV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteUsersV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteUsersV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteUsersV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteUsersV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteUsersV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteUsersV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteUsersV1Output + * @throws IOException if the JSON string is invalid with respect to DeleteUsersV1Output + */ + public static DeleteUsersV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteUsersV1Output.class); + } + + /** + * Convert an instance of DeleteUsersV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteWarehouse200Response.java b/src/main/java/com/segment/publicapi/models/DeleteWarehouse200Response.java index 39898d08..c15551e9 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteWarehouse200Response.java +++ b/src/main/java/com/segment/publicapi/models/DeleteWarehouse200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DeleteWarehouseV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DeleteWarehouse200Response - */ - +/** DeleteWarehouse200Response */ public class DeleteWarehouse200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DeleteWarehouseV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DeleteWarehouse200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DeleteWarehouseV1Output data; - public DeleteWarehouse200Response data(DeleteWarehouseV1Output data) { - - this.data = data; - return this; - } + public DeleteWarehouse200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DeleteWarehouse200Response data(DeleteWarehouseV1Output data) { - public DeleteWarehouseV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DeleteWarehouseV1Output getData() { + return data; + } - public void setData(DeleteWarehouseV1Output data) { - this.data = data; - } + public void setData(DeleteWarehouseV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteWarehouse200Response deleteWarehouse200Response = (DeleteWarehouse200Response) o; + return Objects.equals(this.data, deleteWarehouse200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteWarehouse200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteWarehouse200Response deleteWarehouse200Response = (DeleteWarehouse200Response) o; - return Objects.equals(this.data, deleteWarehouse200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteWarehouse200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteWarehouse200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteWarehouse200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteWarehouse200Response is not found in the empty JSON string", DeleteWarehouse200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteWarehouse200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteWarehouse200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteWarehouse200Response is not" + + " found in the empty JSON string", + DeleteWarehouse200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteWarehouse200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteWarehouse200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteWarehouse200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteWarehouse200Response` 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()) { + DeleteWarehouseV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteWarehouse200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteWarehouse200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteWarehouse200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteWarehouse200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteWarehouse200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteWarehouse200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteWarehouse200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteWarehouse200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteWarehouse200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteWarehouse200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteWarehouse200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteWarehouse200Response + * @throws IOException if the JSON string is invalid with respect to DeleteWarehouse200Response + */ + public static DeleteWarehouse200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteWarehouse200Response.class); } - } - - /** - * Create an instance of DeleteWarehouse200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteWarehouse200Response - * @throws IOException if the JSON string is invalid with respect to DeleteWarehouse200Response - */ - public static DeleteWarehouse200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteWarehouse200Response.class); - } - - /** - * Convert an instance of DeleteWarehouse200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DeleteWarehouse200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeleteWarehouseV1Output.java b/src/main/java/com/segment/publicapi/models/DeleteWarehouseV1Output.java index 101e82b0..e8cffa72 100644 --- a/src/main/java/com/segment/publicapi/models/DeleteWarehouseV1Output.java +++ b/src/main/java/com/segment/publicapi/models/DeleteWarehouseV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,245 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the status of a Warehouse deletion. - */ -@ApiModel(description = "Returns the status of a Warehouse deletion.") - +/** Returns the status of a Warehouse deletion. */ public class DeleteWarehouseV1Output { - /** - * The status of the Warehouse deletion operation. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The status of the Warehouse deletion operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public DeleteWarehouseV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public DeleteWarehouseV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public DeleteWarehouseV1Output() {} - /** - * The status of the Warehouse deletion operation. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The status of the Warehouse deletion operation.") + public DeleteWarehouseV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The status of the Warehouse deletion operation. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + DeleteWarehouseV1Output deleteWarehouseV1Output = (DeleteWarehouseV1Output) o; + return Objects.equals(this.status, deleteWarehouseV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteWarehouseV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeleteWarehouseV1Output deleteWarehouseV1Output = (DeleteWarehouseV1Output) o; - return Objects.equals(this.status, deleteWarehouseV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteWarehouseV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeleteWarehouseV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeleteWarehouseV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteWarehouseV1Output is not found in the empty JSON string", DeleteWarehouseV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteWarehouseV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteWarehouseV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeleteWarehouseV1Output is not found" + + " in the empty JSON string", + DeleteWarehouseV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeleteWarehouseV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteWarehouseV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeleteWarehouseV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeleteWarehouseV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteWarehouseV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteWarehouseV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!DeleteWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteWarehouseV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeleteWarehouseV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteWarehouseV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteWarehouseV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DeleteWarehouseV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteWarehouseV1Output - * @throws IOException if the JSON string is invalid with respect to DeleteWarehouseV1Output - */ - public static DeleteWarehouseV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteWarehouseV1Output.class); - } - - /** - * Convert an instance of DeleteWarehouseV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteWarehouseV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteWarehouseV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteWarehouseV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeleteWarehouseV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteWarehouseV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteWarehouseV1Output + * @throws IOException if the JSON string is invalid with respect to DeleteWarehouseV1Output + */ + public static DeleteWarehouseV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteWarehouseV1Output.class); + } + + /** + * Convert an instance of DeleteWarehouseV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeliveryMetricsSummary.java b/src/main/java/com/segment/publicapi/models/DeliveryMetricsSummary.java deleted file mode 100644 index 3b10e83d..00000000 --- a/src/main/java/com/segment/publicapi/models/DeliveryMetricsSummary.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.MetricBeta; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The delivery metrics summary returned. - */ -@ApiModel(description = "The delivery metrics summary returned.") - -public class DeliveryMetricsSummary { - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) - private String destinationMetadataId; - - public static final String SERIALIZED_NAME_METRICS = "metrics"; - @SerializedName(SERIALIZED_NAME_METRICS) - private List metrics = new ArrayList<>(); - - public DeliveryMetricsSummary() { - } - - public DeliveryMetricsSummary sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } - - /** - * The Source id. Config API note: analogous to `parent`. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source id. Config API note: analogous to `parent`.") - - public String getSourceId() { - return sourceId; - } - - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public DeliveryMetricsSummary destinationMetadataId(String destinationMetadataId) { - - this.destinationMetadataId = destinationMetadataId; - return this; - } - - /** - * The Destination metadata id. - * @return destinationMetadataId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Destination metadata id.") - - public String getDestinationMetadataId() { - return destinationMetadataId; - } - - - public void setDestinationMetadataId(String destinationMetadataId) { - this.destinationMetadataId = destinationMetadataId; - } - - - public DeliveryMetricsSummary metrics(List metrics) { - - this.metrics = metrics; - return this; - } - - public DeliveryMetricsSummary addMetricsItem(MetricBeta metricsItem) { - this.metrics.add(metricsItem); - return this; - } - - /** - * The summary of event delivery metrics for the requested Destination. - * @return metrics - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The summary of event delivery metrics for the requested Destination.") - - public List getMetrics() { - return metrics; - } - - - public void setMetrics(List metrics) { - this.metrics = metrics; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeliveryMetricsSummary deliveryMetricsSummary = (DeliveryMetricsSummary) o; - return Objects.equals(this.sourceId, deliveryMetricsSummary.sourceId) && - Objects.equals(this.destinationMetadataId, deliveryMetricsSummary.destinationMetadataId) && - Objects.equals(this.metrics, deliveryMetricsSummary.metrics); - } - - @Override - public int hashCode() { - return Objects.hash(sourceId, destinationMetadataId, metrics); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeliveryMetricsSummary {\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" destinationMetadataId: ").append(toIndentedString(destinationMetadataId)).append("\n"); - sb.append(" metrics: ").append(toIndentedString(metrics)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourceId"); - openapiFields.add("destinationMetadataId"); - openapiFields.add("metrics"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("destinationMetadataId"); - openapiRequiredFields.add("metrics"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeliveryMetricsSummary - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeliveryMetricsSummary.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeliveryMetricsSummary is not found in the empty JSON string", DeliveryMetricsSummary.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeliveryMetricsSummary.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliveryMetricsSummary` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeliveryMetricsSummary.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); - } - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("destinationMetadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationMetadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationMetadataId").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("metrics").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `metrics` to be an array in the JSON string but got `%s`", jsonObj.get("metrics").toString())); - } - - JsonArray jsonArraymetrics = jsonObj.getAsJsonArray("metrics"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeliveryMetricsSummary.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeliveryMetricsSummary' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeliveryMetricsSummary.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeliveryMetricsSummary value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeliveryMetricsSummary read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of DeliveryMetricsSummary given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeliveryMetricsSummary - * @throws IOException if the JSON string is invalid with respect to DeliveryMetricsSummary - */ - public static DeliveryMetricsSummary fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeliveryMetricsSummary.class); - } - - /** - * Convert an instance of DeliveryMetricsSummary to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/DeliveryMetricsSummaryBeta.java b/src/main/java/com/segment/publicapi/models/DeliveryMetricsSummaryBeta.java index a24f143d..df35e7df 100644 --- a/src/main/java/com/segment/publicapi/models/DeliveryMetricsSummaryBeta.java +++ b/src/main/java/com/segment/publicapi/models/DeliveryMetricsSummaryBeta.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,287 +9,295 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.MetricBeta; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Defines the summary of delivery metrics for a Destination. - */ -@ApiModel(description = "Defines the summary of delivery metrics for a Destination.") - +/** Defines the summary of delivery metrics for a Destination. */ public class DeliveryMetricsSummaryBeta { - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) - private String destinationMetadataId; + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - public static final String SERIALIZED_NAME_METRICS = "metrics"; - @SerializedName(SERIALIZED_NAME_METRICS) - private List metrics = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; - public DeliveryMetricsSummaryBeta() { - } + public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; - public DeliveryMetricsSummaryBeta sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) + private String destinationMetadataId; - /** - * The Source id. Config API note: analogous to `parent`. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source id. Config API note: analogous to `parent`.") + public static final String SERIALIZED_NAME_METRICS = "metrics"; - public String getSourceId() { - return sourceId; - } + @SerializedName(SERIALIZED_NAME_METRICS) + private List metrics = new ArrayList<>(); + public DeliveryMetricsSummaryBeta() {} - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + public DeliveryMetricsSummaryBeta sourceId(String sourceId) { + this.sourceId = sourceId; + return this; + } - public DeliveryMetricsSummaryBeta destinationMetadataId(String destinationMetadataId) { - - this.destinationMetadataId = destinationMetadataId; - return this; - } - - /** - * The Destination metadata id. - * @return destinationMetadataId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Destination metadata id.") + /** + * The Source id. Config API note: analogous to `parent`. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } - public String getDestinationMetadataId() { - return destinationMetadataId; - } + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + public DeliveryMetricsSummaryBeta destinationMetadataId(String destinationMetadataId) { - public void setDestinationMetadataId(String destinationMetadataId) { - this.destinationMetadataId = destinationMetadataId; - } + this.destinationMetadataId = destinationMetadataId; + return this; + } + /** + * The Destination metadata id. + * + * @return destinationMetadataId + */ + @javax.annotation.Nonnull + public String getDestinationMetadataId() { + return destinationMetadataId; + } - public DeliveryMetricsSummaryBeta metrics(List metrics) { - - this.metrics = metrics; - return this; - } + public void setDestinationMetadataId(String destinationMetadataId) { + this.destinationMetadataId = destinationMetadataId; + } - public DeliveryMetricsSummaryBeta addMetricsItem(MetricBeta metricsItem) { - this.metrics.add(metricsItem); - return this; - } + public DeliveryMetricsSummaryBeta metrics(List metrics) { - /** - * The summary of event delivery metrics for the requested Destination. - * @return metrics - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The summary of event delivery metrics for the requested Destination.") + this.metrics = metrics; + return this; + } - public List getMetrics() { - return metrics; - } + public DeliveryMetricsSummaryBeta addMetricsItem(MetricBeta metricsItem) { + if (this.metrics == null) { + this.metrics = new ArrayList<>(); + } + this.metrics.add(metricsItem); + return this; + } + /** + * The summary of event delivery metrics for the requested Destination. + * + * @return metrics + */ + @javax.annotation.Nonnull + public List getMetrics() { + return metrics; + } - public void setMetrics(List metrics) { - this.metrics = metrics; - } + public void setMetrics(List metrics) { + this.metrics = metrics; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryMetricsSummaryBeta deliveryMetricsSummaryBeta = (DeliveryMetricsSummaryBeta) o; + return Objects.equals(this.sourceId, deliveryMetricsSummaryBeta.sourceId) + && Objects.equals( + this.destinationMetadataId, + deliveryMetricsSummaryBeta.destinationMetadataId) + && Objects.equals(this.metrics, deliveryMetricsSummaryBeta.metrics); + } + @Override + public int hashCode() { + return Objects.hash(sourceId, destinationMetadataId, metrics); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryMetricsSummaryBeta {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" destinationMetadataId: ") + .append(toIndentedString(destinationMetadataId)) + .append("\n"); + sb.append(" metrics: ").append(toIndentedString(metrics)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DeliveryMetricsSummaryBeta deliveryMetricsSummaryBeta = (DeliveryMetricsSummaryBeta) o; - return Objects.equals(this.sourceId, deliveryMetricsSummaryBeta.sourceId) && - Objects.equals(this.destinationMetadataId, deliveryMetricsSummaryBeta.destinationMetadataId) && - Objects.equals(this.metrics, deliveryMetricsSummaryBeta.metrics); - } - - @Override - public int hashCode() { - return Objects.hash(sourceId, destinationMetadataId, metrics); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeliveryMetricsSummaryBeta {\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" destinationMetadataId: ").append(toIndentedString(destinationMetadataId)).append("\n"); - sb.append(" metrics: ").append(toIndentedString(metrics)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + openapiFields.add("destinationMetadataId"); + openapiFields.add("metrics"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("destinationMetadataId"); + openapiRequiredFields.add("metrics"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourceId"); - openapiFields.add("destinationMetadataId"); - openapiFields.add("metrics"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("destinationMetadataId"); - openapiRequiredFields.add("metrics"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DeliveryMetricsSummaryBeta - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DeliveryMetricsSummaryBeta.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DeliveryMetricsSummaryBeta is not found in the empty JSON string", DeliveryMetricsSummaryBeta.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliveryMetricsSummaryBeta + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryMetricsSummaryBeta.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeliveryMetricsSummaryBeta is not" + + " found in the empty JSON string", + DeliveryMetricsSummaryBeta.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DeliveryMetricsSummaryBeta.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliveryMetricsSummaryBeta` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryMetricsSummaryBeta.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeliveryMetricsSummaryBeta` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeliveryMetricsSummaryBeta.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliveryMetricsSummaryBeta.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } } - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("destinationMetadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationMetadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationMetadataId").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("metrics").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `metrics` to be an array in the JSON string but got `%s`", jsonObj.get("metrics").toString())); - } - - JsonArray jsonArraymetrics = jsonObj.getAsJsonArray("metrics"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeliveryMetricsSummaryBeta.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeliveryMetricsSummaryBeta' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DeliveryMetricsSummaryBeta.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DeliveryMetricsSummaryBeta value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeliveryMetricsSummaryBeta read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if (!jsonObj.get("destinationMetadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `destinationMetadataId` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("destinationMetadataId").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("metrics").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `metrics` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("metrics").toString())); + } + + JsonArray jsonArraymetrics = jsonObj.getAsJsonArray("metrics"); + // validate the required field `metrics` (array) + for (int i = 0; i < jsonArraymetrics.size(); i++) { + MetricBeta.validateJsonElement(jsonArraymetrics.get(i)); + } + ; } - } - - /** - * Create an instance of DeliveryMetricsSummaryBeta given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeliveryMetricsSummaryBeta - * @throws IOException if the JSON string is invalid with respect to DeliveryMetricsSummaryBeta - */ - public static DeliveryMetricsSummaryBeta fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeliveryMetricsSummaryBeta.class); - } - - /** - * Convert an instance of DeliveryMetricsSummaryBeta to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryMetricsSummaryBeta.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryMetricsSummaryBeta' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeliveryMetricsSummaryBeta.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryMetricsSummaryBeta value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryMetricsSummaryBeta read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryMetricsSummaryBeta given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryMetricsSummaryBeta + * @throws IOException if the JSON string is invalid with respect to DeliveryMetricsSummaryBeta + */ + public static DeliveryMetricsSummaryBeta fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryMetricsSummaryBeta.class); + } + + /** + * Convert an instance of DeliveryMetricsSummaryBeta to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeliveryOverviewDestinationFilterBy.java b/src/main/java/com/segment/publicapi/models/DeliveryOverviewDestinationFilterBy.java new file mode 100644 index 00000000..3e800c92 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeliveryOverviewDestinationFilterBy.java @@ -0,0 +1,555 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * The `DeliveryOverviewDestinationFilterBy` object is a map of the filterable fields and + * their values. + */ +public class DeliveryOverviewDestinationFilterBy { + public static final String SERIALIZED_NAME_DISCARD_REASON = "discardReason"; + + @SerializedName(SERIALIZED_NAME_DISCARD_REASON) + private List discardReason; + + public static final String SERIALIZED_NAME_EVENT_NAME = "eventName"; + + @SerializedName(SERIALIZED_NAME_EVENT_NAME) + private List eventName; + + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private List eventType; + + public static final String SERIALIZED_NAME_APP_VERSION = "appVersion"; + + @SerializedName(SERIALIZED_NAME_APP_VERSION) + private List appVersion; + + public static final String SERIALIZED_NAME_SUBSCRIPTION_ID = "subscriptionId"; + + @SerializedName(SERIALIZED_NAME_SUBSCRIPTION_ID) + private List subscriptionId; + + public static final String SERIALIZED_NAME_ACTIVATION_ID = "activationId"; + + @SerializedName(SERIALIZED_NAME_ACTIVATION_ID) + private List activationId; + + public static final String SERIALIZED_NAME_AUDIENCE_ID = "audienceId"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE_ID) + private List audienceId; + + public static final String SERIALIZED_NAME_SPACE_ID = "spaceId"; + + @SerializedName(SERIALIZED_NAME_SPACE_ID) + private List spaceId; + + public DeliveryOverviewDestinationFilterBy() {} + + public DeliveryOverviewDestinationFilterBy discardReason(List discardReason) { + + this.discardReason = discardReason; + return this; + } + + public DeliveryOverviewDestinationFilterBy addDiscardReasonItem(String discardReasonItem) { + if (this.discardReason == null) { + this.discardReason = new ArrayList<>(); + } + this.discardReason.add(discardReasonItem); + return this; + } + + /** + * A list of strings of discard reasons. See [Discard Record + * Documentation](https://segment.com/docs/connections/delivery-overview/#troubleshooting) for + * valid error codes. + * + * @return discardReason + */ + @javax.annotation.Nullable + public List getDiscardReason() { + return discardReason; + } + + public void setDiscardReason(List discardReason) { + this.discardReason = discardReason; + } + + public DeliveryOverviewDestinationFilterBy eventName(List eventName) { + + this.eventName = eventName; + return this; + } + + public DeliveryOverviewDestinationFilterBy addEventNameItem(String eventNameItem) { + if (this.eventName == null) { + this.eventName = new ArrayList<>(); + } + this.eventName.add(eventNameItem); + return this; + } + + /** + * A list of strings of event names. + * + * @return eventName + */ + @javax.annotation.Nullable + public List getEventName() { + return eventName; + } + + public void setEventName(List eventName) { + this.eventName = eventName; + } + + public DeliveryOverviewDestinationFilterBy eventType(List eventType) { + + this.eventType = eventType; + return this; + } + + public DeliveryOverviewDestinationFilterBy addEventTypeItem(String eventTypeItem) { + if (this.eventType == null) { + this.eventType = new ArrayList<>(); + } + this.eventType.add(eventTypeItem); + return this; + } + + /** + * A list of strings of event types. Valid options are: `alias`, `group`, + * `identify`, `page`, `screen`, and `track`. + * + * @return eventType + */ + @javax.annotation.Nullable + public List getEventType() { + return eventType; + } + + public void setEventType(List eventType) { + this.eventType = eventType; + } + + public DeliveryOverviewDestinationFilterBy appVersion(List appVersion) { + + this.appVersion = appVersion; + return this; + } + + public DeliveryOverviewDestinationFilterBy addAppVersionItem(String appVersionItem) { + if (this.appVersion == null) { + this.appVersion = new ArrayList<>(); + } + this.appVersion.add(appVersionItem); + return this; + } + + /** + * A list of strings of app versions. + * + * @return appVersion + */ + @javax.annotation.Nullable + public List getAppVersion() { + return appVersion; + } + + public void setAppVersion(List appVersion) { + this.appVersion = appVersion; + } + + public DeliveryOverviewDestinationFilterBy subscriptionId(List subscriptionId) { + + this.subscriptionId = subscriptionId; + return this; + } + + public DeliveryOverviewDestinationFilterBy addSubscriptionIdItem(String subscriptionIdItem) { + if (this.subscriptionId == null) { + this.subscriptionId = new ArrayList<>(); + } + this.subscriptionId.add(subscriptionIdItem); + return this; + } + + /** + * A list of strings of subscription IDs for Actions Destinations. + * + * @return subscriptionId + */ + @javax.annotation.Nullable + public List getSubscriptionId() { + return subscriptionId; + } + + public void setSubscriptionId(List subscriptionId) { + this.subscriptionId = subscriptionId; + } + + public DeliveryOverviewDestinationFilterBy activationId(List activationId) { + + this.activationId = activationId; + return this; + } + + public DeliveryOverviewDestinationFilterBy addActivationIdItem(String activationIdItem) { + if (this.activationId == null) { + this.activationId = new ArrayList<>(); + } + this.activationId.add(activationIdItem); + return this; + } + + /** + * A list of strings of event context IDs from a Linked Audience mapping/activation. + * + * @return activationId + */ + @javax.annotation.Nullable + public List getActivationId() { + return activationId; + } + + public void setActivationId(List activationId) { + this.activationId = activationId; + } + + public DeliveryOverviewDestinationFilterBy audienceId(List audienceId) { + + this.audienceId = audienceId; + return this; + } + + public DeliveryOverviewDestinationFilterBy addAudienceIdItem(String audienceIdItem) { + if (this.audienceId == null) { + this.audienceId = new ArrayList<>(); + } + this.audienceId.add(audienceIdItem); + return this; + } + + /** + * A list of strings of audience IDs for a Linked Audience. + * + * @return audienceId + */ + @javax.annotation.Nullable + public List getAudienceId() { + return audienceId; + } + + public void setAudienceId(List audienceId) { + this.audienceId = audienceId; + } + + public DeliveryOverviewDestinationFilterBy spaceId(List spaceId) { + + this.spaceId = spaceId; + return this; + } + + public DeliveryOverviewDestinationFilterBy addSpaceIdItem(String spaceIdItem) { + if (this.spaceId == null) { + this.spaceId = new ArrayList<>(); + } + this.spaceId.add(spaceIdItem); + return this; + } + + /** + * A list of strings of space IDs for a Linked Audience. + * + * @return spaceId + */ + @javax.annotation.Nullable + public List getSpaceId() { + return spaceId; + } + + public void setSpaceId(List spaceId) { + this.spaceId = spaceId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryOverviewDestinationFilterBy deliveryOverviewDestinationFilterBy = + (DeliveryOverviewDestinationFilterBy) o; + return Objects.equals(this.discardReason, deliveryOverviewDestinationFilterBy.discardReason) + && Objects.equals(this.eventName, deliveryOverviewDestinationFilterBy.eventName) + && Objects.equals(this.eventType, deliveryOverviewDestinationFilterBy.eventType) + && Objects.equals(this.appVersion, deliveryOverviewDestinationFilterBy.appVersion) + && Objects.equals( + this.subscriptionId, deliveryOverviewDestinationFilterBy.subscriptionId) + && Objects.equals( + this.activationId, deliveryOverviewDestinationFilterBy.activationId) + && Objects.equals(this.audienceId, deliveryOverviewDestinationFilterBy.audienceId) + && Objects.equals(this.spaceId, deliveryOverviewDestinationFilterBy.spaceId); + } + + @Override + public int hashCode() { + return Objects.hash( + discardReason, + eventName, + eventType, + appVersion, + subscriptionId, + activationId, + audienceId, + spaceId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryOverviewDestinationFilterBy {\n"); + sb.append(" discardReason: ").append(toIndentedString(discardReason)).append("\n"); + sb.append(" eventName: ").append(toIndentedString(eventName)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" appVersion: ").append(toIndentedString(appVersion)).append("\n"); + sb.append(" subscriptionId: ").append(toIndentedString(subscriptionId)).append("\n"); + sb.append(" activationId: ").append(toIndentedString(activationId)).append("\n"); + sb.append(" audienceId: ").append(toIndentedString(audienceId)).append("\n"); + sb.append(" spaceId: ").append(toIndentedString(spaceId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("discardReason"); + openapiFields.add("eventName"); + openapiFields.add("eventType"); + openapiFields.add("appVersion"); + openapiFields.add("subscriptionId"); + openapiFields.add("activationId"); + openapiFields.add("audienceId"); + openapiFields.add("spaceId"); + + // 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 + * DeliveryOverviewDestinationFilterBy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryOverviewDestinationFilterBy.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeliveryOverviewDestinationFilterBy is" + + " not found in the empty JSON string", + DeliveryOverviewDestinationFilterBy.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryOverviewDestinationFilterBy.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeliveryOverviewDestinationFilterBy` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("discardReason") != null + && !jsonObj.get("discardReason").isJsonNull() + && !jsonObj.get("discardReason").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `discardReason` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("discardReason").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("eventName") != null + && !jsonObj.get("eventName").isJsonNull() + && !jsonObj.get("eventName").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventName` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("eventName").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("eventType") != null + && !jsonObj.get("eventType").isJsonNull() + && !jsonObj.get("eventType").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventType` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("eventType").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("appVersion") != null + && !jsonObj.get("appVersion").isJsonNull() + && !jsonObj.get("appVersion").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `appVersion` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("appVersion").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("subscriptionId") != null + && !jsonObj.get("subscriptionId").isJsonNull() + && !jsonObj.get("subscriptionId").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `subscriptionId` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("subscriptionId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("activationId") != null + && !jsonObj.get("activationId").isJsonNull() + && !jsonObj.get("activationId").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `activationId` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("activationId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("audienceId") != null + && !jsonObj.get("audienceId").isJsonNull() + && !jsonObj.get("audienceId").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `audienceId` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("audienceId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("spaceId") != null + && !jsonObj.get("spaceId").isJsonNull() + && !jsonObj.get("spaceId").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `spaceId` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("spaceId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryOverviewDestinationFilterBy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryOverviewDestinationFilterBy' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeliveryOverviewDestinationFilterBy.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryOverviewDestinationFilterBy value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryOverviewDestinationFilterBy read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryOverviewDestinationFilterBy given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryOverviewDestinationFilterBy + * @throws IOException if the JSON string is invalid with respect to + * DeliveryOverviewDestinationFilterBy + */ + public static DeliveryOverviewDestinationFilterBy fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryOverviewDestinationFilterBy.class); + } + + /** + * Convert an instance of DeliveryOverviewDestinationFilterBy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDatapoint.java b/src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDatapoint.java new file mode 100644 index 00000000..abc510a2 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDatapoint.java @@ -0,0 +1,272 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Series within DeliveryOverviewMetricsDataset. */ +public class DeliveryOverviewMetricsDatapoint { + public static final String SERIALIZED_NAME_TIME = "time"; + + @SerializedName(SERIALIZED_NAME_TIME) + private String time; + + public static final String SERIALIZED_NAME_COUNT = "count"; + + @SerializedName(SERIALIZED_NAME_COUNT) + private BigDecimal count; + + public static final String SERIALIZED_NAME_RETRY_COUNT = "retryCount"; + + @SerializedName(SERIALIZED_NAME_RETRY_COUNT) + private BigDecimal retryCount; + + public DeliveryOverviewMetricsDatapoint() {} + + public DeliveryOverviewMetricsDatapoint time(String time) { + + this.time = time; + return this; + } + + /** + * The timestamp corresponding to the beginning of the window given by the requested + * granularity. + * + * @return time + */ + @javax.annotation.Nonnull + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public DeliveryOverviewMetricsDatapoint count(BigDecimal count) { + + this.count = count; + return this; + } + + /** + * Holds the number of events within the specified granularity and group By options. + * + * @return count + */ + @javax.annotation.Nonnull + public BigDecimal getCount() { + return count; + } + + public void setCount(BigDecimal count) { + this.count = count; + } + + public DeliveryOverviewMetricsDatapoint retryCount(BigDecimal retryCount) { + + this.retryCount = retryCount; + return this; + } + + /** + * The number of retried events that were successfully delivered. + * + * @return retryCount + */ + @javax.annotation.Nullable + public BigDecimal getRetryCount() { + return retryCount; + } + + public void setRetryCount(BigDecimal retryCount) { + this.retryCount = retryCount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryOverviewMetricsDatapoint deliveryOverviewMetricsDatapoint = + (DeliveryOverviewMetricsDatapoint) o; + return Objects.equals(this.time, deliveryOverviewMetricsDatapoint.time) + && Objects.equals(this.count, deliveryOverviewMetricsDatapoint.count) + && Objects.equals(this.retryCount, deliveryOverviewMetricsDatapoint.retryCount); + } + + @Override + public int hashCode() { + return Objects.hash(time, count, retryCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryOverviewMetricsDatapoint {\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" retryCount: ").append(toIndentedString(retryCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("time"); + openapiFields.add("count"); + openapiFields.add("retryCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("count"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DeliveryOverviewMetricsDatapoint + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryOverviewMetricsDatapoint.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeliveryOverviewMetricsDatapoint is" + + " not found in the empty JSON string", + DeliveryOverviewMetricsDatapoint.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryOverviewMetricsDatapoint.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeliveryOverviewMetricsDatapoint` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliveryOverviewMetricsDatapoint.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("time").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `time` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("time").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryOverviewMetricsDatapoint.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryOverviewMetricsDatapoint' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeliveryOverviewMetricsDatapoint.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryOverviewMetricsDatapoint value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryOverviewMetricsDatapoint read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryOverviewMetricsDatapoint given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryOverviewMetricsDatapoint + * @throws IOException if the JSON string is invalid with respect to + * DeliveryOverviewMetricsDatapoint + */ + public static DeliveryOverviewMetricsDatapoint fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryOverviewMetricsDatapoint.class); + } + + /** + * Convert an instance of DeliveryOverviewMetricsDatapoint to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDataset.java b/src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDataset.java new file mode 100644 index 00000000..dfdf38da --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeliveryOverviewMetricsDataset.java @@ -0,0 +1,439 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Dataset within GetDeliveryOverviewMetricsBetaOutput. */ +public class DeliveryOverviewMetricsDataset { + public static final String SERIALIZED_NAME_EVENT_NAME = "eventName"; + + @SerializedName(SERIALIZED_NAME_EVENT_NAME) + private String eventName; + + public static final String SERIALIZED_NAME_APP_VERSION = "appVersion"; + + @SerializedName(SERIALIZED_NAME_APP_VERSION) + private String appVersion; + + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_DISCARD_REASON = "discardReason"; + + @SerializedName(SERIALIZED_NAME_DISCARD_REASON) + private String discardReason; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + + @SerializedName(SERIALIZED_NAME_TOTAL) + private BigDecimal total; + + public static final String SERIALIZED_NAME_SERIES = "series"; + + @SerializedName(SERIALIZED_NAME_SERIES) + private List series = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TOTAL_RETRY_COUNT = "totalRetryCount"; + + @SerializedName(SERIALIZED_NAME_TOTAL_RETRY_COUNT) + private BigDecimal totalRetryCount; + + public DeliveryOverviewMetricsDataset() {} + + public DeliveryOverviewMetricsDataset eventName(String eventName) { + + this.eventName = eventName; + return this; + } + + /** + * The name of the event if group By[] included 'event Name' in the request. + * + * @return eventName + */ + @javax.annotation.Nullable + public String getEventName() { + return eventName; + } + + public void setEventName(String eventName) { + this.eventName = eventName; + } + + public DeliveryOverviewMetricsDataset appVersion(String appVersion) { + + this.appVersion = appVersion; + return this; + } + + /** + * The version of the app if group By[] included 'app Version' in the request. + * + * @return appVersion + */ + @javax.annotation.Nullable + public String getAppVersion() { + return appVersion; + } + + public void setAppVersion(String appVersion) { + this.appVersion = appVersion; + } + + public DeliveryOverviewMetricsDataset eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type if group By[] included 'event Type' in the request. + * + * @return eventType + */ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public DeliveryOverviewMetricsDataset discardReason(String discardReason) { + + this.discardReason = discardReason; + return this; + } + + /** + * The discard reason for dropped events if group By[] included 'discard Reason' in the + * request. + * + * @return discardReason + */ + @javax.annotation.Nullable + public String getDiscardReason() { + return discardReason; + } + + public void setDiscardReason(String discardReason) { + this.discardReason = discardReason; + } + + public DeliveryOverviewMetricsDataset total(BigDecimal total) { + + this.total = total; + return this; + } + + /** + * Holds the count of all event counts over the time frame of the series. + * + * @return total + */ + @javax.annotation.Nonnull + public BigDecimal getTotal() { + return total; + } + + public void setTotal(BigDecimal total) { + this.total = total; + } + + public DeliveryOverviewMetricsDataset series(List series) { + + this.series = series; + return this; + } + + public DeliveryOverviewMetricsDataset addSeriesItem( + DeliveryOverviewMetricsDatapoint seriesItem) { + if (this.series == null) { + this.series = new ArrayList<>(); + } + this.series.add(seriesItem); + return this; + } + + /** + * A list of the event counts broken down by the requested granularity, time frame, and group By + * options. + * + * @return series + */ + @javax.annotation.Nonnull + public List getSeries() { + return series; + } + + public void setSeries(List series) { + this.series = series; + } + + public DeliveryOverviewMetricsDataset totalRetryCount(BigDecimal totalRetryCount) { + + this.totalRetryCount = totalRetryCount; + return this; + } + + /** + * The number of events successfully delivered upon retry. + * + * @return totalRetryCount + */ + @javax.annotation.Nullable + public BigDecimal getTotalRetryCount() { + return totalRetryCount; + } + + public void setTotalRetryCount(BigDecimal totalRetryCount) { + this.totalRetryCount = totalRetryCount; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryOverviewMetricsDataset deliveryOverviewMetricsDataset = + (DeliveryOverviewMetricsDataset) o; + return Objects.equals(this.eventName, deliveryOverviewMetricsDataset.eventName) + && Objects.equals(this.appVersion, deliveryOverviewMetricsDataset.appVersion) + && Objects.equals(this.eventType, deliveryOverviewMetricsDataset.eventType) + && Objects.equals(this.discardReason, deliveryOverviewMetricsDataset.discardReason) + && Objects.equals(this.total, deliveryOverviewMetricsDataset.total) + && Objects.equals(this.series, deliveryOverviewMetricsDataset.series) + && Objects.equals( + this.totalRetryCount, deliveryOverviewMetricsDataset.totalRetryCount); + } + + @Override + public int hashCode() { + return Objects.hash( + eventName, appVersion, eventType, discardReason, total, series, totalRetryCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryOverviewMetricsDataset {\n"); + sb.append(" eventName: ").append(toIndentedString(eventName)).append("\n"); + sb.append(" appVersion: ").append(toIndentedString(appVersion)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" discardReason: ").append(toIndentedString(discardReason)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" series: ").append(toIndentedString(series)).append("\n"); + sb.append(" totalRetryCount: ").append(toIndentedString(totalRetryCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventName"); + openapiFields.add("appVersion"); + openapiFields.add("eventType"); + openapiFields.add("discardReason"); + openapiFields.add("total"); + openapiFields.add("series"); + openapiFields.add("totalRetryCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("series"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DeliveryOverviewMetricsDataset + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryOverviewMetricsDataset.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeliveryOverviewMetricsDataset is not" + + " found in the empty JSON string", + DeliveryOverviewMetricsDataset.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryOverviewMetricsDataset.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeliveryOverviewMetricsDataset` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliveryOverviewMetricsDataset.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("eventName") != null && !jsonObj.get("eventName").isJsonNull()) + && !jsonObj.get("eventName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("eventName").toString())); + } + if ((jsonObj.get("appVersion") != null && !jsonObj.get("appVersion").isJsonNull()) + && !jsonObj.get("appVersion").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `appVersion` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("appVersion").toString())); + } + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) + && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("discardReason") != null && !jsonObj.get("discardReason").isJsonNull()) + && !jsonObj.get("discardReason").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `discardReason` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("discardReason").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("series").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `series` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("series").toString())); + } + + JsonArray jsonArrayseries = jsonObj.getAsJsonArray("series"); + // validate the required field `series` (array) + for (int i = 0; i < jsonArrayseries.size(); i++) { + DeliveryOverviewMetricsDatapoint.validateJsonElement(jsonArrayseries.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryOverviewMetricsDataset.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryOverviewMetricsDataset' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeliveryOverviewMetricsDataset.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryOverviewMetricsDataset value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryOverviewMetricsDataset read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryOverviewMetricsDataset given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryOverviewMetricsDataset + * @throws IOException if the JSON string is invalid with respect to + * DeliveryOverviewMetricsDataset + */ + public static DeliveryOverviewMetricsDataset fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryOverviewMetricsDataset.class); + } + + /** + * Convert an instance of DeliveryOverviewMetricsDataset to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeliveryOverviewSourceFilterBy.java b/src/main/java/com/segment/publicapi/models/DeliveryOverviewSourceFilterBy.java new file mode 100644 index 00000000..46d0c5cd --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeliveryOverviewSourceFilterBy.java @@ -0,0 +1,359 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * The `DeliveryOverviewSourceFilterBy` object is a map of the filterable fields and their + * values. + */ +public class DeliveryOverviewSourceFilterBy { + public static final String SERIALIZED_NAME_DISCARD_REASON = "discardReason"; + + @SerializedName(SERIALIZED_NAME_DISCARD_REASON) + private List discardReason; + + public static final String SERIALIZED_NAME_EVENT_NAME = "eventName"; + + @SerializedName(SERIALIZED_NAME_EVENT_NAME) + private List eventName; + + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private List eventType; + + public static final String SERIALIZED_NAME_APP_VERSION = "appVersion"; + + @SerializedName(SERIALIZED_NAME_APP_VERSION) + private List appVersion; + + public DeliveryOverviewSourceFilterBy() {} + + public DeliveryOverviewSourceFilterBy discardReason(List discardReason) { + + this.discardReason = discardReason; + return this; + } + + public DeliveryOverviewSourceFilterBy addDiscardReasonItem(String discardReasonItem) { + if (this.discardReason == null) { + this.discardReason = new ArrayList<>(); + } + this.discardReason.add(discardReasonItem); + return this; + } + + /** + * A list of strings of discard reasons. See [Discard Record + * Documentation](https://segment.com/docs/connections/delivery-overview/#troubleshooting) for + * valid error codes. + * + * @return discardReason + */ + @javax.annotation.Nullable + public List getDiscardReason() { + return discardReason; + } + + public void setDiscardReason(List discardReason) { + this.discardReason = discardReason; + } + + public DeliveryOverviewSourceFilterBy eventName(List eventName) { + + this.eventName = eventName; + return this; + } + + public DeliveryOverviewSourceFilterBy addEventNameItem(String eventNameItem) { + if (this.eventName == null) { + this.eventName = new ArrayList<>(); + } + this.eventName.add(eventNameItem); + return this; + } + + /** + * A list of strings of event names. + * + * @return eventName + */ + @javax.annotation.Nullable + public List getEventName() { + return eventName; + } + + public void setEventName(List eventName) { + this.eventName = eventName; + } + + public DeliveryOverviewSourceFilterBy eventType(List eventType) { + + this.eventType = eventType; + return this; + } + + public DeliveryOverviewSourceFilterBy addEventTypeItem(String eventTypeItem) { + if (this.eventType == null) { + this.eventType = new ArrayList<>(); + } + this.eventType.add(eventTypeItem); + return this; + } + + /** + * A list of strings of event types. Valid options are: `alias`, `group`, + * `identify`, `page`, `screen`, and `track`. + * + * @return eventType + */ + @javax.annotation.Nullable + public List getEventType() { + return eventType; + } + + public void setEventType(List eventType) { + this.eventType = eventType; + } + + public DeliveryOverviewSourceFilterBy appVersion(List appVersion) { + + this.appVersion = appVersion; + return this; + } + + public DeliveryOverviewSourceFilterBy addAppVersionItem(String appVersionItem) { + if (this.appVersion == null) { + this.appVersion = new ArrayList<>(); + } + this.appVersion.add(appVersionItem); + return this; + } + + /** + * A list of strings of app versions. + * + * @return appVersion + */ + @javax.annotation.Nullable + public List getAppVersion() { + return appVersion; + } + + public void setAppVersion(List appVersion) { + this.appVersion = appVersion; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryOverviewSourceFilterBy deliveryOverviewSourceFilterBy = + (DeliveryOverviewSourceFilterBy) o; + return Objects.equals(this.discardReason, deliveryOverviewSourceFilterBy.discardReason) + && Objects.equals(this.eventName, deliveryOverviewSourceFilterBy.eventName) + && Objects.equals(this.eventType, deliveryOverviewSourceFilterBy.eventType) + && Objects.equals(this.appVersion, deliveryOverviewSourceFilterBy.appVersion); + } + + @Override + public int hashCode() { + return Objects.hash(discardReason, eventName, eventType, appVersion); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryOverviewSourceFilterBy {\n"); + sb.append(" discardReason: ").append(toIndentedString(discardReason)).append("\n"); + sb.append(" eventName: ").append(toIndentedString(eventName)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" appVersion: ").append(toIndentedString(appVersion)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("discardReason"); + openapiFields.add("eventName"); + openapiFields.add("eventType"); + openapiFields.add("appVersion"); + + // 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 + * DeliveryOverviewSourceFilterBy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryOverviewSourceFilterBy.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DeliveryOverviewSourceFilterBy is not" + + " found in the empty JSON string", + DeliveryOverviewSourceFilterBy.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryOverviewSourceFilterBy.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeliveryOverviewSourceFilterBy` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("discardReason") != null + && !jsonObj.get("discardReason").isJsonNull() + && !jsonObj.get("discardReason").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `discardReason` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("discardReason").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("eventName") != null + && !jsonObj.get("eventName").isJsonNull() + && !jsonObj.get("eventName").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventName` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("eventName").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("eventType") != null + && !jsonObj.get("eventType").isJsonNull() + && !jsonObj.get("eventType").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventType` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("eventType").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("appVersion") != null + && !jsonObj.get("appVersion").isJsonNull() + && !jsonObj.get("appVersion").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `appVersion` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("appVersion").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryOverviewSourceFilterBy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryOverviewSourceFilterBy' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeliveryOverviewSourceFilterBy.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryOverviewSourceFilterBy value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryOverviewSourceFilterBy read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryOverviewSourceFilterBy given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryOverviewSourceFilterBy + * @throws IOException if the JSON string is invalid with respect to + * DeliveryOverviewSourceFilterBy + */ + public static DeliveryOverviewSourceFilterBy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryOverviewSourceFilterBy.class); + } + + /** + * Convert an instance of DeliveryOverviewSourceFilterBy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DeliveryOverviewSuccessfullyReceivedFilterBy.java b/src/main/java/com/segment/publicapi/models/DeliveryOverviewSuccessfullyReceivedFilterBy.java new file mode 100644 index 00000000..62aefed9 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DeliveryOverviewSuccessfullyReceivedFilterBy.java @@ -0,0 +1,323 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * The `DeliveryOverviewSuccessfullyReceivedFilterBy` object is a map of the filterable + * fields and their values for the Successfully Received pipeline step. + */ +public class DeliveryOverviewSuccessfullyReceivedFilterBy { + public static final String SERIALIZED_NAME_EVENT_NAME = "eventName"; + + @SerializedName(SERIALIZED_NAME_EVENT_NAME) + private List eventName; + + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private List eventType; + + public static final String SERIALIZED_NAME_APP_VERSION = "appVersion"; + + @SerializedName(SERIALIZED_NAME_APP_VERSION) + private List appVersion; + + public DeliveryOverviewSuccessfullyReceivedFilterBy() {} + + public DeliveryOverviewSuccessfullyReceivedFilterBy eventName(List eventName) { + + this.eventName = eventName; + return this; + } + + public DeliveryOverviewSuccessfullyReceivedFilterBy addEventNameItem(String eventNameItem) { + if (this.eventName == null) { + this.eventName = new ArrayList<>(); + } + this.eventName.add(eventNameItem); + return this; + } + + /** + * A list of strings of event names. + * + * @return eventName + */ + @javax.annotation.Nullable + public List getEventName() { + return eventName; + } + + public void setEventName(List eventName) { + this.eventName = eventName; + } + + public DeliveryOverviewSuccessfullyReceivedFilterBy eventType(List eventType) { + + this.eventType = eventType; + return this; + } + + public DeliveryOverviewSuccessfullyReceivedFilterBy addEventTypeItem(String eventTypeItem) { + if (this.eventType == null) { + this.eventType = new ArrayList<>(); + } + this.eventType.add(eventTypeItem); + return this; + } + + /** + * A list of strings of event types. Valid options are: `alias`, `group`, + * `identify`, `page`, `screen`, and `track`. + * + * @return eventType + */ + @javax.annotation.Nullable + public List getEventType() { + return eventType; + } + + public void setEventType(List eventType) { + this.eventType = eventType; + } + + public DeliveryOverviewSuccessfullyReceivedFilterBy appVersion(List appVersion) { + + this.appVersion = appVersion; + return this; + } + + public DeliveryOverviewSuccessfullyReceivedFilterBy addAppVersionItem(String appVersionItem) { + if (this.appVersion == null) { + this.appVersion = new ArrayList<>(); + } + this.appVersion.add(appVersionItem); + return this; + } + + /** + * A list of strings of app versions. + * + * @return appVersion + */ + @javax.annotation.Nullable + public List getAppVersion() { + return appVersion; + } + + public void setAppVersion(List appVersion) { + this.appVersion = appVersion; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryOverviewSuccessfullyReceivedFilterBy deliveryOverviewSuccessfullyReceivedFilterBy = + (DeliveryOverviewSuccessfullyReceivedFilterBy) o; + return Objects.equals( + this.eventName, deliveryOverviewSuccessfullyReceivedFilterBy.eventName) + && Objects.equals( + this.eventType, deliveryOverviewSuccessfullyReceivedFilterBy.eventType) + && Objects.equals( + this.appVersion, deliveryOverviewSuccessfullyReceivedFilterBy.appVersion); + } + + @Override + public int hashCode() { + return Objects.hash(eventName, eventType, appVersion); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryOverviewSuccessfullyReceivedFilterBy {\n"); + sb.append(" eventName: ").append(toIndentedString(eventName)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" appVersion: ").append(toIndentedString(appVersion)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventName"); + openapiFields.add("eventType"); + openapiFields.add("appVersion"); + + // 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 + * DeliveryOverviewSuccessfullyReceivedFilterBy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryOverviewSuccessfullyReceivedFilterBy.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " DeliveryOverviewSuccessfullyReceivedFilterBy is not found" + + " in the empty JSON string", + DeliveryOverviewSuccessfullyReceivedFilterBy.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryOverviewSuccessfullyReceivedFilterBy.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DeliveryOverviewSuccessfullyReceivedFilterBy` properties." + + " JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("eventName") != null + && !jsonObj.get("eventName").isJsonNull() + && !jsonObj.get("eventName").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventName` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("eventName").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("eventType") != null + && !jsonObj.get("eventType").isJsonNull() + && !jsonObj.get("eventType").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventType` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("eventType").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("appVersion") != null + && !jsonObj.get("appVersion").isJsonNull() + && !jsonObj.get("appVersion").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `appVersion` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("appVersion").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryOverviewSuccessfullyReceivedFilterBy.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'DeliveryOverviewSuccessfullyReceivedFilterBy' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(DeliveryOverviewSuccessfullyReceivedFilterBy.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, DeliveryOverviewSuccessfullyReceivedFilterBy value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryOverviewSuccessfullyReceivedFilterBy read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryOverviewSuccessfullyReceivedFilterBy given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryOverviewSuccessfullyReceivedFilterBy + * @throws IOException if the JSON string is invalid with respect to + * DeliveryOverviewSuccessfullyReceivedFilterBy + */ + public static DeliveryOverviewSuccessfullyReceivedFilterBy fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, DeliveryOverviewSuccessfullyReceivedFilterBy.class); + } + + /** + * Convert an instance of DeliveryOverviewSuccessfullyReceivedFilterBy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Destination.java b/src/main/java/com/segment/publicapi/models/Destination.java deleted file mode 100644 index 1472c8e4..00000000 --- a/src/main/java/com/segment/publicapi/models/Destination.java +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Metadata; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.HashMap; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The Destination looked up. - */ -@ApiModel(description = "The Destination looked up.") - -public class Destination { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata metadata; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings = new HashMap<>(); - - public Destination() { - } - - public Destination id(String id) { - - this.id = id; - return this; - } - - /** - * The unique identifier of this instance of a Destination. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier of this instance of a Destination. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Destination name(String name) { - - this.name = name; - return this; - } - - /** - * The name of this instance of a Destination. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of this instance of a Destination. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Destination enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Whether this instance of a Destination receives data. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether this instance of a Destination receives data.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Destination metadata(Metadata metadata) { - - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Metadata getMetadata() { - return metadata; - } - - - public void setMetadata(Metadata metadata) { - this.metadata = metadata; - } - - - public Destination sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } - - /** - * The id of a Source connected to this instance of a Destination. Config API note: analogous to `parent`. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of a Source connected to this instance of a Destination. Config API note: analogous to `parent`.") - - public String getSourceId() { - return sourceId; - } - - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public Destination settings(Map settings) { - - this.settings = settings; - return this; - } - - public Destination putSettingsItem(String key, Object settingsItem) { - this.settings.put(key, settingsItem); - return this; - } - - /** - * The collection of settings associated with a Destination. Config API note: equal to `config`. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The collection of settings associated with a Destination. Config API note: equal to `config`.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Destination destination = (Destination) o; - return Objects.equals(this.id, destination.id) && - Objects.equals(this.name, destination.name) && - Objects.equals(this.enabled, destination.enabled) && - Objects.equals(this.metadata, destination.metadata) && - Objects.equals(this.sourceId, destination.sourceId) && - Objects.equals(this.settings, destination.settings); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, enabled, metadata, sourceId, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Destination {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("enabled"); - openapiFields.add("metadata"); - openapiFields.add("sourceId"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("settings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Destination - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Destination.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Destination is not found in the empty JSON string", Destination.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Destination.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Destination` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Destination.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Destination.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Destination' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Destination.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Destination value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Destination read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Destination given an JSON string - * - * @param jsonString JSON string - * @return An instance of Destination - * @throws IOException if the JSON string is invalid with respect to Destination - */ - public static Destination fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Destination.class); - } - - /** - * Convert an instance of Destination to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Destination1.java b/src/main/java/com/segment/publicapi/models/Destination1.java deleted file mode 100644 index 7f0e381f..00000000 --- a/src/main/java/com/segment/publicapi/models/Destination1.java +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Metadata; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.HashMap; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The updated Destination. - */ -@ApiModel(description = "The updated Destination.") - -public class Destination1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata metadata; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings = new HashMap<>(); - - public Destination1() { - } - - public Destination1 id(String id) { - - this.id = id; - return this; - } - - /** - * The unique identifier of this instance of a Destination. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier of this instance of a Destination. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Destination1 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of this instance of a Destination. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of this instance of a Destination. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Destination1 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Whether this instance of a Destination receives data. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether this instance of a Destination receives data.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Destination1 metadata(Metadata metadata) { - - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Metadata getMetadata() { - return metadata; - } - - - public void setMetadata(Metadata metadata) { - this.metadata = metadata; - } - - - public Destination1 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } - - /** - * The id of a Source connected to this instance of a Destination. Config API note: analogous to `parent`. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of a Source connected to this instance of a Destination. Config API note: analogous to `parent`.") - - public String getSourceId() { - return sourceId; - } - - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public Destination1 settings(Map settings) { - - this.settings = settings; - return this; - } - - public Destination1 putSettingsItem(String key, Object settingsItem) { - this.settings.put(key, settingsItem); - return this; - } - - /** - * The collection of settings associated with a Destination. Config API note: equal to `config`. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The collection of settings associated with a Destination. Config API note: equal to `config`.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Destination1 destination1 = (Destination1) o; - return Objects.equals(this.id, destination1.id) && - Objects.equals(this.name, destination1.name) && - Objects.equals(this.enabled, destination1.enabled) && - Objects.equals(this.metadata, destination1.metadata) && - Objects.equals(this.sourceId, destination1.sourceId) && - Objects.equals(this.settings, destination1.settings); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, enabled, metadata, sourceId, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Destination1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("enabled"); - openapiFields.add("metadata"); - openapiFields.add("sourceId"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("settings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Destination1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Destination1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Destination1 is not found in the empty JSON string", Destination1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Destination1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Destination1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Destination1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Destination1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Destination1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Destination1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Destination1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Destination1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Destination1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Destination1 - * @throws IOException if the JSON string is invalid with respect to Destination1 - */ - public static Destination1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Destination1.class); - } - - /** - * Convert an instance of Destination1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Destination2.java b/src/main/java/com/segment/publicapi/models/Destination2.java deleted file mode 100644 index ca1ec12f..00000000 --- a/src/main/java/com/segment/publicapi/models/Destination2.java +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Metadata; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.HashMap; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The created Destination. - */ -@ApiModel(description = "The created Destination.") - -public class Destination2 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata metadata; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings = new HashMap<>(); - - public Destination2() { - } - - public Destination2 id(String id) { - - this.id = id; - return this; - } - - /** - * The unique identifier of this instance of a Destination. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier of this instance of a Destination. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Destination2 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of this instance of a Destination. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of this instance of a Destination. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Destination2 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Whether this instance of a Destination receives data. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether this instance of a Destination receives data.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Destination2 metadata(Metadata metadata) { - - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Metadata getMetadata() { - return metadata; - } - - - public void setMetadata(Metadata metadata) { - this.metadata = metadata; - } - - - public Destination2 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } - - /** - * The id of a Source connected to this instance of a Destination. Config API note: analogous to `parent`. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of a Source connected to this instance of a Destination. Config API note: analogous to `parent`.") - - public String getSourceId() { - return sourceId; - } - - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public Destination2 settings(Map settings) { - - this.settings = settings; - return this; - } - - public Destination2 putSettingsItem(String key, Object settingsItem) { - this.settings.put(key, settingsItem); - return this; - } - - /** - * The collection of settings associated with a Destination. Config API note: equal to `config`. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The collection of settings associated with a Destination. Config API note: equal to `config`.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Destination2 destination2 = (Destination2) o; - return Objects.equals(this.id, destination2.id) && - Objects.equals(this.name, destination2.name) && - Objects.equals(this.enabled, destination2.enabled) && - Objects.equals(this.metadata, destination2.metadata) && - Objects.equals(this.sourceId, destination2.sourceId) && - Objects.equals(this.settings, destination2.settings); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, enabled, metadata, sourceId, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Destination2 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("enabled"); - openapiFields.add("metadata"); - openapiFields.add("sourceId"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("settings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Destination2 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Destination2.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Destination2 is not found in the empty JSON string", Destination2.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Destination2.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Destination2` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Destination2.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Destination2.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Destination2' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Destination2.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Destination2 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Destination2 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Destination2 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Destination2 - * @throws IOException if the JSON string is invalid with respect to Destination2 - */ - public static Destination2 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Destination2.class); - } - - /** - * Convert an instance of Destination2 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/DestinationFilterActionV1.java b/src/main/java/com/segment/publicapi/models/DestinationFilterActionV1.java index 0ab61c17..5f1797dc 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationFilterActionV1.java +++ b/src/main/java/com/segment/publicapi/models/DestinationFilterActionV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,363 +9,356 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; import java.util.HashMap; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Represents a Destination filter action. */ +public class DestinationFilterActionV1 { + /** The kind of Transformation to apply to any matched properties. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ALLOW_PROPERTIES("ALLOW_PROPERTIES"), -/** - * Represents a Destination filter action. - */ -@ApiModel(description = "Represents a Destination filter action.") + DROP("DROP"), -public class DestinationFilterActionV1 { - /** - * The kind of Transformation to apply to any matched properties. - */ - @JsonAdapter(TypeEnum.Adapter.class) - public enum TypeEnum { - ALLOW_PROPERTIES("ALLOW_PROPERTIES"), - - DROP("DROP"), - - DROP_PROPERTIES("DROP_PROPERTIES"), - - SAMPLE("SAMPLE"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } + DROP_PROPERTIES("DROP_PROPERTIES"), - public String getValue() { - return value; - } + SAMPLE("SAMPLE"); - @Override - public String toString() { - return String.valueOf(value); - } + private String value; - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; + TypeEnum(String value) { + this.value = value; } - } - 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 String getValue() { + return value; + } - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - private TypeEnum type; + @Override + public String toString() { + return String.valueOf(value); + } - public static final String SERIALIZED_NAME_FIELDS = "fields"; - @SerializedName(SERIALIZED_NAME_FIELDS) - private Map fields = null; + 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 final String SERIALIZED_NAME_PERCENT = "percent"; - @SerializedName(SERIALIZED_NAME_PERCENT) - private BigDecimal percent; + 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_PATH = "path"; - @SerializedName(SERIALIZED_NAME_PATH) - private String path; + public static final String SERIALIZED_NAME_TYPE = "type"; - public DestinationFilterActionV1() { - } + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; - public DestinationFilterActionV1 type(TypeEnum type) { - - this.type = type; - return this; - } + public static final String SERIALIZED_NAME_FIELDS = "fields"; - /** - * The kind of Transformation to apply to any matched properties. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The kind of Transformation to apply to any matched properties.") + @SerializedName(SERIALIZED_NAME_FIELDS) + private Map fields = new HashMap<>(); - public TypeEnum getType() { - return type; - } + public static final String SERIALIZED_NAME_PERCENT = "percent"; + @SerializedName(SERIALIZED_NAME_PERCENT) + private BigDecimal percent; - public void setType(TypeEnum type) { - this.type = type; - } + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + private String path; - public DestinationFilterActionV1 fields(Map fields) { - - this.fields = fields; - return this; - } + public DestinationFilterActionV1() {} - public DestinationFilterActionV1 putFieldsItem(String key, Object fieldsItem) { - if (this.fields == null) { - this.fields = new HashMap<>(); - } - this.fields.put(key, fieldsItem); - return this; - } + public DestinationFilterActionV1 type(TypeEnum type) { - /** - * A dictionary of paths to object keys that this filter applies to. The literal string '' represents the top level of the object. - * @return fields - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A dictionary of paths to object keys that this filter applies to. The literal string '' represents the top level of the object.") + this.type = type; + return this; + } - public Map getFields() { - return fields; - } + /** + * The kind of Transformation to apply to any matched properties. + * + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + public void setType(TypeEnum type) { + this.type = type; + } - public void setFields(Map fields) { - this.fields = fields; - } + public DestinationFilterActionV1 fields(Map fields) { + this.fields = fields; + return this; + } - public DestinationFilterActionV1 percent(BigDecimal percent) { - - this.percent = percent; - return this; - } + public DestinationFilterActionV1 putFieldsItem(String key, Object fieldsItem) { + if (this.fields == null) { + this.fields = new HashMap<>(); + } + this.fields.put(key, fieldsItem); + return this; + } - /** - * A decimal between 0 and 1 used for 'sample' type events and influences the likelihood of sampling to occur. - * @return percent - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A decimal between 0 and 1 used for 'sample' type events and influences the likelihood of sampling to occur.") + /** + * A dictionary of paths to object keys that this filter applies to. The literal string + * '' represents the top level of the object. + * + * @return fields + */ + @javax.annotation.Nullable + public Map getFields() { + return fields; + } - public BigDecimal getPercent() { - return percent; - } + public void setFields(Map fields) { + this.fields = fields; + } + public DestinationFilterActionV1 percent(BigDecimal percent) { - public void setPercent(BigDecimal percent) { - this.percent = percent; - } + this.percent = percent; + return this; + } + /** + * A decimal between 0 and 1 used for 'sample' type events and influences the likelihood + * of sampling to occur. + * + * @return percent + */ + @javax.annotation.Nullable + public BigDecimal getPercent() { + return percent; + } - public DestinationFilterActionV1 path(String path) { - - this.path = path; - return this; - } + public void setPercent(BigDecimal percent) { + this.percent = percent; + } - /** - * The JSON path to a property within a payload object from which Segment generates a deterministic sampling rate. - * @return path - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The JSON path to a property within a payload object from which Segment generates a deterministic sampling rate.") + public DestinationFilterActionV1 path(String path) { - public String getPath() { - return path; - } + this.path = path; + return this; + } + /** + * The JSON path to a property within a payload object from which Segment generates a + * deterministic sampling rate. + * + * @return path + */ + @javax.annotation.Nullable + public String getPath() { + return path; + } - public void setPath(String path) { - this.path = path; - } + public void setPath(String path) { + this.path = path; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationFilterActionV1 destinationFilterActionV1 = (DestinationFilterActionV1) o; + return Objects.equals(this.type, destinationFilterActionV1.type) + && Objects.equals(this.fields, destinationFilterActionV1.fields) + && Objects.equals(this.percent, destinationFilterActionV1.percent) + && Objects.equals(this.path, destinationFilterActionV1.path); + } + @Override + public int hashCode() { + return Objects.hash(type, fields, percent, path); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationFilterActionV1 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" percent: ").append(toIndentedString(percent)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DestinationFilterActionV1 destinationFilterActionV1 = (DestinationFilterActionV1) o; - return Objects.equals(this.type, destinationFilterActionV1.type) && - Objects.equals(this.fields, destinationFilterActionV1.fields) && - Objects.equals(this.percent, destinationFilterActionV1.percent) && - Objects.equals(this.path, destinationFilterActionV1.path); - } - - @Override - public int hashCode() { - return Objects.hash(type, fields, percent, path); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationFilterActionV1 {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); - sb.append(" percent: ").append(toIndentedString(percent)).append("\n"); - sb.append(" path: ").append(toIndentedString(path)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("fields"); + openapiFields.add("percent"); + openapiFields.add("path"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); } - return o.toString().replace("\n", "\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("fields"); - openapiFields.add("percent"); - openapiFields.add("path"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("type"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationFilterActionV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationFilterActionV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationFilterActionV1 is not found in the empty JSON string", DestinationFilterActionV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DestinationFilterActionV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationFilterActionV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationFilterActionV1 is not found" + + " in the empty JSON string", + DestinationFilterActionV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationFilterActionV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationFilterActionV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationFilterActionV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationFilterActionV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DestinationFilterActionV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationFilterActionV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("path") != null && !jsonObj.get("path").isJsonNull()) + && !jsonObj.get("path").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `path` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("path").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationFilterActionV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationFilterActionV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DestinationFilterActionV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationFilterActionV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationFilterActionV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("path") != null && !jsonObj.get("path").isJsonNull()) && !jsonObj.get("path").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationFilterActionV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationFilterActionV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationFilterActionV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationFilterActionV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationFilterActionV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DestinationFilterActionV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationFilterActionV1 - * @throws IOException if the JSON string is invalid with respect to DestinationFilterActionV1 - */ - public static DestinationFilterActionV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationFilterActionV1.class); - } - - /** - * Convert an instance of DestinationFilterActionV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of DestinationFilterActionV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationFilterActionV1 + * @throws IOException if the JSON string is invalid with respect to DestinationFilterActionV1 + */ + public static DestinationFilterActionV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationFilterActionV1.class); + } + + /** + * Convert an instance of DestinationFilterActionV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationFilterV1.java b/src/main/java/com/segment/publicapi/models/DestinationFilterV1.java index 75d014a3..bc9ac470 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationFilterV1.java +++ b/src/main/java/com/segment/publicapi/models/DestinationFilterV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,521 +9,545 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DestinationFilterActionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Represents a Destination filter. */ +public class DestinationFilterV1 { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * Represents a Destination filter. - */ -@ApiModel(description = "Represents a Destination filter.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class DestinationFilterV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; + + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; + + public static final String SERIALIZED_NAME_DESTINATION_ID = "destinationId"; + + @SerializedName(SERIALIZED_NAME_DESTINATION_ID) + private String destinationId; - public static final String SERIALIZED_NAME_DESTINATION_ID = "destinationId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_ID) - private String destinationId; + public static final String SERIALIZED_NAME_IF = "if"; - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; + @SerializedName(SERIALIZED_NAME_IF) + private String _if; - public static final String SERIALIZED_NAME_ACTIONS = "actions"; - @SerializedName(SERIALIZED_NAME_ACTIONS) - private List actions = new ArrayList<>(); + public static final String SERIALIZED_NAME_ACTIONS = "actions"; - public static final String SERIALIZED_NAME_TITLE = "title"; - @SerializedName(SERIALIZED_NAME_TITLE) - private String title; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + @SerializedName(SERIALIZED_NAME_ACTIONS) + private List actions = new ArrayList<>(); - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; + public static final String SERIALIZED_NAME_TITLE = "title"; - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private String updatedAt; + @SerializedName(SERIALIZED_NAME_TITLE) + private String title; - public DestinationFilterV1() { - } + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - public DestinationFilterV1 id(String id) { - - this.id = id; - return this; - } + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - /** - * The unique id of this filter. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique id of this filter.") - - public String getId() { - return id; - } + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public void setId(String id) { - this.id = id; - } + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; - public DestinationFilterV1 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - /** - * The id of the Source associated with this filter. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source associated with this filter.") + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private String updatedAt; - public String getSourceId() { - return sourceId; - } + public DestinationFilterV1() {} + public DestinationFilterV1 id(String id) { + + this.id = id; + return this; + } + + /** + * The unique id of this filter. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public DestinationFilterV1 sourceId(String sourceId) { + + this.sourceId = sourceId; + return this; + } + + /** + * The id of the Source associated with this filter. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public DestinationFilterV1 destinationId(String destinationId) { + + this.destinationId = destinationId; + return this; + } + + /** + * The id of the Destination associated with this filter. + * + * @return destinationId + */ + @javax.annotation.Nonnull + public String getDestinationId() { + return destinationId; + } + + public void setDestinationId(String destinationId) { + this.destinationId = destinationId; + } + + public DestinationFilterV1 _if(String _if) { + + this._if = _if; + return this; + } + + /** + * A condition that defines whether to apply this filter to a payload. + * + * @return _if + */ + @javax.annotation.Nonnull + public String getIf() { + return _if; + } - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + public void setIf(String _if) { + this._if = _if; + } + public DestinationFilterV1 actions(List actions) { - public DestinationFilterV1 destinationId(String destinationId) { - - this.destinationId = destinationId; - return this; - } + this.actions = actions; + return this; + } - /** - * The id of the Destination associated with this filter. - * @return destinationId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Destination associated with this filter.") + public DestinationFilterV1 addActionsItem(DestinationFilterActionV1 actionsItem) { + if (this.actions == null) { + this.actions = new ArrayList<>(); + } + this.actions.add(actionsItem); + return this; + } - public String getDestinationId() { - return destinationId; - } + /** + * A list of actions this filter performs. + * + * @return actions + */ + @javax.annotation.Nonnull + public List getActions() { + return actions; + } + public void setActions(List actions) { + this.actions = actions; + } - public void setDestinationId(String destinationId) { - this.destinationId = destinationId; - } + public DestinationFilterV1 title(String title) { + this.title = title; + return this; + } - public DestinationFilterV1 _if(String _if) { - - this._if = _if; - return this; - } + /** + * A title for this filter. + * + * @return title + */ + @javax.annotation.Nonnull + public String getTitle() { + return title; + } - /** - * A condition that defines whether to apply this filter to a payload. - * @return _if - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A condition that defines whether to apply this filter to a payload.") + public void setTitle(String title) { + this.title = title; + } - public String getIf() { - return _if; - } + public DestinationFilterV1 description(String description) { + this.description = description; + return this; + } - public void setIf(String _if) { - this._if = _if; - } + /** + * A description for this filter. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } - public DestinationFilterV1 actions(List actions) { - - this.actions = actions; - return this; - } + public DestinationFilterV1 enabled(Boolean enabled) { - public DestinationFilterV1 addActionsItem(DestinationFilterActionV1 actionsItem) { - this.actions.add(actionsItem); - return this; - } + this.enabled = enabled; + return this; + } - /** - * A list of actions this filter performs. - * @return actions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of actions this filter performs.") + /** + * When set to true, this filter is active. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } - public List getActions() { - return actions; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + public DestinationFilterV1 createdAt(String createdAt) { - public void setActions(List actions) { - this.actions = actions; - } + this.createdAt = createdAt; + return this; + } + /** + * The timestamp of this filter's creation. + * + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } - public DestinationFilterV1 title(String title) { - - this.title = title; - return this; - } + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } - /** - * A title for this filter. - * @return title - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A title for this filter.") + public DestinationFilterV1 updatedAt(String updatedAt) { - public String getTitle() { - return title; - } + this.updatedAt = updatedAt; + return this; + } + /** + * The timestamp of this filter's last change. + * + * @return updatedAt + */ + @javax.annotation.Nonnull + public String getUpdatedAt() { + return updatedAt; + } - public void setTitle(String title) { - this.title = title; - } + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationFilterV1 destinationFilterV1 = (DestinationFilterV1) o; + return Objects.equals(this.id, destinationFilterV1.id) + && Objects.equals(this.sourceId, destinationFilterV1.sourceId) + && Objects.equals(this.destinationId, destinationFilterV1.destinationId) + && Objects.equals(this._if, destinationFilterV1._if) + && Objects.equals(this.actions, destinationFilterV1.actions) + && Objects.equals(this.title, destinationFilterV1.title) + && Objects.equals(this.description, destinationFilterV1.description) + && Objects.equals(this.enabled, destinationFilterV1.enabled) + && Objects.equals(this.createdAt, destinationFilterV1.createdAt) + && Objects.equals(this.updatedAt, destinationFilterV1.updatedAt); + } - public DestinationFilterV1 description(String description) { - - this.description = description; - return this; - } + @Override + public int hashCode() { + return Objects.hash( + id, + sourceId, + destinationId, + _if, + actions, + title, + description, + enabled, + createdAt, + updatedAt); + } - /** - * A description for this filter. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A description for this filter.") + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationFilterV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" destinationId: ").append(toIndentedString(destinationId)).append("\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public String getDescription() { - return description; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("sourceId"); + openapiFields.add("destinationId"); + openapiFields.add("if"); + openapiFields.add("actions"); + openapiFields.add("title"); + openapiFields.add("description"); + openapiFields.add("enabled"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("destinationId"); + openapiRequiredFields.add("if"); + openapiRequiredFields.add("actions"); + openapiRequiredFields.add("title"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + } - public void setDescription(String description) { - this.description = 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 DestinationFilterV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationFilterV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationFilterV1 is not found in" + + " the empty JSON string", + DestinationFilterV1.openapiRequiredFields.toString())); + } + } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationFilterV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationFilterV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } - public DestinationFilterV1 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * When set to true, this filter is active. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "When set to true, this filter is active.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public DestinationFilterV1 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } - - /** - * The timestamp of this filter's creation. - * @return createdAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The timestamp of this filter's creation.") - - public String getCreatedAt() { - return createdAt; - } - - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - - public DestinationFilterV1 updatedAt(String updatedAt) { - - this.updatedAt = updatedAt; - return this; - } - - /** - * The timestamp of this filter's last change. - * @return updatedAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The timestamp of this filter's last change.") - - public String getUpdatedAt() { - return updatedAt; - } - - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DestinationFilterV1 destinationFilterV1 = (DestinationFilterV1) o; - return Objects.equals(this.id, destinationFilterV1.id) && - Objects.equals(this.sourceId, destinationFilterV1.sourceId) && - Objects.equals(this.destinationId, destinationFilterV1.destinationId) && - Objects.equals(this._if, destinationFilterV1._if) && - Objects.equals(this.actions, destinationFilterV1.actions) && - Objects.equals(this.title, destinationFilterV1.title) && - Objects.equals(this.description, destinationFilterV1.description) && - Objects.equals(this.enabled, destinationFilterV1.enabled) && - Objects.equals(this.createdAt, destinationFilterV1.createdAt) && - Objects.equals(this.updatedAt, destinationFilterV1.updatedAt); - } - - @Override - public int hashCode() { - return Objects.hash(id, sourceId, destinationId, _if, actions, title, description, enabled, createdAt, updatedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationFilterV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" destinationId: ").append(toIndentedString(destinationId)).append("\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); - sb.append(" title: ").append(toIndentedString(title)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).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("id"); - openapiFields.add("sourceId"); - openapiFields.add("destinationId"); - openapiFields.add("if"); - openapiFields.add("actions"); - openapiFields.add("title"); - openapiFields.add("description"); - openapiFields.add("enabled"); - openapiFields.add("createdAt"); - openapiFields.add("updatedAt"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("destinationId"); - openapiRequiredFields.add("if"); - openapiRequiredFields.add("actions"); - openapiRequiredFields.add("title"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("createdAt"); - openapiRequiredFields.add("updatedAt"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationFilterV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationFilterV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationFilterV1 is not found in the empty JSON string", DestinationFilterV1.openapiRequiredFields.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationFilterV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if (!jsonObj.get("destinationId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `destinationId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("destinationId").toString())); + } + if (!jsonObj.get("if").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `if` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("if").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("actions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `actions` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("actions").toString())); } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationFilterV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationFilterV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); + // validate the required field `actions` (array) + for (int i = 0; i < jsonArrayactions.size(); i++) { + DestinationFilterActionV1.validateJsonElement(jsonArrayactions.get(i)); } - } + ; + if (!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("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("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdAt").toString())); + } + if (!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())); + } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DestinationFilterV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationFilterV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationFilterV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DestinationFilterV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationFilterV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationFilterV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("destinationId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationId").toString())); - } - if (!jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("actions").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `actions` to be an array in the JSON string but got `%s`", jsonObj.get("actions").toString())); - } - - JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); - if (!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("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("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - if (!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())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationFilterV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationFilterV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationFilterV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationFilterV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationFilterV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of DestinationFilterV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationFilterV1 - * @throws IOException if the JSON string is invalid with respect to DestinationFilterV1 - */ - public static DestinationFilterV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationFilterV1.class); - } - - /** - * Convert an instance of DestinationFilterV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + } + + /** + * Create an instance of DestinationFilterV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationFilterV1 + * @throws IOException if the JSON string is invalid with respect to DestinationFilterV1 + */ + public static DestinationFilterV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationFilterV1.class); + } + /** + * Convert an instance of DestinationFilterV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationInput.java b/src/main/java/com/segment/publicapi/models/DestinationInput.java new file mode 100644 index 00000000..22419f6b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/DestinationInput.java @@ -0,0 +1,243 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** The Destination Input Object. */ +public class DestinationInput { + 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 DestinationInput() {} + + public DestinationInput id(String id) { + + this.id = id; + return this; + } + + /** + * The Destination instance id. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public DestinationInput type(String type) { + + this.type = type; + return this; + } + + /** + * Type of Destination to add to the audience. + * + * @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; + } + DestinationInput destinationInput = (DestinationInput) o; + return Objects.equals(this.id, destinationInput.id) + && Objects.equals(this.type, destinationInput.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationInput {\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 DestinationInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationInput is not found in the" + + " empty JSON string", + DestinationInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!DestinationInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DestinationInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DestinationInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationInput + * @throws IOException if the JSON string is invalid with respect to DestinationInput + */ + public static DestinationInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationInput.class); + } + + /** + * Convert an instance of DestinationInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationMetadata.java b/src/main/java/com/segment/publicapi/models/DestinationMetadata.java deleted file mode 100644 index c4641dcb..00000000 --- a/src/main/java/com/segment/publicapi/models/DestinationMetadata.java +++ /dev/null @@ -1,908 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Contact; -import com.segment.publicapi.models.DestinationMetadataActionV1; -import com.segment.publicapi.models.DestinationMetadataComponentV1; -import com.segment.publicapi.models.DestinationMetadataSubscriptionPresetV1; -import com.segment.publicapi.models.IntegrationOptionBeta; -import com.segment.publicapi.models.Logos; -import com.segment.publicapi.models.SupportedFeatures; -import com.segment.publicapi.models.SupportedMethods; -import com.segment.publicapi.models.SupportedPlatforms; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The catalog item matched by id. - */ -@ApiModel(description = "The catalog item matched by id.") - -public class DestinationMetadata { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_LOGOS = "logos"; - @SerializedName(SERIALIZED_NAME_LOGOS) - private Logos logos; - - public static final String SERIALIZED_NAME_OPTIONS = "options"; - @SerializedName(SERIALIZED_NAME_OPTIONS) - private List options = new ArrayList<>(); - - /** - * Support status of the Destination. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - DEPRECATED("DEPRECATED"), - - PRIVATE_BETA("PRIVATE_BETA"), - - PRIVATE_BUILDING("PRIVATE_BUILDING"), - - PRIVATE_SUBMITTED("PRIVATE_SUBMITTED"), - - PUBLIC("PUBLIC"), - - PUBLIC_BETA("PUBLIC_BETA"), - - UNAVAILABLE("UNAVAILABLE"); - - 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_PREVIOUS_NAMES = "previousNames"; - @SerializedName(SERIALIZED_NAME_PREVIOUS_NAMES) - private List previousNames = new ArrayList<>(); - - public static final String SERIALIZED_NAME_CATEGORIES = "categories"; - @SerializedName(SERIALIZED_NAME_CATEGORIES) - private List categories = new ArrayList<>(); - - public static final String SERIALIZED_NAME_WEBSITE = "website"; - @SerializedName(SERIALIZED_NAME_WEBSITE) - private String website; - - public static final String SERIALIZED_NAME_COMPONENTS = "components"; - @SerializedName(SERIALIZED_NAME_COMPONENTS) - private List components = new ArrayList<>(); - - public static final String SERIALIZED_NAME_SUPPORTED_FEATURES = "supportedFeatures"; - @SerializedName(SERIALIZED_NAME_SUPPORTED_FEATURES) - private SupportedFeatures supportedFeatures; - - public static final String SERIALIZED_NAME_SUPPORTED_METHODS = "supportedMethods"; - @SerializedName(SERIALIZED_NAME_SUPPORTED_METHODS) - private SupportedMethods supportedMethods; - - public static final String SERIALIZED_NAME_SUPPORTED_PLATFORMS = "supportedPlatforms"; - @SerializedName(SERIALIZED_NAME_SUPPORTED_PLATFORMS) - private SupportedPlatforms supportedPlatforms; - - public static final String SERIALIZED_NAME_ACTIONS = "actions"; - @SerializedName(SERIALIZED_NAME_ACTIONS) - private List actions = new ArrayList<>(); - - public static final String SERIALIZED_NAME_PRESETS = "presets"; - @SerializedName(SERIALIZED_NAME_PRESETS) - private List presets = new ArrayList<>(); - - public static final String SERIALIZED_NAME_CONTACTS = "contacts"; - @SerializedName(SERIALIZED_NAME_CONTACTS) - private List contacts = null; - - public static final String SERIALIZED_NAME_PARTNER_OWNED = "partnerOwned"; - @SerializedName(SERIALIZED_NAME_PARTNER_OWNED) - private Boolean partnerOwned; - - public DestinationMetadata() { - } - - public DestinationMetadata id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Destination metadata. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Destination metadata. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public DestinationMetadata name(String name) { - - this.name = name; - return this; - } - - /** - * The user-friendly name of the Destination. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The user-friendly name of the Destination. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public DestinationMetadata description(String description) { - - this.description = description; - return this; - } - - /** - * The description of the Destination. - * @return description - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The description of the Destination.") - - public String getDescription() { - return description; - } - - - public void setDescription(String description) { - this.description = description; - } - - - public DestinationMetadata slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * The slug used to identify the Destination in the Segment app. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug used to identify the Destination in the Segment app.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - public DestinationMetadata logos(Logos logos) { - - this.logos = logos; - return this; - } - - /** - * Get logos - * @return logos - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Logos getLogos() { - return logos; - } - - - public void setLogos(Logos logos) { - this.logos = logos; - } - - - public DestinationMetadata options(List options) { - - this.options = options; - return this; - } - - public DestinationMetadata addOptionsItem(IntegrationOptionBeta optionsItem) { - this.options.add(optionsItem); - return this; - } - - /** - * Options configured for the Destination. - * @return options - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Options configured for the Destination.") - - public List getOptions() { - return options; - } - - - public void setOptions(List options) { - this.options = options; - } - - - public DestinationMetadata status(StatusEnum status) { - - this.status = status; - return this; - } - - /** - * Support status of the Destination. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Support status of the Destination.") - - public StatusEnum getStatus() { - return status; - } - - - public void setStatus(StatusEnum status) { - this.status = status; - } - - - public DestinationMetadata previousNames(List previousNames) { - - this.previousNames = previousNames; - return this; - } - - public DestinationMetadata addPreviousNamesItem(String previousNamesItem) { - this.previousNames.add(previousNamesItem); - return this; - } - - /** - * A list of names previously used by the Destination. - * @return previousNames - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of names previously used by the Destination.") - - public List getPreviousNames() { - return previousNames; - } - - - public void setPreviousNames(List previousNames) { - this.previousNames = previousNames; - } - - - public DestinationMetadata categories(List categories) { - - this.categories = categories; - return this; - } - - public DestinationMetadata addCategoriesItem(String categoriesItem) { - this.categories.add(categoriesItem); - return this; - } - - /** - * A list of categories with which the Destination is associated. - * @return categories - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of categories with which the Destination is associated.") - - public List getCategories() { - return categories; - } - - - public void setCategories(List categories) { - this.categories = categories; - } - - - public DestinationMetadata website(String website) { - - this.website = website; - return this; - } - - /** - * A website URL for this Destination. - * @return website - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A website URL for this Destination.") - - public String getWebsite() { - return website; - } - - - public void setWebsite(String website) { - this.website = website; - } - - - public DestinationMetadata components(List components) { - - this.components = components; - return this; - } - - public DestinationMetadata addComponentsItem(DestinationMetadataComponentV1 componentsItem) { - this.components.add(componentsItem); - return this; - } - - /** - * A list of components this Destination provides. - * @return components - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of components this Destination provides.") - - public List getComponents() { - return components; - } - - - public void setComponents(List components) { - this.components = components; - } - - - public DestinationMetadata supportedFeatures(SupportedFeatures supportedFeatures) { - - this.supportedFeatures = supportedFeatures; - return this; - } - - /** - * Get supportedFeatures - * @return supportedFeatures - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public SupportedFeatures getSupportedFeatures() { - return supportedFeatures; - } - - - public void setSupportedFeatures(SupportedFeatures supportedFeatures) { - this.supportedFeatures = supportedFeatures; - } - - - public DestinationMetadata supportedMethods(SupportedMethods supportedMethods) { - - this.supportedMethods = supportedMethods; - return this; - } - - /** - * Get supportedMethods - * @return supportedMethods - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public SupportedMethods getSupportedMethods() { - return supportedMethods; - } - - - public void setSupportedMethods(SupportedMethods supportedMethods) { - this.supportedMethods = supportedMethods; - } - - - public DestinationMetadata supportedPlatforms(SupportedPlatforms supportedPlatforms) { - - this.supportedPlatforms = supportedPlatforms; - return this; - } - - /** - * Get supportedPlatforms - * @return supportedPlatforms - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public SupportedPlatforms getSupportedPlatforms() { - return supportedPlatforms; - } - - - public void setSupportedPlatforms(SupportedPlatforms supportedPlatforms) { - this.supportedPlatforms = supportedPlatforms; - } - - - public DestinationMetadata actions(List actions) { - - this.actions = actions; - return this; - } - - public DestinationMetadata addActionsItem(DestinationMetadataActionV1 actionsItem) { - this.actions.add(actionsItem); - return this; - } - - /** - * Actions available for the Destination. - * @return actions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Actions available for the Destination.") - - public List getActions() { - return actions; - } - - - public void setActions(List actions) { - this.actions = actions; - } - - - public DestinationMetadata presets(List presets) { - - this.presets = presets; - return this; - } - - public DestinationMetadata addPresetsItem(DestinationMetadataSubscriptionPresetV1 presetsItem) { - this.presets.add(presetsItem); - return this; - } - - /** - * Predefined Destination subscriptions that can optionally be applied when connecting a new instance of the Destination. - * @return presets - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Predefined Destination subscriptions that can optionally be applied when connecting a new instance of the Destination.") - - public List getPresets() { - return presets; - } - - - public void setPresets(List presets) { - this.presets = presets; - } - - - public DestinationMetadata contacts(List contacts) { - - this.contacts = contacts; - return this; - } - - public DestinationMetadata addContactsItem(Contact contactsItem) { - if (this.contacts == null) { - this.contacts = new ArrayList<>(); - } - this.contacts.add(contactsItem); - return this; - } - - /** - * Contact info for Integration Owners. - * @return contacts - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Contact info for Integration Owners.") - - public List getContacts() { - return contacts; - } - - - public void setContacts(List contacts) { - this.contacts = contacts; - } - - - public DestinationMetadata partnerOwned(Boolean partnerOwned) { - - this.partnerOwned = partnerOwned; - return this; - } - - /** - * Partner Owned flag. - * @return partnerOwned - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Partner Owned flag.") - - public Boolean getPartnerOwned() { - return partnerOwned; - } - - - public void setPartnerOwned(Boolean partnerOwned) { - this.partnerOwned = partnerOwned; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DestinationMetadata destinationMetadata = (DestinationMetadata) o; - return Objects.equals(this.id, destinationMetadata.id) && - Objects.equals(this.name, destinationMetadata.name) && - Objects.equals(this.description, destinationMetadata.description) && - Objects.equals(this.slug, destinationMetadata.slug) && - Objects.equals(this.logos, destinationMetadata.logos) && - Objects.equals(this.options, destinationMetadata.options) && - Objects.equals(this.status, destinationMetadata.status) && - Objects.equals(this.previousNames, destinationMetadata.previousNames) && - Objects.equals(this.categories, destinationMetadata.categories) && - Objects.equals(this.website, destinationMetadata.website) && - Objects.equals(this.components, destinationMetadata.components) && - Objects.equals(this.supportedFeatures, destinationMetadata.supportedFeatures) && - Objects.equals(this.supportedMethods, destinationMetadata.supportedMethods) && - Objects.equals(this.supportedPlatforms, destinationMetadata.supportedPlatforms) && - Objects.equals(this.actions, destinationMetadata.actions) && - Objects.equals(this.presets, destinationMetadata.presets) && - Objects.equals(this.contacts, destinationMetadata.contacts) && - Objects.equals(this.partnerOwned, destinationMetadata.partnerOwned); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, description, slug, logos, options, status, previousNames, categories, website, components, supportedFeatures, supportedMethods, supportedPlatforms, actions, presets, contacts, partnerOwned); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationMetadata {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" logos: ").append(toIndentedString(logos)).append("\n"); - sb.append(" options: ").append(toIndentedString(options)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" previousNames: ").append(toIndentedString(previousNames)).append("\n"); - sb.append(" categories: ").append(toIndentedString(categories)).append("\n"); - sb.append(" website: ").append(toIndentedString(website)).append("\n"); - sb.append(" components: ").append(toIndentedString(components)).append("\n"); - sb.append(" supportedFeatures: ").append(toIndentedString(supportedFeatures)).append("\n"); - sb.append(" supportedMethods: ").append(toIndentedString(supportedMethods)).append("\n"); - sb.append(" supportedPlatforms: ").append(toIndentedString(supportedPlatforms)).append("\n"); - sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); - sb.append(" presets: ").append(toIndentedString(presets)).append("\n"); - sb.append(" contacts: ").append(toIndentedString(contacts)).append("\n"); - sb.append(" partnerOwned: ").append(toIndentedString(partnerOwned)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("description"); - openapiFields.add("slug"); - openapiFields.add("logos"); - openapiFields.add("options"); - openapiFields.add("status"); - openapiFields.add("previousNames"); - openapiFields.add("categories"); - openapiFields.add("website"); - openapiFields.add("components"); - openapiFields.add("supportedFeatures"); - openapiFields.add("supportedMethods"); - openapiFields.add("supportedPlatforms"); - openapiFields.add("actions"); - openapiFields.add("presets"); - openapiFields.add("contacts"); - openapiFields.add("partnerOwned"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("description"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("logos"); - openapiRequiredFields.add("options"); - openapiRequiredFields.add("status"); - openapiRequiredFields.add("previousNames"); - openapiRequiredFields.add("categories"); - openapiRequiredFields.add("website"); - openapiRequiredFields.add("components"); - openapiRequiredFields.add("supportedFeatures"); - openapiRequiredFields.add("supportedMethods"); - openapiRequiredFields.add("supportedPlatforms"); - openapiRequiredFields.add("actions"); - openapiRequiredFields.add("presets"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationMetadata - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationMetadata is not found in the empty JSON string", DestinationMetadata.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationMetadata.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationMetadata` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DestinationMetadata.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("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("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("options").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `options` to be an array in the JSON string but got `%s`", jsonObj.get("options").toString())); - } - - JsonArray jsonArrayoptions = jsonObj.getAsJsonArray("options"); - 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())); - } - // ensure the required json array is present - if (jsonObj.get("previousNames") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("previousNames").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `previousNames` to be an array in the JSON string but got `%s`", jsonObj.get("previousNames").toString())); - } - // ensure the required json array is present - if (jsonObj.get("categories") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("categories").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `categories` to be an array in the JSON string but got `%s`", jsonObj.get("categories").toString())); - } - if (!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("components").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `components` to be an array in the JSON string but got `%s`", jsonObj.get("components").toString())); - } - - JsonArray jsonArraycomponents = jsonObj.getAsJsonArray("components"); - // ensure the json data is an array - if (!jsonObj.get("actions").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `actions` to be an array in the JSON string but got `%s`", jsonObj.get("actions").toString())); - } - - JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); - // ensure the json data is an array - if (!jsonObj.get("presets").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `presets` to be an array in the JSON string but got `%s`", jsonObj.get("presets").toString())); - } - - JsonArray jsonArraypresets = jsonObj.getAsJsonArray("presets"); - if (jsonObj.get("contacts") != null && !jsonObj.get("contacts").isJsonNull()) { - JsonArray jsonArraycontacts = jsonObj.getAsJsonArray("contacts"); - if (jsonArraycontacts != null) { - // ensure the json data is an array - if (!jsonObj.get("contacts").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `contacts` to be an array in the JSON string but got `%s`", jsonObj.get("contacts").toString())); - } - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationMetadata.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationMetadata' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationMetadata.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationMetadata value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationMetadata read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of DestinationMetadata given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationMetadata - * @throws IOException if the JSON string is invalid with respect to DestinationMetadata - */ - public static DestinationMetadata fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationMetadata.class); - } - - /** - * Convert an instance of DestinationMetadata to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/DestinationMetadataActionFieldV1.java b/src/main/java/com/segment/publicapi/models/DestinationMetadataActionFieldV1.java index 2ac0e45c..2fb18617 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationMetadataActionFieldV1.java +++ b/src/main/java/com/segment/publicapi/models/DestinationMetadataActionFieldV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,666 +9,711 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; -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 java.lang.reflect.Type; -import java.util.HashMap; +import java.util.Arrays; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; +import org.openapitools.jackson.nullable.JsonNullable; -import com.segment.publicapi.JSON; +/** Represents a field used in configuring an action. */ +public class DestinationMetadataActionFieldV1 { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * Represents a field used in configuring an action. - */ -@ApiModel(description = "Represents a field used in configuring an action.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class DestinationMetadataActionFieldV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SORT_ORDER = "sortOrder"; - @SerializedName(SERIALIZED_NAME_SORT_ORDER) - private BigDecimal sortOrder; - - public static final String SERIALIZED_NAME_FIELD_KEY = "fieldKey"; - @SerializedName(SERIALIZED_NAME_FIELD_KEY) - private String fieldKey; - - public static final String SERIALIZED_NAME_LABEL = "label"; - @SerializedName(SERIALIZED_NAME_LABEL) - private String label; - - /** - * The data type for this value. - */ - @JsonAdapter(TypeEnum.Adapter.class) - public enum TypeEnum { - BOOLEAN("BOOLEAN"), - - DATETIME("DATETIME"), - - HIDDEN("HIDDEN"), - - INTEGER("INTEGER"), - - NUMBER("NUMBER"), - - OBJECT("OBJECT"), - - PASSWORD("PASSWORD"), - - STRING("STRING"), - - TEXT("TEXT"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } + public static final String SERIALIZED_NAME_SORT_ORDER = "sortOrder"; - @Override - public String toString() { - return String.valueOf(value); - } + @SerializedName(SERIALIZED_NAME_SORT_ORDER) + private BigDecimal sortOrder; + + public static final String SERIALIZED_NAME_FIELD_KEY = "fieldKey"; + + @SerializedName(SERIALIZED_NAME_FIELD_KEY) + private String fieldKey; + + public static final String SERIALIZED_NAME_LABEL = "label"; + + @SerializedName(SERIALIZED_NAME_LABEL) + private String label; + + /** The data type for this value. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BOOLEAN("BOOLEAN"), + + DATETIME("DATETIME"), - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; + HIDDEN("HIDDEN"), + + INTEGER("INTEGER"), + + NUMBER("NUMBER"), + + OBJECT("OBJECT"), + + PASSWORD("PASSWORD"), + + STRING("STRING"), + + TEXT("TEXT"); + + private String value; + + TypeEnum(String value) { + this.value = value; } - } - 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()); - } + 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 + "'"); + } - @Override - public TypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return TypeEnum.fromValue(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_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - public static final String SERIALIZED_NAME_PLACEHOLDER = "placeholder"; - @SerializedName(SERIALIZED_NAME_PLACEHOLDER) - private String placeholder; + public static final String SERIALIZED_NAME_PLACEHOLDER = "placeholder"; - public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; - @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) - private Object defaultValue = null; + @SerializedName(SERIALIZED_NAME_PLACEHOLDER) + private String placeholder; - public static final String SERIALIZED_NAME_REQUIRED = "required"; - @SerializedName(SERIALIZED_NAME_REQUIRED) - private Boolean required; + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; - public static final String SERIALIZED_NAME_MULTIPLE = "multiple"; - @SerializedName(SERIALIZED_NAME_MULTIPLE) - private Boolean multiple; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private Object defaultValue = null; - public static final String SERIALIZED_NAME_CHOICES = "choices"; - @SerializedName(SERIALIZED_NAME_CHOICES) - private Object choices = null; + public static final String SERIALIZED_NAME_REQUIRED = "required"; - public static final String SERIALIZED_NAME_DYNAMIC = "dynamic"; - @SerializedName(SERIALIZED_NAME_DYNAMIC) - private Boolean dynamic; + @SerializedName(SERIALIZED_NAME_REQUIRED) + private Boolean required; - public static final String SERIALIZED_NAME_ALLOW_NULL = "allowNull"; - @SerializedName(SERIALIZED_NAME_ALLOW_NULL) - private Boolean allowNull; + public static final String SERIALIZED_NAME_MULTIPLE = "multiple"; - public DestinationMetadataActionFieldV1() { - } + @SerializedName(SERIALIZED_NAME_MULTIPLE) + private Boolean multiple; - public DestinationMetadataActionFieldV1 id(String id) { - - this.id = id; - return this; - } + public static final String SERIALIZED_NAME_CHOICES = "choices"; - /** - * The primary key of the field. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The primary key of the field.") + @SerializedName(SERIALIZED_NAME_CHOICES) + private Object choices = null; - public String getId() { - return id; - } + public static final String SERIALIZED_NAME_DYNAMIC = "dynamic"; + @SerializedName(SERIALIZED_NAME_DYNAMIC) + private Boolean dynamic; - public void setId(String id) { - this.id = id; - } + public static final String SERIALIZED_NAME_ALLOW_NULL = "allowNull"; + + @SerializedName(SERIALIZED_NAME_ALLOW_NULL) + private Boolean allowNull; + + public static final String SERIALIZED_NAME_HIDDEN = "hidden"; + + @SerializedName(SERIALIZED_NAME_HIDDEN) + private Boolean hidden; + + public DestinationMetadataActionFieldV1() {} + + public DestinationMetadataActionFieldV1 id(String id) { + + this.id = id; + return this; + } + + /** + * The primary key of the field. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public DestinationMetadataActionFieldV1 sortOrder(BigDecimal sortOrder) { + + this.sortOrder = sortOrder; + return this; + } + + /** + * The order this particular field is (used in the UI for displaying the fields in a specified + * order). + * + * @return sortOrder + */ + @javax.annotation.Nonnull + public BigDecimal getSortOrder() { + return sortOrder; + } + public void setSortOrder(BigDecimal sortOrder) { + this.sortOrder = sortOrder; + } - public DestinationMetadataActionFieldV1 sortOrder(BigDecimal sortOrder) { - - this.sortOrder = sortOrder; - return this; - } + public DestinationMetadataActionFieldV1 fieldKey(String fieldKey) { - /** - * The order this particular field is (used in the UI for displaying the fields in a specified order). - * @return sortOrder - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The order this particular field is (used in the UI for displaying the fields in a specified order).") + this.fieldKey = fieldKey; + return this; + } - public BigDecimal getSortOrder() { - return sortOrder; - } + /** + * A unique machine-readable key for the field. Should ideally match the expected key in the + * action\\'s API request. + * + * @return fieldKey + */ + @javax.annotation.Nonnull + public String getFieldKey() { + return fieldKey; + } + public void setFieldKey(String fieldKey) { + this.fieldKey = fieldKey; + } - public void setSortOrder(BigDecimal sortOrder) { - this.sortOrder = sortOrder; - } + public DestinationMetadataActionFieldV1 label(String label) { + this.label = label; + return this; + } - public DestinationMetadataActionFieldV1 fieldKey(String fieldKey) { - - this.fieldKey = fieldKey; - return this; - } + /** + * A human-readable label for this value. + * + * @return label + */ + @javax.annotation.Nonnull + public String getLabel() { + return label; + } - /** - * A unique machine-readable key for the field. Should ideally match the expected key in the action\\'s API request. - * @return fieldKey - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A unique machine-readable key for the field. Should ideally match the expected key in the action\\'s API request.") + public void setLabel(String label) { + this.label = label; + } - public String getFieldKey() { - return fieldKey; - } + public DestinationMetadataActionFieldV1 type(TypeEnum type) { + this.type = type; + return this; + } - public void setFieldKey(String fieldKey) { - this.fieldKey = fieldKey; - } + /** + * The data type for this value. + * + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + public void setType(TypeEnum type) { + this.type = type; + } - public DestinationMetadataActionFieldV1 label(String label) { - - this.label = label; - return this; - } + public DestinationMetadataActionFieldV1 description(String description) { - /** - * A human-readable label for this value. - * @return label - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A human-readable label for this value.") + this.description = description; + return this; + } - public String getLabel() { - return label; - } + /** + * A human-readable description of this value. You can use Markdown. + * + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } - public void setLabel(String label) { - this.label = label; - } + public DestinationMetadataActionFieldV1 placeholder(String placeholder) { + this.placeholder = placeholder; + return this; + } - public DestinationMetadataActionFieldV1 type(TypeEnum type) { - - this.type = type; - return this; - } + /** + * An example value displayed but not saved. + * + * @return placeholder + */ + @javax.annotation.Nullable + public String getPlaceholder() { + return placeholder; + } - /** - * The data type for this value. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The data type for this value.") + public void setPlaceholder(String placeholder) { + this.placeholder = placeholder; + } - public TypeEnum getType() { - return type; - } + public DestinationMetadataActionFieldV1 defaultValue(Object defaultValue) { + this.defaultValue = defaultValue; + return this; + } - public void setType(TypeEnum type) { - this.type = type; - } + /** + * A default value that is saved the first time an action is created. + * + * @return defaultValue + */ + @javax.annotation.Nullable + public Object getDefaultValue() { + return defaultValue; + } + public void setDefaultValue(Object defaultValue) { + this.defaultValue = defaultValue; + } - public DestinationMetadataActionFieldV1 description(String description) { - - this.description = description; - return this; - } + public DestinationMetadataActionFieldV1 required(Boolean required) { - /** - * A human-readable description of this value. You can use Markdown. - * @return description - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A human-readable description of this value. You can use Markdown.") + this.required = required; + return this; + } - public String getDescription() { - return description; - } + /** + * Whether this field is required. + * + * @return required + */ + @javax.annotation.Nonnull + public Boolean getRequired() { + return required; + } + public void setRequired(Boolean required) { + this.required = required; + } - public void setDescription(String description) { - this.description = description; - } + public DestinationMetadataActionFieldV1 multiple(Boolean multiple) { + this.multiple = multiple; + return this; + } - public DestinationMetadataActionFieldV1 placeholder(String placeholder) { - - this.placeholder = placeholder; - return this; - } + /** + * Whether a user can provide multiples of this field. + * + * @return multiple + */ + @javax.annotation.Nonnull + public Boolean getMultiple() { + return multiple; + } - /** - * An example value displayed but not saved. - * @return placeholder - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An example value displayed but not saved.") + public void setMultiple(Boolean multiple) { + this.multiple = multiple; + } - public String getPlaceholder() { - return placeholder; - } + public DestinationMetadataActionFieldV1 choices(Object choices) { + this.choices = choices; + return this; + } - public void setPlaceholder(String placeholder) { - this.placeholder = placeholder; - } + /** + * A list of machine-readable value/label pairs to populate a static dropdown. + * + * @return choices + */ + @javax.annotation.Nullable + public Object getChoices() { + return choices; + } + public void setChoices(Object choices) { + this.choices = choices; + } - public DestinationMetadataActionFieldV1 defaultValue(Object defaultValue) { - - this.defaultValue = defaultValue; - return this; - } + public DestinationMetadataActionFieldV1 dynamic(Boolean dynamic) { - /** - * A default value that is saved the first time an action is created. - * @return defaultValue - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A default value that is saved the first time an action is created.") + this.dynamic = dynamic; + return this; + } - public Object getDefaultValue() { - return defaultValue; - } + /** + * Whether this field should execute a dynamic request to fetch choices to populate a dropdown. + * When true, `choices` is ignored. + * + * @return dynamic + */ + @javax.annotation.Nonnull + public Boolean getDynamic() { + return dynamic; + } + public void setDynamic(Boolean dynamic) { + this.dynamic = dynamic; + } - public void setDefaultValue(Object defaultValue) { - this.defaultValue = defaultValue; - } + public DestinationMetadataActionFieldV1 allowNull(Boolean allowNull) { + this.allowNull = allowNull; + return this; + } - public DestinationMetadataActionFieldV1 required(Boolean required) { - - this.required = required; - return this; - } + /** + * Whether this field allows null values. + * + * @return allowNull + */ + @javax.annotation.Nonnull + public Boolean getAllowNull() { + return allowNull; + } - /** - * Whether this field is required. - * @return required - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether this field is required.") + public void setAllowNull(Boolean allowNull) { + this.allowNull = allowNull; + } - public Boolean getRequired() { - return required; - } + public DestinationMetadataActionFieldV1 hidden(Boolean hidden) { + this.hidden = hidden; + return this; + } - public void setRequired(Boolean required) { - this.required = required; - } + /** + * Whether the action field should be hidden or not. + * + * @return hidden + */ + @javax.annotation.Nullable + public Boolean getHidden() { + return hidden; + } + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } - public DestinationMetadataActionFieldV1 multiple(Boolean multiple) { - - this.multiple = multiple; - return this; - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationMetadataActionFieldV1 destinationMetadataActionFieldV1 = + (DestinationMetadataActionFieldV1) o; + return Objects.equals(this.id, destinationMetadataActionFieldV1.id) + && Objects.equals(this.sortOrder, destinationMetadataActionFieldV1.sortOrder) + && Objects.equals(this.fieldKey, destinationMetadataActionFieldV1.fieldKey) + && Objects.equals(this.label, destinationMetadataActionFieldV1.label) + && Objects.equals(this.type, destinationMetadataActionFieldV1.type) + && Objects.equals(this.description, destinationMetadataActionFieldV1.description) + && Objects.equals(this.placeholder, destinationMetadataActionFieldV1.placeholder) + && Objects.equals(this.defaultValue, destinationMetadataActionFieldV1.defaultValue) + && Objects.equals(this.required, destinationMetadataActionFieldV1.required) + && Objects.equals(this.multiple, destinationMetadataActionFieldV1.multiple) + && Objects.equals(this.choices, destinationMetadataActionFieldV1.choices) + && Objects.equals(this.dynamic, destinationMetadataActionFieldV1.dynamic) + && Objects.equals(this.allowNull, destinationMetadataActionFieldV1.allowNull) + && Objects.equals(this.hidden, destinationMetadataActionFieldV1.hidden); + } - /** - * Whether a user can provide multiples of this field. - * @return multiple - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether a user can provide multiples of this field.") + 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())); + } - public Boolean getMultiple() { - return multiple; - } + @Override + public int hashCode() { + return Objects.hash( + id, + sortOrder, + fieldKey, + label, + type, + description, + placeholder, + defaultValue, + required, + multiple, + choices, + dynamic, + allowNull, + hidden); + } + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } - public void setMultiple(Boolean multiple) { - this.multiple = multiple; - } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationMetadataActionFieldV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" sortOrder: ").append(toIndentedString(sortOrder)).append("\n"); + sb.append(" fieldKey: ").append(toIndentedString(fieldKey)).append("\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" placeholder: ").append(toIndentedString(placeholder)).append("\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append(" multiple: ").append(toIndentedString(multiple)).append("\n"); + sb.append(" choices: ").append(toIndentedString(choices)).append("\n"); + sb.append(" dynamic: ").append(toIndentedString(dynamic)).append("\n"); + sb.append(" allowNull: ").append(toIndentedString(allowNull)).append("\n"); + sb.append(" hidden: ").append(toIndentedString(hidden)).append("\n"); + sb.append("}"); + return sb.toString(); + } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } - public DestinationMetadataActionFieldV1 choices(Object choices) { - - this.choices = choices; - return this; - } + 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("sortOrder"); + openapiFields.add("fieldKey"); + openapiFields.add("label"); + openapiFields.add("type"); + openapiFields.add("description"); + openapiFields.add("placeholder"); + openapiFields.add("defaultValue"); + openapiFields.add("required"); + openapiFields.add("multiple"); + openapiFields.add("choices"); + openapiFields.add("dynamic"); + openapiFields.add("allowNull"); + openapiFields.add("hidden"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("sortOrder"); + openapiRequiredFields.add("fieldKey"); + openapiRequiredFields.add("label"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("required"); + openapiRequiredFields.add("multiple"); + openapiRequiredFields.add("dynamic"); + openapiRequiredFields.add("allowNull"); + } - /** - * A list of machine-readable value/label pairs to populate a static dropdown. - * @return choices - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A list of machine-readable value/label pairs to populate a static dropdown.") + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DestinationMetadataActionFieldV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationMetadataActionFieldV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationMetadataActionFieldV1 is" + + " not found in the empty JSON string", + DestinationMetadataActionFieldV1.openapiRequiredFields.toString())); + } + } - public Object getChoices() { - return choices; - } - - - public void setChoices(Object choices) { - this.choices = choices; - } - - - public DestinationMetadataActionFieldV1 dynamic(Boolean dynamic) { - - this.dynamic = dynamic; - return this; - } - - /** - * Whether this field should execute a dynamic request to fetch choices to populate a dropdown. When true, `choices` is ignored. - * @return dynamic - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether this field should execute a dynamic request to fetch choices to populate a dropdown. When true, `choices` is ignored.") - - public Boolean getDynamic() { - return dynamic; - } - - - public void setDynamic(Boolean dynamic) { - this.dynamic = dynamic; - } - - - public DestinationMetadataActionFieldV1 allowNull(Boolean allowNull) { - - this.allowNull = allowNull; - return this; - } - - /** - * Whether this field allows null values. - * @return allowNull - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether this field allows null values.") - - public Boolean getAllowNull() { - return allowNull; - } - - - public void setAllowNull(Boolean allowNull) { - this.allowNull = allowNull; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DestinationMetadataActionFieldV1 destinationMetadataActionFieldV1 = (DestinationMetadataActionFieldV1) o; - return Objects.equals(this.id, destinationMetadataActionFieldV1.id) && - Objects.equals(this.sortOrder, destinationMetadataActionFieldV1.sortOrder) && - Objects.equals(this.fieldKey, destinationMetadataActionFieldV1.fieldKey) && - Objects.equals(this.label, destinationMetadataActionFieldV1.label) && - Objects.equals(this.type, destinationMetadataActionFieldV1.type) && - Objects.equals(this.description, destinationMetadataActionFieldV1.description) && - Objects.equals(this.placeholder, destinationMetadataActionFieldV1.placeholder) && - Objects.equals(this.defaultValue, destinationMetadataActionFieldV1.defaultValue) && - Objects.equals(this.required, destinationMetadataActionFieldV1.required) && - Objects.equals(this.multiple, destinationMetadataActionFieldV1.multiple) && - Objects.equals(this.choices, destinationMetadataActionFieldV1.choices) && - Objects.equals(this.dynamic, destinationMetadataActionFieldV1.dynamic) && - Objects.equals(this.allowNull, destinationMetadataActionFieldV1.allowNull); - } - - 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(id, sortOrder, fieldKey, label, type, description, placeholder, defaultValue, required, multiple, choices, dynamic, allowNull); - } - - 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 DestinationMetadataActionFieldV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" sortOrder: ").append(toIndentedString(sortOrder)).append("\n"); - sb.append(" fieldKey: ").append(toIndentedString(fieldKey)).append("\n"); - sb.append(" label: ").append(toIndentedString(label)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" placeholder: ").append(toIndentedString(placeholder)).append("\n"); - sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); - sb.append(" required: ").append(toIndentedString(required)).append("\n"); - sb.append(" multiple: ").append(toIndentedString(multiple)).append("\n"); - sb.append(" choices: ").append(toIndentedString(choices)).append("\n"); - sb.append(" dynamic: ").append(toIndentedString(dynamic)).append("\n"); - sb.append(" allowNull: ").append(toIndentedString(allowNull)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("sortOrder"); - openapiFields.add("fieldKey"); - openapiFields.add("label"); - openapiFields.add("type"); - openapiFields.add("description"); - openapiFields.add("placeholder"); - openapiFields.add("defaultValue"); - openapiFields.add("required"); - openapiFields.add("multiple"); - openapiFields.add("choices"); - openapiFields.add("dynamic"); - openapiFields.add("allowNull"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("sortOrder"); - openapiRequiredFields.add("fieldKey"); - openapiRequiredFields.add("label"); - openapiRequiredFields.add("type"); - openapiRequiredFields.add("description"); - openapiRequiredFields.add("required"); - openapiRequiredFields.add("multiple"); - openapiRequiredFields.add("dynamic"); - openapiRequiredFields.add("allowNull"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationMetadataActionFieldV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationMetadataActionFieldV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationMetadataActionFieldV1 is not found in the empty JSON string", DestinationMetadataActionFieldV1.openapiRequiredFields.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationMetadataActionFieldV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationMetadataActionFieldV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationMetadataActionFieldV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationMetadataActionFieldV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationMetadataActionFieldV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("fieldKey").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fieldKey` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("fieldKey").toString())); + } + 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("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("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("placeholder") != null && !jsonObj.get("placeholder").isJsonNull()) + && !jsonObj.get("placeholder").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `placeholder` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("placeholder").toString())); } - } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DestinationMetadataActionFieldV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationMetadataActionFieldV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationMetadataActionFieldV1' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DestinationMetadataActionFieldV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationMetadataActionFieldV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationMetadataActionFieldV1 read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("fieldKey").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `fieldKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fieldKey").toString())); - } - 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("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("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("placeholder") != null && !jsonObj.get("placeholder").isJsonNull()) && !jsonObj.get("placeholder").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `placeholder` to be a primitive type in the JSON string but got `%s`", jsonObj.get("placeholder").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationMetadataActionFieldV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationMetadataActionFieldV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationMetadataActionFieldV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationMetadataActionFieldV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationMetadataActionFieldV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of DestinationMetadataActionFieldV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationMetadataActionFieldV1 - * @throws IOException if the JSON string is invalid with respect to DestinationMetadataActionFieldV1 - */ - public static DestinationMetadataActionFieldV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationMetadataActionFieldV1.class); - } - - /** - * Convert an instance of DestinationMetadataActionFieldV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + } + /** + * Create an instance of DestinationMetadataActionFieldV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationMetadataActionFieldV1 + * @throws IOException if the JSON string is invalid with respect to + * DestinationMetadataActionFieldV1 + */ + public static DestinationMetadataActionFieldV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationMetadataActionFieldV1.class); + } + + /** + * Convert an instance of DestinationMetadataActionFieldV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationMetadataActionV1.java b/src/main/java/com/segment/publicapi/models/DestinationMetadataActionV1.java index 8907af76..71da6d04 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationMetadataActionV1.java +++ b/src/main/java/com/segment/publicapi/models/DestinationMetadataActionV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,503 +9,515 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.segment.publicapi.models.DestinationMetadataActionFieldV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Represents an Action, a building block of behavior that can be performed by the Destination. */ +public class DestinationMetadataActionV1 { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * Represents an Action, a building block of behavior that can be performed by the Destination. - */ -@ApiModel(description = "Represents an Action, a building block of behavior that can be performed by the Destination.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class DestinationMetadataActionV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + public static final String SERIALIZED_NAME_SLUG = "slug"; - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - /** - * The platform on which this action runs. - */ - @JsonAdapter(PlatformEnum.Adapter.class) - public enum PlatformEnum { - CLOUD("CLOUD"), - - MOBILE("MOBILE"), - - WEB("WEB"); + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - private String value; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - PlatformEnum(String value) { - this.value = value; - } + /** The platform on which this action runs. */ + @JsonAdapter(PlatformEnum.Adapter.class) + public enum PlatformEnum { + CLOUD("CLOUD"), - public String getValue() { - return value; - } + MOBILE("MOBILE"), - @Override - public String toString() { - return String.valueOf(value); - } + WEB("WEB"); + + private String value; + + PlatformEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } - public static PlatformEnum fromValue(String value) { - for (PlatformEnum b : PlatformEnum.values()) { - if (b.value.equals(value)) { - return b; + @Override + public String toString() { + return String.valueOf(value); + } + + public static PlatformEnum fromValue(String value) { + for (PlatformEnum b : PlatformEnum.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 PlatformEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PlatformEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PlatformEnum.fromValue(value); + } } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final PlatformEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } + public static final String SERIALIZED_NAME_PLATFORM = "platform"; + + @SerializedName(SERIALIZED_NAME_PLATFORM) + private PlatformEnum platform; + + public static final String SERIALIZED_NAME_HIDDEN = "hidden"; - @Override - public PlatformEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return PlatformEnum.fromValue(value); - } + @SerializedName(SERIALIZED_NAME_HIDDEN) + private Boolean hidden; + + public static final String SERIALIZED_NAME_DEFAULT_TRIGGER = "defaultTrigger"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_TRIGGER) + private String defaultTrigger; + + public static final String SERIALIZED_NAME_FIELDS = "fields"; + + @SerializedName(SERIALIZED_NAME_FIELDS) + private List fields = new ArrayList<>(); + + public DestinationMetadataActionV1() {} + + public DestinationMetadataActionV1 id(String id) { + + this.id = id; + return this; + } + + /** + * The primary key of the action. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; } - } - public static final String SERIALIZED_NAME_PLATFORM = "platform"; - @SerializedName(SERIALIZED_NAME_PLATFORM) - private PlatformEnum platform; + public void setId(String id) { + this.id = id; + } + + public DestinationMetadataActionV1 slug(String slug) { - public static final String SERIALIZED_NAME_HIDDEN = "hidden"; - @SerializedName(SERIALIZED_NAME_HIDDEN) - private Boolean hidden; + this.slug = slug; + return this; + } - public static final String SERIALIZED_NAME_DEFAULT_TRIGGER = "defaultTrigger"; - @SerializedName(SERIALIZED_NAME_DEFAULT_TRIGGER) - private String defaultTrigger; + /** + * A machine-readable key unique to the action definition. + * + * @return slug + */ + @javax.annotation.Nonnull + public String getSlug() { + return slug; + } - public static final String SERIALIZED_NAME_FIELDS = "fields"; - @SerializedName(SERIALIZED_NAME_FIELDS) - private List fields = new ArrayList<>(); + public void setSlug(String slug) { + this.slug = slug; + } - public DestinationMetadataActionV1() { - } + public DestinationMetadataActionV1 name(String name) { - public DestinationMetadataActionV1 id(String id) { - - this.id = id; - return this; - } + this.name = name; + return this; + } - /** - * The primary key of the action. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The primary key of the action.") + /** + * A human-readable name for the action. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public String getId() { - return id; - } + public void setName(String name) { + this.name = name; + } + public DestinationMetadataActionV1 description(String description) { - public void setId(String id) { - this.id = id; - } + this.description = description; + return this; + } + /** + * A human-readable description of the action. May include Markdown. + * + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } - public DestinationMetadataActionV1 slug(String slug) { - - this.slug = slug; - return this; - } + public void setDescription(String description) { + this.description = description; + } - /** - * A machine-readable key unique to the action definition. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A machine-readable key unique to the action definition.") + public DestinationMetadataActionV1 platform(PlatformEnum platform) { - public String getSlug() { - return slug; - } + this.platform = platform; + return this; + } + /** + * The platform on which this action runs. + * + * @return platform + */ + @javax.annotation.Nonnull + public PlatformEnum getPlatform() { + return platform; + } - public void setSlug(String slug) { - this.slug = slug; - } + public void setPlatform(PlatformEnum platform) { + this.platform = platform; + } + public DestinationMetadataActionV1 hidden(Boolean hidden) { - public DestinationMetadataActionV1 name(String name) { - - this.name = name; - return this; - } + this.hidden = hidden; + return this; + } - /** - * A human-readable name for the action. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A human-readable name for the action.") + /** + * Whether the action should be hidden. + * + * @return hidden + */ + @javax.annotation.Nonnull + public Boolean getHidden() { + return hidden; + } - public String getName() { - return name; - } + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } + public DestinationMetadataActionV1 defaultTrigger(String defaultTrigger) { - public void setName(String name) { - this.name = name; - } + this.defaultTrigger = defaultTrigger; + return this; + } + /** + * The default value used as the trigger when connecting this action. + * + * @return defaultTrigger + */ + @javax.annotation.Nullable + public String getDefaultTrigger() { + return defaultTrigger; + } - public DestinationMetadataActionV1 description(String description) { - - this.description = description; - return this; - } + public void setDefaultTrigger(String defaultTrigger) { + this.defaultTrigger = defaultTrigger; + } - /** - * A human-readable description of the action. May include Markdown. - * @return description - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A human-readable description of the action. May include Markdown.") + public DestinationMetadataActionV1 fields(List fields) { - public String getDescription() { - return description; - } + this.fields = fields; + return this; + } + public DestinationMetadataActionV1 addFieldsItem(DestinationMetadataActionFieldV1 fieldsItem) { + if (this.fields == null) { + this.fields = new ArrayList<>(); + } + this.fields.add(fieldsItem); + return this; + } - public void setDescription(String description) { - this.description = description; - } + /** + * The fields expected in order to perform the action. + * + * @return fields + */ + @javax.annotation.Nonnull + public List getFields() { + return fields; + } + public void setFields(List fields) { + this.fields = fields; + } - public DestinationMetadataActionV1 platform(PlatformEnum platform) { - - this.platform = platform; - return this; - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationMetadataActionV1 destinationMetadataActionV1 = (DestinationMetadataActionV1) o; + return Objects.equals(this.id, destinationMetadataActionV1.id) + && Objects.equals(this.slug, destinationMetadataActionV1.slug) + && Objects.equals(this.name, destinationMetadataActionV1.name) + && Objects.equals(this.description, destinationMetadataActionV1.description) + && Objects.equals(this.platform, destinationMetadataActionV1.platform) + && Objects.equals(this.hidden, destinationMetadataActionV1.hidden) + && Objects.equals(this.defaultTrigger, destinationMetadataActionV1.defaultTrigger) + && Objects.equals(this.fields, destinationMetadataActionV1.fields); + } - /** - * The platform on which this action runs. - * @return platform - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The platform on which this action runs.") + @Override + public int hashCode() { + return Objects.hash(id, slug, name, description, platform, hidden, defaultTrigger, fields); + } - public PlatformEnum getPlatform() { - return platform; - } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationMetadataActionV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" platform: ").append(toIndentedString(platform)).append("\n"); + sb.append(" hidden: ").append(toIndentedString(hidden)).append("\n"); + sb.append(" defaultTrigger: ").append(toIndentedString(defaultTrigger)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append("}"); + return sb.toString(); + } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } - public void setPlatform(PlatformEnum platform) { - this.platform = platform; - } + 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("slug"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("platform"); + openapiFields.add("hidden"); + openapiFields.add("defaultTrigger"); + openapiFields.add("fields"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("slug"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("platform"); + openapiRequiredFields.add("hidden"); + openapiRequiredFields.add("defaultTrigger"); + openapiRequiredFields.add("fields"); + } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DestinationMetadataActionV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationMetadataActionV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationMetadataActionV1 is not" + + " found in the empty JSON string", + DestinationMetadataActionV1.openapiRequiredFields.toString())); + } + } - public DestinationMetadataActionV1 hidden(Boolean hidden) { - - this.hidden = hidden; - return this; - } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationMetadataActionV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationMetadataActionV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } - /** - * Whether the action should be hidden. - * @return hidden - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether the action should be hidden.") - - public Boolean getHidden() { - return hidden; - } - - - public void setHidden(Boolean hidden) { - this.hidden = hidden; - } - - - public DestinationMetadataActionV1 defaultTrigger(String defaultTrigger) { - - this.defaultTrigger = defaultTrigger; - return this; - } - - /** - * The default value used as the trigger when connecting this action. - * @return defaultTrigger - **/ - @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "The default value used as the trigger when connecting this action.") - - public String getDefaultTrigger() { - return defaultTrigger; - } - - - public void setDefaultTrigger(String defaultTrigger) { - this.defaultTrigger = defaultTrigger; - } - - - public DestinationMetadataActionV1 fields(List fields) { - - this.fields = fields; - return this; - } - - public DestinationMetadataActionV1 addFieldsItem(DestinationMetadataActionFieldV1 fieldsItem) { - this.fields.add(fieldsItem); - return this; - } - - /** - * The fields expected in order to perform the action. - * @return fields - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The fields expected in order to perform the action.") - - public List getFields() { - return fields; - } - - - public void setFields(List fields) { - this.fields = fields; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DestinationMetadataActionV1 destinationMetadataActionV1 = (DestinationMetadataActionV1) o; - return Objects.equals(this.id, destinationMetadataActionV1.id) && - Objects.equals(this.slug, destinationMetadataActionV1.slug) && - Objects.equals(this.name, destinationMetadataActionV1.name) && - Objects.equals(this.description, destinationMetadataActionV1.description) && - Objects.equals(this.platform, destinationMetadataActionV1.platform) && - Objects.equals(this.hidden, destinationMetadataActionV1.hidden) && - Objects.equals(this.defaultTrigger, destinationMetadataActionV1.defaultTrigger) && - Objects.equals(this.fields, destinationMetadataActionV1.fields); - } - - @Override - public int hashCode() { - return Objects.hash(id, slug, name, description, platform, hidden, defaultTrigger, fields); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationMetadataActionV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" platform: ").append(toIndentedString(platform)).append("\n"); - sb.append(" hidden: ").append(toIndentedString(hidden)).append("\n"); - sb.append(" defaultTrigger: ").append(toIndentedString(defaultTrigger)).append("\n"); - sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("slug"); - openapiFields.add("name"); - openapiFields.add("description"); - openapiFields.add("platform"); - openapiFields.add("hidden"); - openapiFields.add("defaultTrigger"); - openapiFields.add("fields"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("description"); - openapiRequiredFields.add("platform"); - openapiRequiredFields.add("hidden"); - openapiRequiredFields.add("defaultTrigger"); - openapiRequiredFields.add("fields"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationMetadataActionV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationMetadataActionV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationMetadataActionV1 is not found in the empty JSON string", DestinationMetadataActionV1.openapiRequiredFields.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationMetadataActionV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").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("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("platform").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `platform` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("platform").toString())); + } + if ((jsonObj.get("defaultTrigger") != null && !jsonObj.get("defaultTrigger").isJsonNull()) + && !jsonObj.get("defaultTrigger").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `defaultTrigger` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("defaultTrigger").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("fields").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fields` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("fields").toString())); } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationMetadataActionV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationMetadataActionV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + JsonArray jsonArrayfields = jsonObj.getAsJsonArray("fields"); + // validate the required field `fields` (array) + for (int i = 0; i < jsonArrayfields.size(); i++) { + DestinationMetadataActionFieldV1.validateJsonElement(jsonArrayfields.get(i)); } - } + ; + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DestinationMetadataActionV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationMetadataActionV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationMetadataActionV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DestinationMetadataActionV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationMetadataActionV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationMetadataActionV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("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("platform").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `platform` to be a primitive type in the JSON string but got `%s`", jsonObj.get("platform").toString())); - } - if (!jsonObj.get("defaultTrigger").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `defaultTrigger` to be a primitive type in the JSON string but got `%s`", jsonObj.get("defaultTrigger").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("fields").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `fields` to be an array in the JSON string but got `%s`", jsonObj.get("fields").toString())); - } - - JsonArray jsonArrayfields = jsonObj.getAsJsonArray("fields"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationMetadataActionV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationMetadataActionV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationMetadataActionV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationMetadataActionV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationMetadataActionV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of DestinationMetadataActionV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationMetadataActionV1 - * @throws IOException if the JSON string is invalid with respect to DestinationMetadataActionV1 - */ - public static DestinationMetadataActionV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationMetadataActionV1.class); - } - - /** - * Convert an instance of DestinationMetadataActionV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + } + + /** + * Create an instance of DestinationMetadataActionV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationMetadataActionV1 + * @throws IOException if the JSON string is invalid with respect to DestinationMetadataActionV1 + */ + public static DestinationMetadataActionV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationMetadataActionV1.class); + } + /** + * Convert an instance of DestinationMetadataActionV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationMetadataComponentV1.java b/src/main/java/com/segment/publicapi/models/DestinationMetadataComponentV1.java index 642b4a07..6a42ce12 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationMetadataComponentV1.java +++ b/src/main/java/com/segment/publicapi/models/DestinationMetadataComponentV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,373 +9,374 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Represents a component this Destination provides. */ +public class DestinationMetadataComponentV1 { + /** The component type. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ANDROID("ANDROID"), -/** - * Represents a component this Destination provides. - */ -@ApiModel(description = "Represents a component this Destination provides.") + BROWSER("BROWSER"), -public class DestinationMetadataComponentV1 { - /** - * The component type. - */ - @JsonAdapter(TypeEnum.Adapter.class) - public enum TypeEnum { - ANDROID("ANDROID"), - - BROWSER("BROWSER"), - - IOS("IOS"), - - SERVER("SERVER"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } + IOS("IOS"), - public String getValue() { - return value; - } + SERVER("SERVER"); - @Override - public String toString() { - return String.valueOf(value); - } + private String value; - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; + 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 + "'"); } - } - 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 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_TYPE = "type"; - public static final String SERIALIZED_NAME_CODE = "code"; - @SerializedName(SERIALIZED_NAME_CODE) - private String code; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; - /** - * The owner of this component. Either 'SEGMENT' or 'PARTNER'. - */ - @JsonAdapter(OwnerEnum.Adapter.class) - public enum OwnerEnum { - PARTNER("PARTNER"), - - SEGMENT("SEGMENT"); + public static final String SERIALIZED_NAME_CODE = "code"; - private String value; + @SerializedName(SERIALIZED_NAME_CODE) + private String code; - OwnerEnum(String value) { - this.value = value; - } + /** The owner of this component. Either 'SEGMENT' or 'PARTNER'. */ + @JsonAdapter(OwnerEnum.Adapter.class) + public enum OwnerEnum { + PARTNER("PARTNER"), - public String getValue() { - return value; - } + SEGMENT("SEGMENT"); - @Override - public String toString() { - return String.valueOf(value); - } + private String value; - public static OwnerEnum fromValue(String value) { - for (OwnerEnum b : OwnerEnum.values()) { - if (b.value.equals(value)) { - return b; + OwnerEnum(String value) { + this.value = value; } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final OwnerEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public OwnerEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return OwnerEnum.fromValue(value); - } - } - } - public static final String SERIALIZED_NAME_OWNER = "owner"; - @SerializedName(SERIALIZED_NAME_OWNER) - private OwnerEnum owner; + public String getValue() { + return value; + } - public DestinationMetadataComponentV1() { - } + @Override + public String toString() { + return String.valueOf(value); + } - public DestinationMetadataComponentV1 type(TypeEnum type) { - - this.type = type; - return this; - } + public static OwnerEnum fromValue(String value) { + for (OwnerEnum b : OwnerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - /** - * The component type. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The component type.") + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OwnerEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OwnerEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OwnerEnum.fromValue(value); + } + } + } - public TypeEnum getType() { - return type; - } + public static final String SERIALIZED_NAME_OWNER = "owner"; + @SerializedName(SERIALIZED_NAME_OWNER) + private OwnerEnum owner; - public void setType(TypeEnum type) { - this.type = type; - } + public DestinationMetadataComponentV1() {} + public DestinationMetadataComponentV1 type(TypeEnum type) { - public DestinationMetadataComponentV1 code(String code) { - - this.code = code; - return this; - } + this.type = type; + return this; + } - /** - * Link to the repository hosting the code for this component. - * @return code - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Link to the repository hosting the code for this component.") + /** + * The component type. + * + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } - public String getCode() { - return code; - } + public void setType(TypeEnum type) { + this.type = type; + } + public DestinationMetadataComponentV1 code(String code) { - public void setCode(String code) { - this.code = code; - } + this.code = code; + return this; + } + /** + * Link to the repository hosting the code for this component. + * + * @return code + */ + @javax.annotation.Nonnull + public String getCode() { + return code; + } - public DestinationMetadataComponentV1 owner(OwnerEnum owner) { - - this.owner = owner; - return this; - } + public void setCode(String code) { + this.code = code; + } - /** - * The owner of this component. Either 'SEGMENT' or 'PARTNER'. - * @return owner - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The owner of this component. Either 'SEGMENT' or 'PARTNER'.") + public DestinationMetadataComponentV1 owner(OwnerEnum owner) { - public OwnerEnum getOwner() { - return owner; - } + this.owner = owner; + return this; + } + /** + * The owner of this component. Either 'SEGMENT' or 'PARTNER'. + * + * @return owner + */ + @javax.annotation.Nullable + public OwnerEnum getOwner() { + return owner; + } - public void setOwner(OwnerEnum owner) { - this.owner = owner; - } + public void setOwner(OwnerEnum owner) { + this.owner = owner; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationMetadataComponentV1 destinationMetadataComponentV1 = + (DestinationMetadataComponentV1) o; + return Objects.equals(this.type, destinationMetadataComponentV1.type) + && Objects.equals(this.code, destinationMetadataComponentV1.code) + && Objects.equals(this.owner, destinationMetadataComponentV1.owner); + } + @Override + public int hashCode() { + return Objects.hash(type, code, owner); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationMetadataComponentV1 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DestinationMetadataComponentV1 destinationMetadataComponentV1 = (DestinationMetadataComponentV1) o; - return Objects.equals(this.type, destinationMetadataComponentV1.type) && - Objects.equals(this.code, destinationMetadataComponentV1.code) && - Objects.equals(this.owner, destinationMetadataComponentV1.owner); - } - - @Override - public int hashCode() { - return Objects.hash(type, code, owner); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationMetadataComponentV1 {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("code"); + openapiFields.add("owner"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("code"); } - return o.toString().replace("\n", "\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("code"); - openapiFields.add("owner"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("type"); - openapiRequiredFields.add("code"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationMetadataComponentV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationMetadataComponentV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationMetadataComponentV1 is not found in the empty JSON string", DestinationMetadataComponentV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DestinationMetadataComponentV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationMetadataComponentV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationMetadataComponentV1 is not" + + " found in the empty JSON string", + DestinationMetadataComponentV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationMetadataComponentV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationMetadataComponentV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationMetadataComponentV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationMetadataComponentV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DestinationMetadataComponentV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationMetadataComponentV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("owner") != null && !jsonObj.get("owner").isJsonNull()) + && !jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `owner` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("owner").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("code").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); - } - if ((jsonObj.get("owner") != null && !jsonObj.get("owner").isJsonNull()) && !jsonObj.get("owner").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationMetadataComponentV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationMetadataComponentV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationMetadataComponentV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationMetadataComponentV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationMetadataComponentV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DestinationMetadataComponentV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationMetadataComponentV1 - * @throws IOException if the JSON string is invalid with respect to DestinationMetadataComponentV1 - */ - public static DestinationMetadataComponentV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationMetadataComponentV1.class); - } - - /** - * Convert an instance of DestinationMetadataComponentV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationMetadataComponentV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationMetadataComponentV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DestinationMetadataComponentV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationMetadataComponentV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationMetadataComponentV1 read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DestinationMetadataComponentV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationMetadataComponentV1 + * @throws IOException if the JSON string is invalid with respect to + * DestinationMetadataComponentV1 + */ + public static DestinationMetadataComponentV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationMetadataComponentV1.class); + } + + /** + * Convert an instance of DestinationMetadataComponentV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationMetadataFeaturesV1.java b/src/main/java/com/segment/publicapi/models/DestinationMetadataFeaturesV1.java index 4dfa96d9..c31d0706 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationMetadataFeaturesV1.java +++ b/src/main/java/com/segment/publicapi/models/DestinationMetadataFeaturesV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,427 +9,452 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Represents features that a given Destination supports. */ +public class DestinationMetadataFeaturesV1 { + /** + * This Destination's support level for cloud mode instances. The values '0' and + * 'NONE', and '1' and 'SINGLE' are equivalent. + */ + @JsonAdapter(CloudModeInstancesEnum.Adapter.class) + public enum CloudModeInstancesEnum { + _0("0"), -/** - * Represents features that a given Destination supports. - */ -@ApiModel(description = "Represents features that a given Destination supports.") + _1("1"), -public class DestinationMetadataFeaturesV1 { - /** - * This Destination's support level for cloud mode instances. The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent. - */ - @JsonAdapter(CloudModeInstancesEnum.Adapter.class) - public enum CloudModeInstancesEnum { - _0("0"), - - _1("1"), - - MULTIPLE("MULTIPLE"), - - NONE("NONE"), - - SINGLE("SINGLE"); - - private String value; - - CloudModeInstancesEnum(String value) { - this.value = value; - } + MULTIPLE("MULTIPLE"), - public String getValue() { - return value; - } + NONE("NONE"), - @Override - public String toString() { - return String.valueOf(value); - } + SINGLE("SINGLE"); + + private String value; - public static CloudModeInstancesEnum fromValue(String value) { - for (CloudModeInstancesEnum b : CloudModeInstancesEnum.values()) { - if (b.value.equals(value)) { - return b; + CloudModeInstancesEnum(String value) { + this.value = value; } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final CloudModeInstancesEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public CloudModeInstancesEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return CloudModeInstancesEnum.fromValue(value); - } - } - } - - public static final String SERIALIZED_NAME_CLOUD_MODE_INSTANCES = "cloudModeInstances"; - @SerializedName(SERIALIZED_NAME_CLOUD_MODE_INSTANCES) - private CloudModeInstancesEnum cloudModeInstances; - - /** - * This Destination's support level for device mode instances. Support for multiple device mode instances is currently not planned. The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent. - */ - @JsonAdapter(DeviceModeInstancesEnum.Adapter.class) - public enum DeviceModeInstancesEnum { - _0("0"), - - _1("1"), - - NONE("NONE"), - - SINGLE("SINGLE"); - - private String value; - - DeviceModeInstancesEnum(String value) { - this.value = value; - } + public String getValue() { + return value; + } - public String getValue() { - return value; - } + @Override + public String toString() { + return String.valueOf(value); + } - @Override - public String toString() { - return String.valueOf(value); - } + public static CloudModeInstancesEnum fromValue(String value) { + for (CloudModeInstancesEnum b : CloudModeInstancesEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public static DeviceModeInstancesEnum fromValue(String value) { - for (DeviceModeInstancesEnum b : DeviceModeInstancesEnum.values()) { - if (b.value.equals(value)) { - return b; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CloudModeInstancesEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CloudModeInstancesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CloudModeInstancesEnum.fromValue(value); + } } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final DeviceModeInstancesEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public DeviceModeInstancesEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return DeviceModeInstancesEnum.fromValue(value); - } - } - } + public static final String SERIALIZED_NAME_CLOUD_MODE_INSTANCES = "cloudModeInstances"; - public static final String SERIALIZED_NAME_DEVICE_MODE_INSTANCES = "deviceModeInstances"; - @SerializedName(SERIALIZED_NAME_DEVICE_MODE_INSTANCES) - private DeviceModeInstancesEnum deviceModeInstances; + @SerializedName(SERIALIZED_NAME_CLOUD_MODE_INSTANCES) + private CloudModeInstancesEnum cloudModeInstances; - public static final String SERIALIZED_NAME_REPLAY = "replay"; - @SerializedName(SERIALIZED_NAME_REPLAY) - private Boolean replay; + /** + * This Destination's support level for device mode instances. Support for multiple device + * mode instances is currently not planned. The values '0' and 'NONE', and + * '1' and 'SINGLE' are equivalent. + */ + @JsonAdapter(DeviceModeInstancesEnum.Adapter.class) + public enum DeviceModeInstancesEnum { + _0("0"), - public static final String SERIALIZED_NAME_BROWSER_UNBUNDLING = "browserUnbundling"; - @SerializedName(SERIALIZED_NAME_BROWSER_UNBUNDLING) - private Boolean browserUnbundling; + _1("1"), - public static final String SERIALIZED_NAME_BROWSER_UNBUNDLING_PUBLIC = "browserUnbundlingPublic"; - @SerializedName(SERIALIZED_NAME_BROWSER_UNBUNDLING_PUBLIC) - private Boolean browserUnbundlingPublic; + NONE("NONE"), - public DestinationMetadataFeaturesV1() { - } + SINGLE("SINGLE"); - public DestinationMetadataFeaturesV1 cloudModeInstances(CloudModeInstancesEnum cloudModeInstances) { - - this.cloudModeInstances = cloudModeInstances; - return this; - } + private String value; - /** - * This Destination's support level for cloud mode instances. The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent. - * @return cloudModeInstances - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "This Destination's support level for cloud mode instances. The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent.") + DeviceModeInstancesEnum(String value) { + this.value = value; + } - public CloudModeInstancesEnum getCloudModeInstances() { - return cloudModeInstances; - } + public String getValue() { + return value; + } + @Override + public String toString() { + return String.valueOf(value); + } - public void setCloudModeInstances(CloudModeInstancesEnum cloudModeInstances) { - this.cloudModeInstances = cloudModeInstances; - } + public static DeviceModeInstancesEnum fromValue(String value) { + for (DeviceModeInstancesEnum b : DeviceModeInstancesEnum.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 DeviceModeInstancesEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DeviceModeInstancesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DeviceModeInstancesEnum.fromValue(value); + } + } + } - public DestinationMetadataFeaturesV1 deviceModeInstances(DeviceModeInstancesEnum deviceModeInstances) { - - this.deviceModeInstances = deviceModeInstances; - return this; - } + public static final String SERIALIZED_NAME_DEVICE_MODE_INSTANCES = "deviceModeInstances"; - /** - * This Destination's support level for device mode instances. Support for multiple device mode instances is currently not planned. The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent. - * @return deviceModeInstances - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "This Destination's support level for device mode instances. Support for multiple device mode instances is currently not planned. The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent.") + @SerializedName(SERIALIZED_NAME_DEVICE_MODE_INSTANCES) + private DeviceModeInstancesEnum deviceModeInstances; - public DeviceModeInstancesEnum getDeviceModeInstances() { - return deviceModeInstances; - } + public static final String SERIALIZED_NAME_REPLAY = "replay"; + @SerializedName(SERIALIZED_NAME_REPLAY) + private Boolean replay; - public void setDeviceModeInstances(DeviceModeInstancesEnum deviceModeInstances) { - this.deviceModeInstances = deviceModeInstances; - } + public static final String SERIALIZED_NAME_BROWSER_UNBUNDLING = "browserUnbundling"; + @SerializedName(SERIALIZED_NAME_BROWSER_UNBUNDLING) + private Boolean browserUnbundling; - public DestinationMetadataFeaturesV1 replay(Boolean replay) { - - this.replay = replay; - return this; - } + public static final String SERIALIZED_NAME_BROWSER_UNBUNDLING_PUBLIC = + "browserUnbundlingPublic"; - /** - * Whether this Destination supports replays. - * @return replay - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination supports replays.") + @SerializedName(SERIALIZED_NAME_BROWSER_UNBUNDLING_PUBLIC) + private Boolean browserUnbundlingPublic; - public Boolean getReplay() { - return replay; - } + public DestinationMetadataFeaturesV1() {} + public DestinationMetadataFeaturesV1 cloudModeInstances( + CloudModeInstancesEnum cloudModeInstances) { - public void setReplay(Boolean replay) { - this.replay = replay; - } + this.cloudModeInstances = cloudModeInstances; + return this; + } + /** + * This Destination's support level for cloud mode instances. The values '0' and + * 'NONE', and '1' and 'SINGLE' are equivalent. + * + * @return cloudModeInstances + */ + @javax.annotation.Nullable + public CloudModeInstancesEnum getCloudModeInstances() { + return cloudModeInstances; + } - public DestinationMetadataFeaturesV1 browserUnbundling(Boolean browserUnbundling) { - - this.browserUnbundling = browserUnbundling; - return this; - } + public void setCloudModeInstances(CloudModeInstancesEnum cloudModeInstances) { + this.cloudModeInstances = cloudModeInstances; + } - /** - * Whether this Destination supports browser unbundling. - * @return browserUnbundling - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination supports browser unbundling.") + public DestinationMetadataFeaturesV1 deviceModeInstances( + DeviceModeInstancesEnum deviceModeInstances) { - public Boolean getBrowserUnbundling() { - return browserUnbundling; - } + this.deviceModeInstances = deviceModeInstances; + return this; + } + /** + * This Destination's support level for device mode instances. Support for multiple device + * mode instances is currently not planned. The values '0' and 'NONE', and + * '1' and 'SINGLE' are equivalent. + * + * @return deviceModeInstances + */ + @javax.annotation.Nullable + public DeviceModeInstancesEnum getDeviceModeInstances() { + return deviceModeInstances; + } - public void setBrowserUnbundling(Boolean browserUnbundling) { - this.browserUnbundling = browserUnbundling; - } + public void setDeviceModeInstances(DeviceModeInstancesEnum deviceModeInstances) { + this.deviceModeInstances = deviceModeInstances; + } + public DestinationMetadataFeaturesV1 replay(Boolean replay) { - public DestinationMetadataFeaturesV1 browserUnbundlingPublic(Boolean browserUnbundlingPublic) { - - this.browserUnbundlingPublic = browserUnbundlingPublic; - return this; - } + this.replay = replay; + return this; + } - /** - * Whether this Destination supports public browser unbundling. - * @return browserUnbundlingPublic - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination supports public browser unbundling.") + /** + * Whether this Destination supports replays. + * + * @return replay + */ + @javax.annotation.Nullable + public Boolean getReplay() { + return replay; + } - public Boolean getBrowserUnbundlingPublic() { - return browserUnbundlingPublic; - } + public void setReplay(Boolean replay) { + this.replay = replay; + } + public DestinationMetadataFeaturesV1 browserUnbundling(Boolean browserUnbundling) { - public void setBrowserUnbundlingPublic(Boolean browserUnbundlingPublic) { - this.browserUnbundlingPublic = browserUnbundlingPublic; - } + this.browserUnbundling = browserUnbundling; + return this; + } + /** + * Whether this Destination supports browser unbundling. + * + * @return browserUnbundling + */ + @javax.annotation.Nullable + public Boolean getBrowserUnbundling() { + return browserUnbundling; + } + + public void setBrowserUnbundling(Boolean browserUnbundling) { + this.browserUnbundling = browserUnbundling; + } + public DestinationMetadataFeaturesV1 browserUnbundlingPublic(Boolean browserUnbundlingPublic) { - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + this.browserUnbundlingPublic = browserUnbundlingPublic; + return this; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Whether this Destination supports public browser unbundling. + * + * @return browserUnbundlingPublic + */ + @javax.annotation.Nullable + public Boolean getBrowserUnbundlingPublic() { + return browserUnbundlingPublic; } - DestinationMetadataFeaturesV1 destinationMetadataFeaturesV1 = (DestinationMetadataFeaturesV1) o; - return Objects.equals(this.cloudModeInstances, destinationMetadataFeaturesV1.cloudModeInstances) && - Objects.equals(this.deviceModeInstances, destinationMetadataFeaturesV1.deviceModeInstances) && - Objects.equals(this.replay, destinationMetadataFeaturesV1.replay) && - Objects.equals(this.browserUnbundling, destinationMetadataFeaturesV1.browserUnbundling) && - Objects.equals(this.browserUnbundlingPublic, destinationMetadataFeaturesV1.browserUnbundlingPublic); - } - - @Override - public int hashCode() { - return Objects.hash(cloudModeInstances, deviceModeInstances, replay, browserUnbundling, browserUnbundlingPublic); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationMetadataFeaturesV1 {\n"); - sb.append(" cloudModeInstances: ").append(toIndentedString(cloudModeInstances)).append("\n"); - sb.append(" deviceModeInstances: ").append(toIndentedString(deviceModeInstances)).append("\n"); - sb.append(" replay: ").append(toIndentedString(replay)).append("\n"); - sb.append(" browserUnbundling: ").append(toIndentedString(browserUnbundling)).append("\n"); - sb.append(" browserUnbundlingPublic: ").append(toIndentedString(browserUnbundlingPublic)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public void setBrowserUnbundlingPublic(Boolean browserUnbundlingPublic) { + this.browserUnbundlingPublic = browserUnbundlingPublic; } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("cloudModeInstances"); - openapiFields.add("deviceModeInstances"); - openapiFields.add("replay"); - openapiFields.add("browserUnbundling"); - openapiFields.add("browserUnbundlingPublic"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationMetadataFeaturesV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationMetadataFeaturesV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationMetadataFeaturesV1 is not found in the empty JSON string", DestinationMetadataFeaturesV1.openapiRequiredFields.toString())); - } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationMetadataFeaturesV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationMetadataFeaturesV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } - } - if ((jsonObj.get("cloudModeInstances") != null && !jsonObj.get("cloudModeInstances").isJsonNull()) && !jsonObj.get("cloudModeInstances").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `cloudModeInstances` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cloudModeInstances").toString())); - } - if ((jsonObj.get("deviceModeInstances") != null && !jsonObj.get("deviceModeInstances").isJsonNull()) && !jsonObj.get("deviceModeInstances").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `deviceModeInstances` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deviceModeInstances").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") + DestinationMetadataFeaturesV1 destinationMetadataFeaturesV1 = + (DestinationMetadataFeaturesV1) o; + return Objects.equals( + this.cloudModeInstances, destinationMetadataFeaturesV1.cloudModeInstances) + && Objects.equals( + this.deviceModeInstances, destinationMetadataFeaturesV1.deviceModeInstances) + && Objects.equals(this.replay, destinationMetadataFeaturesV1.replay) + && Objects.equals( + this.browserUnbundling, destinationMetadataFeaturesV1.browserUnbundling) + && Objects.equals( + this.browserUnbundlingPublic, + destinationMetadataFeaturesV1.browserUnbundlingPublic); + } + @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationMetadataFeaturesV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationMetadataFeaturesV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationMetadataFeaturesV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationMetadataFeaturesV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationMetadataFeaturesV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public int hashCode() { + return Objects.hash( + cloudModeInstances, + deviceModeInstances, + replay, + browserUnbundling, + browserUnbundlingPublic); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationMetadataFeaturesV1 {\n"); + sb.append(" cloudModeInstances: ") + .append(toIndentedString(cloudModeInstances)) + .append("\n"); + sb.append(" deviceModeInstances: ") + .append(toIndentedString(deviceModeInstances)) + .append("\n"); + sb.append(" replay: ").append(toIndentedString(replay)).append("\n"); + sb.append(" browserUnbundling: ") + .append(toIndentedString(browserUnbundling)) + .append("\n"); + sb.append(" browserUnbundlingPublic: ") + .append(toIndentedString(browserUnbundlingPublic)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("cloudModeInstances"); + openapiFields.add("deviceModeInstances"); + openapiFields.add("replay"); + openapiFields.add("browserUnbundling"); + openapiFields.add("browserUnbundlingPublic"); + + // 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 + * DestinationMetadataFeaturesV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationMetadataFeaturesV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationMetadataFeaturesV1 is not" + + " found in the empty JSON string", + DestinationMetadataFeaturesV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationMetadataFeaturesV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationMetadataFeaturesV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("cloudModeInstances") != null + && !jsonObj.get("cloudModeInstances").isJsonNull()) + && !jsonObj.get("cloudModeInstances").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `cloudModeInstances` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("cloudModeInstances").toString())); + } + if ((jsonObj.get("deviceModeInstances") != null + && !jsonObj.get("deviceModeInstances").isJsonNull()) + && !jsonObj.get("deviceModeInstances").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `deviceModeInstances` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("deviceModeInstances").toString())); + } } - } - - /** - * Create an instance of DestinationMetadataFeaturesV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationMetadataFeaturesV1 - * @throws IOException if the JSON string is invalid with respect to DestinationMetadataFeaturesV1 - */ - public static DestinationMetadataFeaturesV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationMetadataFeaturesV1.class); - } - - /** - * Convert an instance of DestinationMetadataFeaturesV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationMetadataFeaturesV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationMetadataFeaturesV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DestinationMetadataFeaturesV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationMetadataFeaturesV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationMetadataFeaturesV1 read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DestinationMetadataFeaturesV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationMetadataFeaturesV1 + * @throws IOException if the JSON string is invalid with respect to + * DestinationMetadataFeaturesV1 + */ + public static DestinationMetadataFeaturesV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationMetadataFeaturesV1.class); + } + + /** + * Convert an instance of DestinationMetadataFeaturesV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationMetadataMethodsV1.java b/src/main/java/com/segment/publicapi/models/DestinationMetadataMethodsV1.java index 68da12c3..c3ff0e9a 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationMetadataMethodsV1.java +++ b/src/main/java/com/segment/publicapi/models/DestinationMetadataMethodsV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,317 +9,298 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Represents methods that a given Destination supports. */ +public class DestinationMetadataMethodsV1 { + public static final String SERIALIZED_NAME_PAGEVIEW = "pageview"; -/** - * Represents methods that a given Destination supports. - */ -@ApiModel(description = "Represents methods that a given Destination supports.") + @SerializedName(SERIALIZED_NAME_PAGEVIEW) + private Boolean pageview; -public class DestinationMetadataMethodsV1 { - public static final String SERIALIZED_NAME_PAGEVIEW = "pageview"; - @SerializedName(SERIALIZED_NAME_PAGEVIEW) - private Boolean pageview; - - public static final String SERIALIZED_NAME_IDENTIFY = "identify"; - @SerializedName(SERIALIZED_NAME_IDENTIFY) - private Boolean identify; - - public static final String SERIALIZED_NAME_ALIAS = "alias"; - @SerializedName(SERIALIZED_NAME_ALIAS) - private Boolean alias; + public static final String SERIALIZED_NAME_IDENTIFY = "identify"; - public static final String SERIALIZED_NAME_TRACK = "track"; - @SerializedName(SERIALIZED_NAME_TRACK) - private Boolean track; + @SerializedName(SERIALIZED_NAME_IDENTIFY) + private Boolean identify; - public static final String SERIALIZED_NAME_GROUP = "group"; - @SerializedName(SERIALIZED_NAME_GROUP) - private Boolean group; + public static final String SERIALIZED_NAME_ALIAS = "alias"; - public DestinationMetadataMethodsV1() { - } + @SerializedName(SERIALIZED_NAME_ALIAS) + private Boolean alias; - public DestinationMetadataMethodsV1 pageview(Boolean pageview) { - - this.pageview = pageview; - return this; - } + public static final String SERIALIZED_NAME_TRACK = "track"; - /** - * Identifies if the Destination supports the `pageview` method. - * @return pageview - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Identifies if the Destination supports the `pageview` method.") + @SerializedName(SERIALIZED_NAME_TRACK) + private Boolean track; - public Boolean getPageview() { - return pageview; - } + public static final String SERIALIZED_NAME_GROUP = "group"; + @SerializedName(SERIALIZED_NAME_GROUP) + private Boolean group; - public void setPageview(Boolean pageview) { - this.pageview = pageview; - } + public DestinationMetadataMethodsV1() {} + public DestinationMetadataMethodsV1 pageview(Boolean pageview) { - public DestinationMetadataMethodsV1 identify(Boolean identify) { - - this.identify = identify; - return this; - } + this.pageview = pageview; + return this; + } - /** - * Identifies if the Destination supports the `identify` method. - * @return identify - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Identifies if the Destination supports the `identify` method.") + /** + * Identifies if the Destination supports the `pageview` method. + * + * @return pageview + */ + @javax.annotation.Nullable + public Boolean getPageview() { + return pageview; + } - public Boolean getIdentify() { - return identify; - } + public void setPageview(Boolean pageview) { + this.pageview = pageview; + } + public DestinationMetadataMethodsV1 identify(Boolean identify) { - public void setIdentify(Boolean identify) { - this.identify = identify; - } + this.identify = identify; + return this; + } + /** + * Identifies if the Destination supports the `identify` method. + * + * @return identify + */ + @javax.annotation.Nullable + public Boolean getIdentify() { + return identify; + } - public DestinationMetadataMethodsV1 alias(Boolean alias) { - - this.alias = alias; - return this; - } + public void setIdentify(Boolean identify) { + this.identify = identify; + } - /** - * Identifies if the Destination supports the `alias` method. - * @return alias - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Identifies if the Destination supports the `alias` method.") + public DestinationMetadataMethodsV1 alias(Boolean alias) { - public Boolean getAlias() { - return alias; - } + this.alias = alias; + return this; + } + /** + * Identifies if the Destination supports the `alias` method. + * + * @return alias + */ + @javax.annotation.Nullable + public Boolean getAlias() { + return alias; + } - public void setAlias(Boolean alias) { - this.alias = alias; - } + public void setAlias(Boolean alias) { + this.alias = alias; + } + public DestinationMetadataMethodsV1 track(Boolean track) { - public DestinationMetadataMethodsV1 track(Boolean track) { - - this.track = track; - return this; - } + this.track = track; + return this; + } - /** - * Identifies if the Destination supports the `track` method. - * @return track - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Identifies if the Destination supports the `track` method.") + /** + * Identifies if the Destination supports the `track` method. + * + * @return track + */ + @javax.annotation.Nullable + public Boolean getTrack() { + return track; + } - public Boolean getTrack() { - return track; - } + public void setTrack(Boolean track) { + this.track = track; + } + public DestinationMetadataMethodsV1 group(Boolean group) { - public void setTrack(Boolean track) { - this.track = track; - } + this.group = group; + return this; + } + /** + * Identifies if the Destination supports the `group` method. + * + * @return group + */ + @javax.annotation.Nullable + public Boolean getGroup() { + return group; + } - public DestinationMetadataMethodsV1 group(Boolean group) { - - this.group = group; - return this; - } + public void setGroup(Boolean group) { + this.group = group; + } - /** - * Identifies if the Destination supports the `group` method. - * @return group - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Identifies if the Destination supports the `group` method.") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationMetadataMethodsV1 destinationMetadataMethodsV1 = + (DestinationMetadataMethodsV1) o; + return Objects.equals(this.pageview, destinationMetadataMethodsV1.pageview) + && Objects.equals(this.identify, destinationMetadataMethodsV1.identify) + && Objects.equals(this.alias, destinationMetadataMethodsV1.alias) + && Objects.equals(this.track, destinationMetadataMethodsV1.track) + && Objects.equals(this.group, destinationMetadataMethodsV1.group); + } - public Boolean getGroup() { - return group; - } + @Override + public int hashCode() { + return Objects.hash(pageview, identify, alias, track, group); + } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationMetadataMethodsV1 {\n"); + sb.append(" pageview: ").append(toIndentedString(pageview)).append("\n"); + sb.append(" identify: ").append(toIndentedString(identify)).append("\n"); + sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); + sb.append(" track: ").append(toIndentedString(track)).append("\n"); + sb.append(" group: ").append(toIndentedString(group)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public void setGroup(Boolean group) { - this.group = group; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("pageview"); + openapiFields.add("identify"); + openapiFields.add("alias"); + openapiFields.add("track"); + openapiFields.add("group"); - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); } - DestinationMetadataMethodsV1 destinationMetadataMethodsV1 = (DestinationMetadataMethodsV1) o; - return Objects.equals(this.pageview, destinationMetadataMethodsV1.pageview) && - Objects.equals(this.identify, destinationMetadataMethodsV1.identify) && - Objects.equals(this.alias, destinationMetadataMethodsV1.alias) && - Objects.equals(this.track, destinationMetadataMethodsV1.track) && - Objects.equals(this.group, destinationMetadataMethodsV1.group); - } - - @Override - public int hashCode() { - return Objects.hash(pageview, identify, alias, track, group); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationMetadataMethodsV1 {\n"); - sb.append(" pageview: ").append(toIndentedString(pageview)).append("\n"); - sb.append(" identify: ").append(toIndentedString(identify)).append("\n"); - sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); - sb.append(" track: ").append(toIndentedString(track)).append("\n"); - sb.append(" group: ").append(toIndentedString(group)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("pageview"); - openapiFields.add("identify"); - openapiFields.add("alias"); - openapiFields.add("track"); - openapiFields.add("group"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationMetadataMethodsV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationMetadataMethodsV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationMetadataMethodsV1 is not found in the empty JSON string", DestinationMetadataMethodsV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DestinationMetadataMethodsV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationMetadataMethodsV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationMetadataMethodsV1 is not" + + " found in the empty JSON string", + DestinationMetadataMethodsV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationMetadataMethodsV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationMetadataMethodsV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationMetadataMethodsV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationMetadataMethodsV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationMetadataMethodsV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationMetadataMethodsV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DestinationMetadataMethodsV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationMetadataMethodsV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationMetadataMethodsV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationMetadataMethodsV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationMetadataMethodsV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationMetadataMethodsV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationMetadataMethodsV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationMetadataMethodsV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + /** + * Create an instance of DestinationMetadataMethodsV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationMetadataMethodsV1 + * @throws IOException if the JSON string is invalid with respect to + * DestinationMetadataMethodsV1 + */ + public static DestinationMetadataMethodsV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationMetadataMethodsV1.class); } - } - - /** - * Create an instance of DestinationMetadataMethodsV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationMetadataMethodsV1 - * @throws IOException if the JSON string is invalid with respect to DestinationMetadataMethodsV1 - */ - public static DestinationMetadataMethodsV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationMetadataMethodsV1.class); - } - - /** - * Convert an instance of DestinationMetadataMethodsV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DestinationMetadataMethodsV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationMetadataPlatformsV1.java b/src/main/java/com/segment/publicapi/models/DestinationMetadataPlatformsV1.java index e36d591f..2394ad7f 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationMetadataPlatformsV1.java +++ b/src/main/java/com/segment/publicapi/models/DestinationMetadataPlatformsV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,257 +9,329 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Represents platforms that a given Destination supports. */ +public class DestinationMetadataPlatformsV1 { + public static final String SERIALIZED_NAME_BROWSER = "browser"; -/** - * Represents platforms that a given Destination supports. - */ -@ApiModel(description = "Represents platforms that a given Destination supports.") + @SerializedName(SERIALIZED_NAME_BROWSER) + private Boolean browser; -public class DestinationMetadataPlatformsV1 { - public static final String SERIALIZED_NAME_BROWSER = "browser"; - @SerializedName(SERIALIZED_NAME_BROWSER) - private Boolean browser; + public static final String SERIALIZED_NAME_SERVER = "server"; - public static final String SERIALIZED_NAME_SERVER = "server"; - @SerializedName(SERIALIZED_NAME_SERVER) - private Boolean server; + @SerializedName(SERIALIZED_NAME_SERVER) + private Boolean server; - public static final String SERIALIZED_NAME_MOBILE = "mobile"; - @SerializedName(SERIALIZED_NAME_MOBILE) - private Boolean mobile; + public static final String SERIALIZED_NAME_MOBILE = "mobile"; - public DestinationMetadataPlatformsV1() { - } + @SerializedName(SERIALIZED_NAME_MOBILE) + private Boolean mobile; - public DestinationMetadataPlatformsV1 browser(Boolean browser) { - - this.browser = browser; - return this; - } + public static final String SERIALIZED_NAME_WAREHOUSE = "warehouse"; - /** - * Whether this Destination supports browser events. - * @return browser - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination supports browser events.") + @SerializedName(SERIALIZED_NAME_WAREHOUSE) + private Boolean warehouse; - public Boolean getBrowser() { - return browser; - } + public static final String SERIALIZED_NAME_CLOUD_APP_OBJECT = "cloudAppObject"; + @SerializedName(SERIALIZED_NAME_CLOUD_APP_OBJECT) + private Boolean cloudAppObject; - public void setBrowser(Boolean browser) { - this.browser = browser; - } + public static final String SERIALIZED_NAME_LINKED_AUDIENCES = "linkedAudiences"; + @SerializedName(SERIALIZED_NAME_LINKED_AUDIENCES) + private Boolean linkedAudiences; - public DestinationMetadataPlatformsV1 server(Boolean server) { - - this.server = server; - return this; - } + public DestinationMetadataPlatformsV1() {} - /** - * Whether this Destination supports server events. - * @return server - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination supports server events.") + public DestinationMetadataPlatformsV1 browser(Boolean browser) { - public Boolean getServer() { - return server; - } + this.browser = browser; + return this; + } + /** + * Whether this Destination supports browser events. + * + * @return browser + */ + @javax.annotation.Nullable + public Boolean getBrowser() { + return browser; + } - public void setServer(Boolean server) { - this.server = server; - } + public void setBrowser(Boolean browser) { + this.browser = browser; + } + public DestinationMetadataPlatformsV1 server(Boolean server) { + + this.server = server; + return this; + } + + /** + * Whether this Destination supports server events. + * + * @return server + */ + @javax.annotation.Nullable + public Boolean getServer() { + return server; + } - public DestinationMetadataPlatformsV1 mobile(Boolean mobile) { - - this.mobile = mobile; - return this; - } + public void setServer(Boolean server) { + this.server = server; + } - /** - * Whether this Destination supports mobile events. - * @return mobile - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination supports mobile events.") + public DestinationMetadataPlatformsV1 mobile(Boolean mobile) { - public Boolean getMobile() { - return mobile; - } + this.mobile = mobile; + return this; + } + /** + * Whether this Destination supports mobile events. + * + * @return mobile + */ + @javax.annotation.Nullable + public Boolean getMobile() { + return mobile; + } - public void setMobile(Boolean mobile) { - this.mobile = mobile; - } + public void setMobile(Boolean mobile) { + this.mobile = mobile; + } + public DestinationMetadataPlatformsV1 warehouse(Boolean warehouse) { + this.warehouse = warehouse; + return this; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Whether this Destination supports Warehouse events. + * + * @return warehouse + */ + @javax.annotation.Nullable + public Boolean getWarehouse() { + return warehouse; } - if (o == null || getClass() != o.getClass()) { - return false; + + public void setWarehouse(Boolean warehouse) { + this.warehouse = warehouse; } - DestinationMetadataPlatformsV1 destinationMetadataPlatformsV1 = (DestinationMetadataPlatformsV1) o; - return Objects.equals(this.browser, destinationMetadataPlatformsV1.browser) && - Objects.equals(this.server, destinationMetadataPlatformsV1.server) && - Objects.equals(this.mobile, destinationMetadataPlatformsV1.mobile); - } - - @Override - public int hashCode() { - return Objects.hash(browser, server, mobile); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationMetadataPlatformsV1 {\n"); - sb.append(" browser: ").append(toIndentedString(browser)).append("\n"); - sb.append(" server: ").append(toIndentedString(server)).append("\n"); - sb.append(" mobile: ").append(toIndentedString(mobile)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public DestinationMetadataPlatformsV1 cloudAppObject(Boolean cloudAppObject) { + + this.cloudAppObject = cloudAppObject; + return this; } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("browser"); - openapiFields.add("server"); - openapiFields.add("mobile"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationMetadataPlatformsV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationMetadataPlatformsV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationMetadataPlatformsV1 is not found in the empty JSON string", DestinationMetadataPlatformsV1.openapiRequiredFields.toString())); - } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationMetadataPlatformsV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationMetadataPlatformsV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + /** + * Whether this Destination supports cloud app object events. + * + * @return cloudAppObject + */ + @javax.annotation.Nullable + public Boolean getCloudAppObject() { + return cloudAppObject; + } + + public void setCloudAppObject(Boolean cloudAppObject) { + this.cloudAppObject = cloudAppObject; + } + + public DestinationMetadataPlatformsV1 linkedAudiences(Boolean linkedAudiences) { + + this.linkedAudiences = linkedAudiences; + return this; + } + + /** + * Whether this Destination supports linked audiences. + * + * @return linkedAudiences + */ + @javax.annotation.Nullable + public Boolean getLinkedAudiences() { + return linkedAudiences; + } + + public void setLinkedAudiences(Boolean linkedAudiences) { + this.linkedAudiences = linkedAudiences; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - } - } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationMetadataPlatformsV1 destinationMetadataPlatformsV1 = + (DestinationMetadataPlatformsV1) o; + return Objects.equals(this.browser, destinationMetadataPlatformsV1.browser) + && Objects.equals(this.server, destinationMetadataPlatformsV1.server) + && Objects.equals(this.mobile, destinationMetadataPlatformsV1.mobile) + && Objects.equals(this.warehouse, destinationMetadataPlatformsV1.warehouse) + && Objects.equals( + this.cloudAppObject, destinationMetadataPlatformsV1.cloudAppObject) + && Objects.equals( + this.linkedAudiences, destinationMetadataPlatformsV1.linkedAudiences); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationMetadataPlatformsV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationMetadataPlatformsV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationMetadataPlatformsV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationMetadataPlatformsV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationMetadataPlatformsV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public int hashCode() { + return Objects.hash(browser, server, mobile, warehouse, cloudAppObject, linkedAudiences); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationMetadataPlatformsV1 {\n"); + sb.append(" browser: ").append(toIndentedString(browser)).append("\n"); + sb.append(" server: ").append(toIndentedString(server)).append("\n"); + sb.append(" mobile: ").append(toIndentedString(mobile)).append("\n"); + sb.append(" warehouse: ").append(toIndentedString(warehouse)).append("\n"); + sb.append(" cloudAppObject: ").append(toIndentedString(cloudAppObject)).append("\n"); + sb.append(" linkedAudiences: ").append(toIndentedString(linkedAudiences)).append("\n"); + sb.append("}"); + return sb.toString(); } - } - - /** - * Create an instance of DestinationMetadataPlatformsV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationMetadataPlatformsV1 - * @throws IOException if the JSON string is invalid with respect to DestinationMetadataPlatformsV1 - */ - public static DestinationMetadataPlatformsV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationMetadataPlatformsV1.class); - } - - /** - * Convert an instance of DestinationMetadataPlatformsV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("browser"); + openapiFields.add("server"); + openapiFields.add("mobile"); + openapiFields.add("warehouse"); + openapiFields.add("cloudAppObject"); + openapiFields.add("linkedAudiences"); + + // 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 + * DestinationMetadataPlatformsV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationMetadataPlatformsV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationMetadataPlatformsV1 is not" + + " found in the empty JSON string", + DestinationMetadataPlatformsV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationMetadataPlatformsV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationMetadataPlatformsV1` 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 (!DestinationMetadataPlatformsV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationMetadataPlatformsV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DestinationMetadataPlatformsV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationMetadataPlatformsV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationMetadataPlatformsV1 read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DestinationMetadataPlatformsV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationMetadataPlatformsV1 + * @throws IOException if the JSON string is invalid with respect to + * DestinationMetadataPlatformsV1 + */ + public static DestinationMetadataPlatformsV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationMetadataPlatformsV1.class); + } + + /** + * Convert an instance of DestinationMetadataPlatformsV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationMetadataSubscriptionPresetV1.java b/src/main/java/com/segment/publicapi/models/DestinationMetadataSubscriptionPresetV1.java index 9de1bc8c..997a62ea 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationMetadataSubscriptionPresetV1.java +++ b/src/main/java/com/segment/publicapi/models/DestinationMetadataSubscriptionPresetV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,314 +9,323 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.HashMap; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Represents a set of defaults for a Destination subscription. - */ -@ApiModel(description = "Represents a set of defaults for a Destination subscription.") - +/** Represents a set of defaults for a Destination subscription. */ public class DestinationMetadataSubscriptionPresetV1 { - public static final String SERIALIZED_NAME_ACTION_ID = "actionId"; - @SerializedName(SERIALIZED_NAME_ACTION_ID) - private String actionId; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_FIELDS = "fields"; - @SerializedName(SERIALIZED_NAME_FIELDS) - private Map fields = new HashMap<>(); - - public static final String SERIALIZED_NAME_TRIGGER = "trigger"; - @SerializedName(SERIALIZED_NAME_TRIGGER) - private String trigger; + public static final String SERIALIZED_NAME_ACTION_ID = "actionId"; - public DestinationMetadataSubscriptionPresetV1() { - } + @SerializedName(SERIALIZED_NAME_ACTION_ID) + private String actionId; - public DestinationMetadataSubscriptionPresetV1 actionId(String actionId) { - - this.actionId = actionId; - return this; - } + public static final String SERIALIZED_NAME_NAME = "name"; - /** - * The unique identifier for the Destination Action to trigger. - * @return actionId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier for the Destination Action to trigger.") + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public String getActionId() { - return actionId; - } + public static final String SERIALIZED_NAME_FIELDS = "fields"; + @SerializedName(SERIALIZED_NAME_FIELDS) + private Map fields = new HashMap<>(); - public void setActionId(String actionId) { - this.actionId = actionId; - } + public static final String SERIALIZED_NAME_TRIGGER = "trigger"; + @SerializedName(SERIALIZED_NAME_TRIGGER) + private String trigger; - public DestinationMetadataSubscriptionPresetV1 name(String name) { - - this.name = name; - return this; - } + public DestinationMetadataSubscriptionPresetV1() {} - /** - * The name of the subscription. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the subscription.") + public DestinationMetadataSubscriptionPresetV1 actionId(String actionId) { - public String getName() { - return name; - } + this.actionId = actionId; + return this; + } + /** + * The unique identifier for the Destination Action to trigger. + * + * @return actionId + */ + @javax.annotation.Nonnull + public String getActionId() { + return actionId; + } - public void setName(String name) { - this.name = name; - } + public void setActionId(String actionId) { + this.actionId = actionId; + } + public DestinationMetadataSubscriptionPresetV1 name(String name) { - public DestinationMetadataSubscriptionPresetV1 fields(Map fields) { - - this.fields = fields; - return this; - } + this.name = name; + return this; + } - public DestinationMetadataSubscriptionPresetV1 putFieldsItem(String key, Object fieldsItem) { - this.fields.put(key, fieldsItem); - return this; - } + /** + * The name of the subscription. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - /** - * The default settings for action fields. - * @return fields - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The default settings for action fields.") + public void setName(String name) { + this.name = name; + } - public Map getFields() { - return fields; - } + public DestinationMetadataSubscriptionPresetV1 fields(Map fields) { + this.fields = fields; + return this; + } - public void setFields(Map fields) { - this.fields = fields; - } + public DestinationMetadataSubscriptionPresetV1 putFieldsItem(String key, Object fieldsItem) { + if (this.fields == null) { + this.fields = new HashMap<>(); + } + this.fields.put(key, fieldsItem); + return this; + } + /** + * The default settings for action fields. + * + * @return fields + */ + @javax.annotation.Nonnull + public Map getFields() { + return fields; + } - public DestinationMetadataSubscriptionPresetV1 trigger(String trigger) { - - this.trigger = trigger; - return this; - } + public void setFields(Map fields) { + this.fields = fields; + } - /** - * FQL string that describes what events should trigger an action. See https://segment.com/docs/config-api/fql/ for more information regarding Segment's Filter Query Language (FQL). - * @return trigger - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "FQL string that describes what events should trigger an action. See https://segment.com/docs/config-api/fql/ for more information regarding Segment's Filter Query Language (FQL).") + public DestinationMetadataSubscriptionPresetV1 trigger(String trigger) { - public String getTrigger() { - return trigger; - } + this.trigger = trigger; + return this; + } + /** + * FQL string that describes what events should trigger an action. See + * https://segment.com/docs/config-api/fql/ for more information regarding Segment's Filter + * Query Language (FQL). + * + * @return trigger + */ + @javax.annotation.Nonnull + public String getTrigger() { + return trigger; + } - public void setTrigger(String trigger) { - this.trigger = trigger; - } + public void setTrigger(String trigger) { + this.trigger = trigger; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationMetadataSubscriptionPresetV1 destinationMetadataSubscriptionPresetV1 = + (DestinationMetadataSubscriptionPresetV1) o; + return Objects.equals(this.actionId, destinationMetadataSubscriptionPresetV1.actionId) + && Objects.equals(this.name, destinationMetadataSubscriptionPresetV1.name) + && Objects.equals(this.fields, destinationMetadataSubscriptionPresetV1.fields) + && Objects.equals(this.trigger, destinationMetadataSubscriptionPresetV1.trigger); + } + @Override + public int hashCode() { + return Objects.hash(actionId, name, fields, trigger); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationMetadataSubscriptionPresetV1 {\n"); + sb.append(" actionId: ").append(toIndentedString(actionId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DestinationMetadataSubscriptionPresetV1 destinationMetadataSubscriptionPresetV1 = (DestinationMetadataSubscriptionPresetV1) o; - return Objects.equals(this.actionId, destinationMetadataSubscriptionPresetV1.actionId) && - Objects.equals(this.name, destinationMetadataSubscriptionPresetV1.name) && - Objects.equals(this.fields, destinationMetadataSubscriptionPresetV1.fields) && - Objects.equals(this.trigger, destinationMetadataSubscriptionPresetV1.trigger); - } - - @Override - public int hashCode() { - return Objects.hash(actionId, name, fields, trigger); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationMetadataSubscriptionPresetV1 {\n"); - sb.append(" actionId: ").append(toIndentedString(actionId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); - sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionId"); + openapiFields.add("name"); + openapiFields.add("fields"); + openapiFields.add("trigger"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("actionId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("fields"); + openapiRequiredFields.add("trigger"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("actionId"); - openapiFields.add("name"); - openapiFields.add("fields"); - openapiFields.add("trigger"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("actionId"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("fields"); - openapiRequiredFields.add("trigger"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationMetadataSubscriptionPresetV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationMetadataSubscriptionPresetV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationMetadataSubscriptionPresetV1 is not found in the empty JSON string", DestinationMetadataSubscriptionPresetV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DestinationMetadataSubscriptionPresetV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationMetadataSubscriptionPresetV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " DestinationMetadataSubscriptionPresetV1 is not found in the" + + " empty JSON string", + DestinationMetadataSubscriptionPresetV1.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationMetadataSubscriptionPresetV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationMetadataSubscriptionPresetV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationMetadataSubscriptionPresetV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationMetadataSubscriptionPresetV1` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DestinationMetadataSubscriptionPresetV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationMetadataSubscriptionPresetV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("actionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `actionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("actionId").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("trigger").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `trigger` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("trigger").toString())); } - } - if (!jsonObj.get("actionId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `actionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actionId").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("trigger").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `trigger` to be a primitive type in the JSON string but got `%s`", jsonObj.get("trigger").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationMetadataSubscriptionPresetV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationMetadataSubscriptionPresetV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationMetadataSubscriptionPresetV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationMetadataSubscriptionPresetV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationMetadataSubscriptionPresetV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DestinationMetadataSubscriptionPresetV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationMetadataSubscriptionPresetV1 - * @throws IOException if the JSON string is invalid with respect to DestinationMetadataSubscriptionPresetV1 - */ - public static DestinationMetadataSubscriptionPresetV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationMetadataSubscriptionPresetV1.class); - } - - /** - * Convert an instance of DestinationMetadataSubscriptionPresetV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationMetadataSubscriptionPresetV1.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'DestinationMetadataSubscriptionPresetV1' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DestinationMetadataSubscriptionPresetV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, DestinationMetadataSubscriptionPresetV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationMetadataSubscriptionPresetV1 read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DestinationMetadataSubscriptionPresetV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationMetadataSubscriptionPresetV1 + * @throws IOException if the JSON string is invalid with respect to + * DestinationMetadataSubscriptionPresetV1 + */ + public static DestinationMetadataSubscriptionPresetV1 fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationMetadataSubscriptionPresetV1.class); + } + + /** + * Convert an instance of DestinationMetadataSubscriptionPresetV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationMetadataV1.java b/src/main/java/com/segment/publicapi/models/DestinationMetadataV1.java index 996da12a..136424e8 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationMetadataV1.java +++ b/src/main/java/com/segment/publicapi/models/DestinationMetadataV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,899 +9,1119 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.segment.publicapi.models.Contact; -import com.segment.publicapi.models.DestinationMetadataActionV1; -import com.segment.publicapi.models.DestinationMetadataComponentV1; -import com.segment.publicapi.models.DestinationMetadataSubscriptionPresetV1; -import com.segment.publicapi.models.IntegrationOptionBeta; -import com.segment.publicapi.models.Logos; -import com.segment.publicapi.models.SupportedFeatures; -import com.segment.publicapi.models.SupportedMethods; -import com.segment.publicapi.models.SupportedPlatforms; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - /** - * Represents a Destination within Segment. A Destination is a target for Segment to forward data to, and represents a tool or storage Destination. + * Represents a Destination within Segment. A Destination is a target for Segment to forward data + * to, and represents a tool or storage Destination. */ -@ApiModel(description = "Represents a Destination within Segment. A Destination is a target for Segment to forward data to, and represents a tool or storage Destination.") - public class DestinationMetadataV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_LOGOS = "logos"; - @SerializedName(SERIALIZED_NAME_LOGOS) - private Logos logos; - - public static final String SERIALIZED_NAME_OPTIONS = "options"; - @SerializedName(SERIALIZED_NAME_OPTIONS) - private List options = new ArrayList<>(); - - /** - * Support status of the Destination. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - DEPRECATED("DEPRECATED"), - - PRIVATE_BETA("PRIVATE_BETA"), - - PRIVATE_BUILDING("PRIVATE_BUILDING"), - - PRIVATE_SUBMITTED("PRIVATE_SUBMITTED"), - - PUBLIC("PUBLIC"), - - PUBLIC_BETA("PUBLIC_BETA"), - - UNAVAILABLE("UNAVAILABLE"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } + public static final String SERIALIZED_NAME_ID = "id"; - @Override - public String toString() { - return String.valueOf(value); - } + @SerializedName(SERIALIZED_NAME_ID) + private String id; - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_SLUG = "slug"; + + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; + + public static final String SERIALIZED_NAME_LOGOS = "logos"; + + @SerializedName(SERIALIZED_NAME_LOGOS) + private LogosBeta logos; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + + @SerializedName(SERIALIZED_NAME_OPTIONS) + private List options = new ArrayList<>(); + + /** Support status of the Destination. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + DEPRECATED("DEPRECATED"), + + PRIVATE_BETA("PRIVATE_BETA"), + + PRIVATE_BUILDING("PRIVATE_BUILDING"), + + PRIVATE_SUBMITTED("PRIVATE_SUBMITTED"), + + PUBLIC("PUBLIC"), + + PUBLIC_BETA("PUBLIC_BETA"), + + UNAVAILABLE("UNAVAILABLE"); + + private String value; + + StatusEnum(String value) { + this.value = value; } - } - 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()); - } + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } - @Override - public StatusEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return StatusEnum.fromValue(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_STATUS = "status"; - public static final String SERIALIZED_NAME_PREVIOUS_NAMES = "previousNames"; - @SerializedName(SERIALIZED_NAME_PREVIOUS_NAMES) - private List previousNames = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public static final String SERIALIZED_NAME_CATEGORIES = "categories"; - @SerializedName(SERIALIZED_NAME_CATEGORIES) - private List categories = new ArrayList<>(); + public static final String SERIALIZED_NAME_PREVIOUS_NAMES = "previousNames"; - public static final String SERIALIZED_NAME_WEBSITE = "website"; - @SerializedName(SERIALIZED_NAME_WEBSITE) - private String website; + @SerializedName(SERIALIZED_NAME_PREVIOUS_NAMES) + private List previousNames = new ArrayList<>(); - public static final String SERIALIZED_NAME_COMPONENTS = "components"; - @SerializedName(SERIALIZED_NAME_COMPONENTS) - private List components = new ArrayList<>(); + public static final String SERIALIZED_NAME_CATEGORIES = "categories"; - public static final String SERIALIZED_NAME_SUPPORTED_FEATURES = "supportedFeatures"; - @SerializedName(SERIALIZED_NAME_SUPPORTED_FEATURES) - private SupportedFeatures supportedFeatures; + @SerializedName(SERIALIZED_NAME_CATEGORIES) + private List categories = new ArrayList<>(); - public static final String SERIALIZED_NAME_SUPPORTED_METHODS = "supportedMethods"; - @SerializedName(SERIALIZED_NAME_SUPPORTED_METHODS) - private SupportedMethods supportedMethods; + public static final String SERIALIZED_NAME_WEBSITE = "website"; - public static final String SERIALIZED_NAME_SUPPORTED_PLATFORMS = "supportedPlatforms"; - @SerializedName(SERIALIZED_NAME_SUPPORTED_PLATFORMS) - private SupportedPlatforms supportedPlatforms; + @SerializedName(SERIALIZED_NAME_WEBSITE) + private String website; - public static final String SERIALIZED_NAME_ACTIONS = "actions"; - @SerializedName(SERIALIZED_NAME_ACTIONS) - private List actions = new ArrayList<>(); + public static final String SERIALIZED_NAME_COMPONENTS = "components"; - public static final String SERIALIZED_NAME_PRESETS = "presets"; - @SerializedName(SERIALIZED_NAME_PRESETS) - private List presets = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_COMPONENTS) + private List components = new ArrayList<>(); - public static final String SERIALIZED_NAME_CONTACTS = "contacts"; - @SerializedName(SERIALIZED_NAME_CONTACTS) - private List contacts = null; + public static final String SERIALIZED_NAME_SUPPORTED_FEATURES = "supportedFeatures"; - public static final String SERIALIZED_NAME_PARTNER_OWNED = "partnerOwned"; - @SerializedName(SERIALIZED_NAME_PARTNER_OWNED) - private Boolean partnerOwned; + @SerializedName(SERIALIZED_NAME_SUPPORTED_FEATURES) + private DestinationMetadataFeaturesV1 supportedFeatures; - public DestinationMetadataV1() { - } + public static final String SERIALIZED_NAME_SUPPORTED_METHODS = "supportedMethods"; - public DestinationMetadataV1 id(String id) { - - this.id = id; - return this; - } + @SerializedName(SERIALIZED_NAME_SUPPORTED_METHODS) + private DestinationMetadataMethodsV1 supportedMethods; - /** - * The id of the Destination metadata. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Destination metadata. Config API note: analogous to `name`.") + public static final String SERIALIZED_NAME_SUPPORTED_PLATFORMS = "supportedPlatforms"; - public String getId() { - return id; - } + @SerializedName(SERIALIZED_NAME_SUPPORTED_PLATFORMS) + private DestinationMetadataPlatformsV1 supportedPlatforms; + public static final String SERIALIZED_NAME_ACTIONS = "actions"; - public void setId(String id) { - this.id = id; - } + @SerializedName(SERIALIZED_NAME_ACTIONS) + private List actions = new ArrayList<>(); + public static final String SERIALIZED_NAME_PRESETS = "presets"; - public DestinationMetadataV1 name(String name) { - - this.name = name; - return this; - } + @SerializedName(SERIALIZED_NAME_PRESETS) + private List presets = new ArrayList<>(); - /** - * The user-friendly name of the Destination. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The user-friendly name of the Destination. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } + public static final String SERIALIZED_NAME_CONTACTS = "contacts"; + @SerializedName(SERIALIZED_NAME_CONTACTS) + private List contacts; - public void setName(String name) { - this.name = name; - } + public static final String SERIALIZED_NAME_PARTNER_OWNED = "partnerOwned"; + @SerializedName(SERIALIZED_NAME_PARTNER_OWNED) + private Boolean partnerOwned; - public DestinationMetadataV1 description(String description) { - - this.description = description; - return this; - } + public static final String SERIALIZED_NAME_SUPPORTED_REGIONS = "supportedRegions"; - /** - * The description of the Destination. - * @return description - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The description of the Destination.") + @SerializedName(SERIALIZED_NAME_SUPPORTED_REGIONS) + private List supportedRegions; - public String getDescription() { - return description; - } + public static final String SERIALIZED_NAME_REGION_ENDPOINTS = "regionEndpoints"; + @SerializedName(SERIALIZED_NAME_REGION_ENDPOINTS) + private List regionEndpoints; - public void setDescription(String description) { - this.description = description; - } + public static final String SERIALIZED_NAME_MULTI_INSTANCE_SUPPORTED_VERSION = + "multiInstanceSupportedVersion"; + @SerializedName(SERIALIZED_NAME_MULTI_INSTANCE_SUPPORTED_VERSION) + private String multiInstanceSupportedVersion; - public DestinationMetadataV1 slug(String slug) { - - this.slug = slug; - return this; - } + public DestinationMetadataV1() {} - /** - * The slug used to identify the Destination in the Segment app. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug used to identify the Destination in the Segment app.") + public DestinationMetadataV1 id(String id) { - public String getSlug() { - return slug; - } + this.id = id; + return this; + } + /** + * The id of the Destination metadata. Config API note: analogous to `name`. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - public void setSlug(String slug) { - this.slug = slug; - } + public void setId(String id) { + this.id = id; + } + public DestinationMetadataV1 name(String name) { - public DestinationMetadataV1 logos(Logos logos) { - - this.logos = logos; - return this; - } + this.name = name; + return this; + } - /** - * Get logos - * @return logos - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + /** + * The user-friendly name of the Destination. Config API note: equal to `displayName`. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public Logos getLogos() { - return logos; - } + public void setName(String name) { + this.name = name; + } + public DestinationMetadataV1 description(String description) { - public void setLogos(Logos logos) { - this.logos = logos; - } + this.description = description; + return this; + } + /** + * The description of the Destination. + * + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } - public DestinationMetadataV1 options(List options) { - - this.options = options; - return this; - } + public void setDescription(String description) { + this.description = description; + } - public DestinationMetadataV1 addOptionsItem(IntegrationOptionBeta optionsItem) { - this.options.add(optionsItem); - return this; - } + public DestinationMetadataV1 slug(String slug) { - /** - * Options configured for the Destination. - * @return options - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Options configured for the Destination.") + this.slug = slug; + return this; + } - public List getOptions() { - return options; - } + /** + * The slug used to identify the Destination in the Segment app. + * + * @return slug + */ + @javax.annotation.Nonnull + public String getSlug() { + return slug; + } + public void setSlug(String slug) { + this.slug = slug; + } - public void setOptions(List options) { - this.options = options; - } + public DestinationMetadataV1 logos(LogosBeta logos) { + this.logos = logos; + return this; + } - public DestinationMetadataV1 status(StatusEnum status) { - - this.status = status; - return this; - } + /** + * Get logos + * + * @return logos + */ + @javax.annotation.Nonnull + public LogosBeta getLogos() { + return logos; + } - /** - * Support status of the Destination. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Support status of the Destination.") + public void setLogos(LogosBeta logos) { + this.logos = logos; + } - public StatusEnum getStatus() { - return status; - } + public DestinationMetadataV1 options(List options) { + this.options = options; + return this; + } - public void setStatus(StatusEnum status) { - this.status = status; - } + public DestinationMetadataV1 addOptionsItem(IntegrationOptionBeta optionsItem) { + if (this.options == null) { + this.options = new ArrayList<>(); + } + this.options.add(optionsItem); + return this; + } + /** + * Options configured for the Destination. + * + * @return options + */ + @javax.annotation.Nonnull + public List getOptions() { + return options; + } - public DestinationMetadataV1 previousNames(List previousNames) { - - this.previousNames = previousNames; - return this; - } + public void setOptions(List options) { + this.options = options; + } - public DestinationMetadataV1 addPreviousNamesItem(String previousNamesItem) { - this.previousNames.add(previousNamesItem); - return this; - } + public DestinationMetadataV1 status(StatusEnum status) { - /** - * A list of names previously used by the Destination. - * @return previousNames - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of names previously used by the Destination.") + this.status = status; + return this; + } - public List getPreviousNames() { - return previousNames; - } + /** + * Support status of the Destination. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } - public void setPreviousNames(List previousNames) { - this.previousNames = previousNames; - } + public DestinationMetadataV1 previousNames(List previousNames) { + this.previousNames = previousNames; + return this; + } - public DestinationMetadataV1 categories(List categories) { - - this.categories = categories; - return this; - } + public DestinationMetadataV1 addPreviousNamesItem(String previousNamesItem) { + if (this.previousNames == null) { + this.previousNames = new ArrayList<>(); + } + this.previousNames.add(previousNamesItem); + return this; + } - public DestinationMetadataV1 addCategoriesItem(String categoriesItem) { - this.categories.add(categoriesItem); - return this; - } + /** + * A list of names previously used by the Destination. + * + * @return previousNames + */ + @javax.annotation.Nonnull + public List getPreviousNames() { + return previousNames; + } - /** - * A list of categories with which the Destination is associated. - * @return categories - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of categories with which the Destination is associated.") + public void setPreviousNames(List previousNames) { + this.previousNames = previousNames; + } - public List getCategories() { - return categories; - } + public DestinationMetadataV1 categories(List categories) { + this.categories = categories; + return this; + } - public void setCategories(List categories) { - this.categories = categories; - } + public DestinationMetadataV1 addCategoriesItem(String categoriesItem) { + if (this.categories == null) { + this.categories = new ArrayList<>(); + } + this.categories.add(categoriesItem); + return this; + } + /** + * A list of categories with which the Destination is associated. + * + * @return categories + */ + @javax.annotation.Nonnull + public List getCategories() { + return categories; + } - public DestinationMetadataV1 website(String website) { - - this.website = website; - return this; - } + public void setCategories(List categories) { + this.categories = categories; + } - /** - * A website URL for this Destination. - * @return website - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A website URL for this Destination.") + public DestinationMetadataV1 website(String website) { - public String getWebsite() { - return website; - } + this.website = website; + return this; + } + /** + * A website URL for this Destination. + * + * @return website + */ + @javax.annotation.Nonnull + public String getWebsite() { + return website; + } - public void setWebsite(String website) { - this.website = website; - } + public void setWebsite(String website) { + this.website = website; + } + public DestinationMetadataV1 components(List components) { - public DestinationMetadataV1 components(List components) { - - this.components = components; - return this; - } + this.components = components; + return this; + } - public DestinationMetadataV1 addComponentsItem(DestinationMetadataComponentV1 componentsItem) { - this.components.add(componentsItem); - return this; - } + public DestinationMetadataV1 addComponentsItem(DestinationMetadataComponentV1 componentsItem) { + if (this.components == null) { + this.components = new ArrayList<>(); + } + this.components.add(componentsItem); + return this; + } - /** - * A list of components this Destination provides. - * @return components - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of components this Destination provides.") + /** + * A list of components this Destination provides. + * + * @return components + */ + @javax.annotation.Nonnull + public List getComponents() { + return components; + } - public List getComponents() { - return components; - } + public void setComponents(List components) { + this.components = components; + } + public DestinationMetadataV1 supportedFeatures( + DestinationMetadataFeaturesV1 supportedFeatures) { - public void setComponents(List components) { - this.components = components; - } + this.supportedFeatures = supportedFeatures; + return this; + } + /** + * Get supportedFeatures + * + * @return supportedFeatures + */ + @javax.annotation.Nonnull + public DestinationMetadataFeaturesV1 getSupportedFeatures() { + return supportedFeatures; + } - public DestinationMetadataV1 supportedFeatures(SupportedFeatures supportedFeatures) { - - this.supportedFeatures = supportedFeatures; - return this; - } + public void setSupportedFeatures(DestinationMetadataFeaturesV1 supportedFeatures) { + this.supportedFeatures = supportedFeatures; + } - /** - * Get supportedFeatures - * @return supportedFeatures - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public DestinationMetadataV1 supportedMethods(DestinationMetadataMethodsV1 supportedMethods) { - public SupportedFeatures getSupportedFeatures() { - return supportedFeatures; - } + this.supportedMethods = supportedMethods; + return this; + } + /** + * Get supportedMethods + * + * @return supportedMethods + */ + @javax.annotation.Nonnull + public DestinationMetadataMethodsV1 getSupportedMethods() { + return supportedMethods; + } - public void setSupportedFeatures(SupportedFeatures supportedFeatures) { - this.supportedFeatures = supportedFeatures; - } + public void setSupportedMethods(DestinationMetadataMethodsV1 supportedMethods) { + this.supportedMethods = supportedMethods; + } + public DestinationMetadataV1 supportedPlatforms( + DestinationMetadataPlatformsV1 supportedPlatforms) { - public DestinationMetadataV1 supportedMethods(SupportedMethods supportedMethods) { - - this.supportedMethods = supportedMethods; - return this; - } + this.supportedPlatforms = supportedPlatforms; + return this; + } - /** - * Get supportedMethods - * @return supportedMethods - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + /** + * Get supportedPlatforms + * + * @return supportedPlatforms + */ + @javax.annotation.Nonnull + public DestinationMetadataPlatformsV1 getSupportedPlatforms() { + return supportedPlatforms; + } - public SupportedMethods getSupportedMethods() { - return supportedMethods; - } + public void setSupportedPlatforms(DestinationMetadataPlatformsV1 supportedPlatforms) { + this.supportedPlatforms = supportedPlatforms; + } + public DestinationMetadataV1 actions(List actions) { - public void setSupportedMethods(SupportedMethods supportedMethods) { - this.supportedMethods = supportedMethods; - } + this.actions = actions; + return this; + } + public DestinationMetadataV1 addActionsItem(DestinationMetadataActionV1 actionsItem) { + if (this.actions == null) { + this.actions = new ArrayList<>(); + } + this.actions.add(actionsItem); + return this; + } + + /** + * Actions available for the Destination. + * + * @return actions + */ + @javax.annotation.Nonnull + public List getActions() { + return actions; + } + + public void setActions(List actions) { + this.actions = actions; + } + + public DestinationMetadataV1 presets(List presets) { + + this.presets = presets; + return this; + } + + public DestinationMetadataV1 addPresetsItem( + DestinationMetadataSubscriptionPresetV1 presetsItem) { + if (this.presets == null) { + this.presets = new ArrayList<>(); + } + this.presets.add(presetsItem); + return this; + } + + /** + * Predefined Destination subscriptions that can optionally be applied when connecting a new + * instance of the Destination. + * + * @return presets + */ + @javax.annotation.Nonnull + public List getPresets() { + return presets; + } - public DestinationMetadataV1 supportedPlatforms(SupportedPlatforms supportedPlatforms) { - - this.supportedPlatforms = supportedPlatforms; - return this; - } + public void setPresets(List presets) { + this.presets = presets; + } - /** - * Get supportedPlatforms - * @return supportedPlatforms - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public DestinationMetadataV1 contacts(List contacts) { - public SupportedPlatforms getSupportedPlatforms() { - return supportedPlatforms; - } + this.contacts = contacts; + return this; + } + public DestinationMetadataV1 addContactsItem(Contact contactsItem) { + if (this.contacts == null) { + this.contacts = new ArrayList<>(); + } + this.contacts.add(contactsItem); + return this; + } - public void setSupportedPlatforms(SupportedPlatforms supportedPlatforms) { - this.supportedPlatforms = supportedPlatforms; - } + /** + * Contact info for Integration Owners. + * + * @return contacts + */ + @javax.annotation.Nullable + public List getContacts() { + return contacts; + } + public void setContacts(List contacts) { + this.contacts = contacts; + } - public DestinationMetadataV1 actions(List actions) { - - this.actions = actions; - return this; - } + public DestinationMetadataV1 partnerOwned(Boolean partnerOwned) { - public DestinationMetadataV1 addActionsItem(DestinationMetadataActionV1 actionsItem) { - this.actions.add(actionsItem); - return this; - } + this.partnerOwned = partnerOwned; + return this; + } - /** - * Actions available for the Destination. - * @return actions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Actions available for the Destination.") + /** + * Partner Owned flag. + * + * @return partnerOwned + */ + @javax.annotation.Nullable + public Boolean getPartnerOwned() { + return partnerOwned; + } - public List getActions() { - return actions; - } + public void setPartnerOwned(Boolean partnerOwned) { + this.partnerOwned = partnerOwned; + } + public DestinationMetadataV1 supportedRegions(List supportedRegions) { - public void setActions(List actions) { - this.actions = actions; - } + this.supportedRegions = supportedRegions; + return this; + } + public DestinationMetadataV1 addSupportedRegionsItem(String supportedRegionsItem) { + if (this.supportedRegions == null) { + this.supportedRegions = new ArrayList<>(); + } + this.supportedRegions.add(supportedRegionsItem); + return this; + } + + /** + * A list of supported regions for this Destination. + * + * @return supportedRegions + */ + @javax.annotation.Nullable + public List getSupportedRegions() { + return supportedRegions; + } + + public void setSupportedRegions(List supportedRegions) { + this.supportedRegions = supportedRegions; + } + + public DestinationMetadataV1 regionEndpoints(List regionEndpoints) { + + this.regionEndpoints = regionEndpoints; + return this; + } + + public DestinationMetadataV1 addRegionEndpointsItem(String regionEndpointsItem) { + if (this.regionEndpoints == null) { + this.regionEndpoints = new ArrayList<>(); + } + this.regionEndpoints.add(regionEndpointsItem); + return this; + } + + /** + * The list of regional endpoints for this Destination. + * + * @return regionEndpoints + */ + @javax.annotation.Nullable + public List getRegionEndpoints() { + return regionEndpoints; + } + + public void setRegionEndpoints(List regionEndpoints) { + this.regionEndpoints = regionEndpoints; + } + + public DestinationMetadataV1 multiInstanceSupportedVersion( + String multiInstanceSupportedVersion) { + + this.multiInstanceSupportedVersion = multiInstanceSupportedVersion; + return this; + } + + /** + * This Destination's support for multiple instance types. + * + * @return multiInstanceSupportedVersion + */ + @javax.annotation.Nullable + public String getMultiInstanceSupportedVersion() { + return multiInstanceSupportedVersion; + } + + public void setMultiInstanceSupportedVersion(String multiInstanceSupportedVersion) { + this.multiInstanceSupportedVersion = multiInstanceSupportedVersion; + } - public DestinationMetadataV1 presets(List presets) { - - this.presets = presets; - return this; - } - - public DestinationMetadataV1 addPresetsItem(DestinationMetadataSubscriptionPresetV1 presetsItem) { - this.presets.add(presetsItem); - return this; - } - - /** - * Predefined Destination subscriptions that can optionally be applied when connecting a new instance of the Destination. - * @return presets - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Predefined Destination subscriptions that can optionally be applied when connecting a new instance of the Destination.") - - public List getPresets() { - return presets; - } - - - public void setPresets(List presets) { - this.presets = presets; - } - - - public DestinationMetadataV1 contacts(List contacts) { - - this.contacts = contacts; - return this; - } - - public DestinationMetadataV1 addContactsItem(Contact contactsItem) { - if (this.contacts == null) { - this.contacts = new ArrayList<>(); - } - this.contacts.add(contactsItem); - return this; - } - - /** - * Contact info for Integration Owners. - * @return contacts - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Contact info for Integration Owners.") - - public List getContacts() { - return contacts; - } - - - public void setContacts(List contacts) { - this.contacts = contacts; - } - - - public DestinationMetadataV1 partnerOwned(Boolean partnerOwned) { - - this.partnerOwned = partnerOwned; - return this; - } - - /** - * Partner Owned flag. - * @return partnerOwned - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Partner Owned flag.") - - public Boolean getPartnerOwned() { - return partnerOwned; - } - - - public void setPartnerOwned(Boolean partnerOwned) { - this.partnerOwned = partnerOwned; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DestinationMetadataV1 destinationMetadataV1 = (DestinationMetadataV1) o; - return Objects.equals(this.id, destinationMetadataV1.id) && - Objects.equals(this.name, destinationMetadataV1.name) && - Objects.equals(this.description, destinationMetadataV1.description) && - Objects.equals(this.slug, destinationMetadataV1.slug) && - Objects.equals(this.logos, destinationMetadataV1.logos) && - Objects.equals(this.options, destinationMetadataV1.options) && - Objects.equals(this.status, destinationMetadataV1.status) && - Objects.equals(this.previousNames, destinationMetadataV1.previousNames) && - Objects.equals(this.categories, destinationMetadataV1.categories) && - Objects.equals(this.website, destinationMetadataV1.website) && - Objects.equals(this.components, destinationMetadataV1.components) && - Objects.equals(this.supportedFeatures, destinationMetadataV1.supportedFeatures) && - Objects.equals(this.supportedMethods, destinationMetadataV1.supportedMethods) && - Objects.equals(this.supportedPlatforms, destinationMetadataV1.supportedPlatforms) && - Objects.equals(this.actions, destinationMetadataV1.actions) && - Objects.equals(this.presets, destinationMetadataV1.presets) && - Objects.equals(this.contacts, destinationMetadataV1.contacts) && - Objects.equals(this.partnerOwned, destinationMetadataV1.partnerOwned); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, description, slug, logos, options, status, previousNames, categories, website, components, supportedFeatures, supportedMethods, supportedPlatforms, actions, presets, contacts, partnerOwned); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationMetadataV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" logos: ").append(toIndentedString(logos)).append("\n"); - sb.append(" options: ").append(toIndentedString(options)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" previousNames: ").append(toIndentedString(previousNames)).append("\n"); - sb.append(" categories: ").append(toIndentedString(categories)).append("\n"); - sb.append(" website: ").append(toIndentedString(website)).append("\n"); - sb.append(" components: ").append(toIndentedString(components)).append("\n"); - sb.append(" supportedFeatures: ").append(toIndentedString(supportedFeatures)).append("\n"); - sb.append(" supportedMethods: ").append(toIndentedString(supportedMethods)).append("\n"); - sb.append(" supportedPlatforms: ").append(toIndentedString(supportedPlatforms)).append("\n"); - sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); - sb.append(" presets: ").append(toIndentedString(presets)).append("\n"); - sb.append(" contacts: ").append(toIndentedString(contacts)).append("\n"); - sb.append(" partnerOwned: ").append(toIndentedString(partnerOwned)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("description"); - openapiFields.add("slug"); - openapiFields.add("logos"); - openapiFields.add("options"); - openapiFields.add("status"); - openapiFields.add("previousNames"); - openapiFields.add("categories"); - openapiFields.add("website"); - openapiFields.add("components"); - openapiFields.add("supportedFeatures"); - openapiFields.add("supportedMethods"); - openapiFields.add("supportedPlatforms"); - openapiFields.add("actions"); - openapiFields.add("presets"); - openapiFields.add("contacts"); - openapiFields.add("partnerOwned"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("description"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("logos"); - openapiRequiredFields.add("options"); - openapiRequiredFields.add("status"); - openapiRequiredFields.add("previousNames"); - openapiRequiredFields.add("categories"); - openapiRequiredFields.add("website"); - openapiRequiredFields.add("components"); - openapiRequiredFields.add("supportedFeatures"); - openapiRequiredFields.add("supportedMethods"); - openapiRequiredFields.add("supportedPlatforms"); - openapiRequiredFields.add("actions"); - openapiRequiredFields.add("presets"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationMetadataV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationMetadataV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationMetadataV1 is not found in the empty JSON string", DestinationMetadataV1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationMetadataV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationMetadataV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DestinationMetadataV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("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("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("options").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `options` to be an array in the JSON string but got `%s`", jsonObj.get("options").toString())); - } - - JsonArray jsonArrayoptions = jsonObj.getAsJsonArray("options"); - 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())); - } - // ensure the required json array is present - if (jsonObj.get("previousNames") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("previousNames").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `previousNames` to be an array in the JSON string but got `%s`", jsonObj.get("previousNames").toString())); - } - // ensure the required json array is present - if (jsonObj.get("categories") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("categories").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `categories` to be an array in the JSON string but got `%s`", jsonObj.get("categories").toString())); - } - if (!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("components").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `components` to be an array in the JSON string but got `%s`", jsonObj.get("components").toString())); - } - - JsonArray jsonArraycomponents = jsonObj.getAsJsonArray("components"); - // ensure the json data is an array - if (!jsonObj.get("actions").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `actions` to be an array in the JSON string but got `%s`", jsonObj.get("actions").toString())); - } - - JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); - // ensure the json data is an array - if (!jsonObj.get("presets").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `presets` to be an array in the JSON string but got `%s`", jsonObj.get("presets").toString())); - } - - JsonArray jsonArraypresets = jsonObj.getAsJsonArray("presets"); - if (jsonObj.get("contacts") != null && !jsonObj.get("contacts").isJsonNull()) { - JsonArray jsonArraycontacts = jsonObj.getAsJsonArray("contacts"); - if (jsonArraycontacts != null) { - // ensure the json data is an array - if (!jsonObj.get("contacts").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `contacts` to be an array in the JSON string but got `%s`", jsonObj.get("contacts").toString())); - } - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationMetadataV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationMetadataV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationMetadataV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationMetadataV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationMetadataV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of DestinationMetadataV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationMetadataV1 - * @throws IOException if the JSON string is invalid with respect to DestinationMetadataV1 - */ - public static DestinationMetadataV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationMetadataV1.class); - } - - /** - * Convert an instance of DestinationMetadataV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationMetadataV1 destinationMetadataV1 = (DestinationMetadataV1) o; + return Objects.equals(this.id, destinationMetadataV1.id) + && Objects.equals(this.name, destinationMetadataV1.name) + && Objects.equals(this.description, destinationMetadataV1.description) + && Objects.equals(this.slug, destinationMetadataV1.slug) + && Objects.equals(this.logos, destinationMetadataV1.logos) + && Objects.equals(this.options, destinationMetadataV1.options) + && Objects.equals(this.status, destinationMetadataV1.status) + && Objects.equals(this.previousNames, destinationMetadataV1.previousNames) + && Objects.equals(this.categories, destinationMetadataV1.categories) + && Objects.equals(this.website, destinationMetadataV1.website) + && Objects.equals(this.components, destinationMetadataV1.components) + && Objects.equals(this.supportedFeatures, destinationMetadataV1.supportedFeatures) + && Objects.equals(this.supportedMethods, destinationMetadataV1.supportedMethods) + && Objects.equals(this.supportedPlatforms, destinationMetadataV1.supportedPlatforms) + && Objects.equals(this.actions, destinationMetadataV1.actions) + && Objects.equals(this.presets, destinationMetadataV1.presets) + && Objects.equals(this.contacts, destinationMetadataV1.contacts) + && Objects.equals(this.partnerOwned, destinationMetadataV1.partnerOwned) + && Objects.equals(this.supportedRegions, destinationMetadataV1.supportedRegions) + && Objects.equals(this.regionEndpoints, destinationMetadataV1.regionEndpoints) + && Objects.equals( + this.multiInstanceSupportedVersion, + destinationMetadataV1.multiInstanceSupportedVersion); + } + @Override + public int hashCode() { + return Objects.hash( + id, + name, + description, + slug, + logos, + options, + status, + previousNames, + categories, + website, + components, + supportedFeatures, + supportedMethods, + supportedPlatforms, + actions, + presets, + contacts, + partnerOwned, + supportedRegions, + regionEndpoints, + multiInstanceSupportedVersion); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationMetadataV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" logos: ").append(toIndentedString(logos)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" previousNames: ").append(toIndentedString(previousNames)).append("\n"); + sb.append(" categories: ").append(toIndentedString(categories)).append("\n"); + sb.append(" website: ").append(toIndentedString(website)).append("\n"); + sb.append(" components: ").append(toIndentedString(components)).append("\n"); + sb.append(" supportedFeatures: ") + .append(toIndentedString(supportedFeatures)) + .append("\n"); + sb.append(" supportedMethods: ").append(toIndentedString(supportedMethods)).append("\n"); + sb.append(" supportedPlatforms: ") + .append(toIndentedString(supportedPlatforms)) + .append("\n"); + sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); + sb.append(" presets: ").append(toIndentedString(presets)).append("\n"); + sb.append(" contacts: ").append(toIndentedString(contacts)).append("\n"); + sb.append(" partnerOwned: ").append(toIndentedString(partnerOwned)).append("\n"); + sb.append(" supportedRegions: ").append(toIndentedString(supportedRegions)).append("\n"); + sb.append(" regionEndpoints: ").append(toIndentedString(regionEndpoints)).append("\n"); + sb.append(" multiInstanceSupportedVersion: ") + .append(toIndentedString(multiInstanceSupportedVersion)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("name"); + openapiFields.add("description"); + openapiFields.add("slug"); + openapiFields.add("logos"); + openapiFields.add("options"); + openapiFields.add("status"); + openapiFields.add("previousNames"); + openapiFields.add("categories"); + openapiFields.add("website"); + openapiFields.add("components"); + openapiFields.add("supportedFeatures"); + openapiFields.add("supportedMethods"); + openapiFields.add("supportedPlatforms"); + openapiFields.add("actions"); + openapiFields.add("presets"); + openapiFields.add("contacts"); + openapiFields.add("partnerOwned"); + openapiFields.add("supportedRegions"); + openapiFields.add("regionEndpoints"); + openapiFields.add("multiInstanceSupportedVersion"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("slug"); + openapiRequiredFields.add("logos"); + openapiRequiredFields.add("options"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("previousNames"); + openapiRequiredFields.add("categories"); + openapiRequiredFields.add("website"); + openapiRequiredFields.add("components"); + openapiRequiredFields.add("supportedFeatures"); + openapiRequiredFields.add("supportedMethods"); + openapiRequiredFields.add("supportedPlatforms"); + openapiRequiredFields.add("actions"); + openapiRequiredFields.add("presets"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DestinationMetadataV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationMetadataV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationMetadataV1 is not found in" + + " the empty JSON string", + DestinationMetadataV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationMetadataV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationMetadataV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationMetadataV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("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("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").toString())); + } + // validate the required field `logos` + LogosBeta.validateJsonElement(jsonObj.get("logos")); + // ensure the json data is an array + if (!jsonObj.get("options").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `options` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("options").toString())); + } + + JsonArray jsonArrayoptions = jsonObj.getAsJsonArray("options"); + // validate the required field `options` (array) + for (int i = 0; i < jsonArrayoptions.size(); i++) { + IntegrationOptionBeta.validateJsonElement(jsonArrayoptions.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())); + } + // ensure the required json array is present + if (jsonObj.get("previousNames") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("previousNames").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `previousNames` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("previousNames").toString())); + } + // ensure the required json array is present + if (jsonObj.get("categories") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("categories").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `categories` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("categories").toString())); + } + if (!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("components").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `components` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("components").toString())); + } + + JsonArray jsonArraycomponents = jsonObj.getAsJsonArray("components"); + // validate the required field `components` (array) + for (int i = 0; i < jsonArraycomponents.size(); i++) { + DestinationMetadataComponentV1.validateJsonElement(jsonArraycomponents.get(i)); + } + ; + // validate the required field `supportedFeatures` + DestinationMetadataFeaturesV1.validateJsonElement(jsonObj.get("supportedFeatures")); + // validate the required field `supportedMethods` + DestinationMetadataMethodsV1.validateJsonElement(jsonObj.get("supportedMethods")); + // validate the required field `supportedPlatforms` + DestinationMetadataPlatformsV1.validateJsonElement(jsonObj.get("supportedPlatforms")); + // ensure the json data is an array + if (!jsonObj.get("actions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `actions` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("actions").toString())); + } + + JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); + // validate the required field `actions` (array) + for (int i = 0; i < jsonArrayactions.size(); i++) { + DestinationMetadataActionV1.validateJsonElement(jsonArrayactions.get(i)); + } + ; + // ensure the json data is an array + if (!jsonObj.get("presets").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `presets` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("presets").toString())); + } + + JsonArray jsonArraypresets = jsonObj.getAsJsonArray("presets"); + // validate the required field `presets` (array) + for (int i = 0; i < jsonArraypresets.size(); i++) { + DestinationMetadataSubscriptionPresetV1.validateJsonElement(jsonArraypresets.get(i)); + } + ; + if (jsonObj.get("contacts") != null && !jsonObj.get("contacts").isJsonNull()) { + JsonArray jsonArraycontacts = jsonObj.getAsJsonArray("contacts"); + if (jsonArraycontacts != null) { + // ensure the json data is an array + if (!jsonObj.get("contacts").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `contacts` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("contacts").toString())); + } + + // validate the optional field `contacts` (array) + for (int i = 0; i < jsonArraycontacts.size(); i++) { + Contact.validateJsonElement(jsonArraycontacts.get(i)); + } + ; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("supportedRegions") != null + && !jsonObj.get("supportedRegions").isJsonNull() + && !jsonObj.get("supportedRegions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `supportedRegions` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("supportedRegions").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("regionEndpoints") != null + && !jsonObj.get("regionEndpoints").isJsonNull() + && !jsonObj.get("regionEndpoints").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `regionEndpoints` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("regionEndpoints").toString())); + } + if ((jsonObj.get("multiInstanceSupportedVersion") != null + && !jsonObj.get("multiInstanceSupportedVersion").isJsonNull()) + && !jsonObj.get("multiInstanceSupportedVersion").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `multiInstanceSupportedVersion` to be a primitive" + + " type in the JSON string but got `%s`", + jsonObj.get("multiInstanceSupportedVersion").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationMetadataV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationMetadataV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DestinationMetadataV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationMetadataV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationMetadataV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DestinationMetadataV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationMetadataV1 + * @throws IOException if the JSON string is invalid with respect to DestinationMetadataV1 + */ + public static DestinationMetadataV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationMetadataV1.class); + } + + /** + * Convert an instance of DestinationMetadataV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationStatusV1.java b/src/main/java/com/segment/publicapi/models/DestinationStatusV1.java index 9c9683ef..ad592d08 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationStatusV1.java +++ b/src/main/java/com/segment/publicapi/models/DestinationStatusV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,401 +9,400 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** DestinationStatus represents status of each Destination in a stream. */ +public class DestinationStatusV1 { + public static final String SERIALIZED_NAME_NAME = "name"; -/** - * DestinationStatus represents status of each Destination in a stream. - */ -@ApiModel(description = "DestinationStatus represents status of each Destination in a stream.") + @SerializedName(SERIALIZED_NAME_NAME) + private String name; -public class DestinationStatusV1 { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - /** - * Gets or Sets status - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - FAILED("FAILED"), - - FINISHED("FINISHED"), - - INITIALIZED("INITIALIZED"), - - INVALID("INVALID"), - - NOT_SUPPORTED("NOT_SUPPORTED"), - - PARTIAL_SUCCESS("PARTIAL_SUCCESS"), - - RUNNING("RUNNING"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } + public static final String SERIALIZED_NAME_ID = "id"; - public String getValue() { - return value; - } + @SerializedName(SERIALIZED_NAME_ID) + private String id; - @Override - public String toString() { - return String.valueOf(value); - } + /** Gets or Sets status */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + FAILED("FAILED"), - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } + FINISHED("FINISHED"), - 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); - } - } - } + INITIALIZED("INITIALIZED"), - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status; + INVALID("INVALID"), - public static final String SERIALIZED_NAME_ERR_STRING = "errString"; - @SerializedName(SERIALIZED_NAME_ERR_STRING) - private String errString; + NOT_SUPPORTED("NOT_SUPPORTED"), - public static final String SERIALIZED_NAME_FINISHED_AT = "finishedAt"; - @SerializedName(SERIALIZED_NAME_FINISHED_AT) - private String finishedAt; + PARTIAL_SUCCESS("PARTIAL_SUCCESS"), - public DestinationStatusV1() { - } + RUNNING("RUNNING"); - public DestinationStatusV1 name(String name) { - - this.name = name; - return this; - } + private String value; - /** - * Get name - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + StatusEnum(String value) { + this.value = value; + } - public String getName() { - return name; - } + public String getValue() { + return value; + } + @Override + public String toString() { + return String.valueOf(value); + } - public void setName(String name) { - this.name = name; - } + 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 DestinationStatusV1 id(String id) { - - this.id = id; - return this; - } + public static final String SERIALIZED_NAME_STATUS = "status"; - /** - * Get id - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public String getId() { - return id; - } + public static final String SERIALIZED_NAME_ERR_STRING = "errString"; + @SerializedName(SERIALIZED_NAME_ERR_STRING) + private String errString; - public void setId(String id) { - this.id = id; - } + public static final String SERIALIZED_NAME_FINISHED_AT = "finishedAt"; + @SerializedName(SERIALIZED_NAME_FINISHED_AT) + private String finishedAt; - public DestinationStatusV1 status(StatusEnum status) { - - this.status = status; - return this; - } + public DestinationStatusV1() {} - /** - * Get status - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public DestinationStatusV1 name(String name) { - public StatusEnum getStatus() { - return status; - } + this.name = name; + return this; + } + /** + * Get name + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public void setStatus(StatusEnum status) { - this.status = status; - } + public void setName(String name) { + this.name = name; + } + public DestinationStatusV1 id(String id) { - public DestinationStatusV1 errString(String errString) { - - this.errString = errString; - return this; - } + this.id = id; + return this; + } - /** - * Get errString - * @return errString - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + /** + * Get id + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - public String getErrString() { - return errString; - } + public void setId(String id) { + this.id = id; + } + public DestinationStatusV1 status(StatusEnum status) { - public void setErrString(String errString) { - this.errString = errString; - } + 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 DestinationStatusV1 errString(String errString) { - public DestinationStatusV1 finishedAt(String finishedAt) { - - this.finishedAt = finishedAt; - return this; - } + this.errString = errString; + return this; + } - /** - * Get finishedAt - * @return finishedAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + /** + * Get errString + * + * @return errString + */ + @javax.annotation.Nonnull + public String getErrString() { + return errString; + } - public String getFinishedAt() { - return finishedAt; - } + public void setErrString(String errString) { + this.errString = errString; + } + public DestinationStatusV1 finishedAt(String finishedAt) { - public void setFinishedAt(String finishedAt) { - this.finishedAt = finishedAt; - } + this.finishedAt = finishedAt; + return this; + } + /** + * Get finishedAt + * + * @return finishedAt + */ + @javax.annotation.Nonnull + public String getFinishedAt() { + return finishedAt; + } + public void setFinishedAt(String finishedAt) { + this.finishedAt = finishedAt; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationStatusV1 destinationStatusV1 = (DestinationStatusV1) o; + return Objects.equals(this.name, destinationStatusV1.name) + && Objects.equals(this.id, destinationStatusV1.id) + && Objects.equals(this.status, destinationStatusV1.status) + && Objects.equals(this.errString, destinationStatusV1.errString) + && Objects.equals(this.finishedAt, destinationStatusV1.finishedAt); } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public int hashCode() { + return Objects.hash(name, id, status, errString, finishedAt); } - DestinationStatusV1 destinationStatusV1 = (DestinationStatusV1) o; - return Objects.equals(this.name, destinationStatusV1.name) && - Objects.equals(this.id, destinationStatusV1.id) && - Objects.equals(this.status, destinationStatusV1.status) && - Objects.equals(this.errString, destinationStatusV1.errString) && - Objects.equals(this.finishedAt, destinationStatusV1.finishedAt); - } - - @Override - public int hashCode() { - return Objects.hash(name, id, status, errString, finishedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationStatusV1 {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" errString: ").append(toIndentedString(errString)).append("\n"); - sb.append(" finishedAt: ").append(toIndentedString(finishedAt)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationStatusV1 {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" errString: ").append(toIndentedString(errString)).append("\n"); + sb.append(" finishedAt: ").append(toIndentedString(finishedAt)).append("\n"); + sb.append("}"); + return sb.toString(); } - return o.toString().replace("\n", "\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("id"); - openapiFields.add("status"); - openapiFields.add("errString"); - openapiFields.add("finishedAt"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("status"); - openapiRequiredFields.add("errString"); - openapiRequiredFields.add("finishedAt"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationStatusV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationStatusV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationStatusV1 is not found in the empty JSON string", DestinationStatusV1.openapiRequiredFields.toString())); + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - } + return o.toString().replace("\n", "\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("id"); + openapiFields.add("status"); + openapiFields.add("errString"); + openapiFields.add("finishedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("errString"); + openapiRequiredFields.add("finishedAt"); + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationStatusV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationStatusV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DestinationStatusV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationStatusV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationStatusV1 is not found in" + + " the empty JSON string", + DestinationStatusV1.openapiRequiredFields.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DestinationStatusV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationStatusV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationStatusV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationStatusV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("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("errString").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errString` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errString").toString())); + } + if (!jsonObj.get("finishedAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `finishedAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("finishedAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationStatusV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationStatusV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DestinationStatusV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationStatusV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationStatusV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("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("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("errString").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `errString` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errString").toString())); - } - if (!jsonObj.get("finishedAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `finishedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("finishedAt").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationStatusV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationStatusV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationStatusV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationStatusV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationStatusV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DestinationStatusV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationStatusV1 - * @throws IOException if the JSON string is invalid with respect to DestinationStatusV1 - */ - public static DestinationStatusV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationStatusV1.class); - } - - /** - * Convert an instance of DestinationStatusV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of DestinationStatusV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationStatusV1 + * @throws IOException if the JSON string is invalid with respect to DestinationStatusV1 + */ + public static DestinationStatusV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationStatusV1.class); + } + + /** + * Convert an instance of DestinationStatusV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationSubscription.java b/src/main/java/com/segment/publicapi/models/DestinationSubscription.java index c564d9e3..bde984ad 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationSubscription.java +++ b/src/main/java/com/segment/publicapi/models/DestinationSubscription.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,441 +9,531 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** DestinationSubscription */ +public class DestinationSubscription { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * The Destination subscription. - */ -@ApiModel(description = "The Destination subscription.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class DestinationSubscription { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_ACTION_ID = "actionId"; - @SerializedName(SERIALIZED_NAME_ACTION_ID) - private String actionId; + public static final String SERIALIZED_NAME_ACTION_ID = "actionId"; - public static final String SERIALIZED_NAME_ACTION_SLUG = "actionSlug"; - @SerializedName(SERIALIZED_NAME_ACTION_SLUG) - private String actionSlug; - - public static final String SERIALIZED_NAME_DESTINATION_ID = "destinationId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_ID) - private String destinationId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + @SerializedName(SERIALIZED_NAME_ACTION_ID) + private String actionId; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; + public static final String SERIALIZED_NAME_ACTION_SLUG = "actionSlug"; - public static final String SERIALIZED_NAME_TRIGGER = "trigger"; - @SerializedName(SERIALIZED_NAME_TRIGGER) - private String trigger; + @SerializedName(SERIALIZED_NAME_ACTION_SLUG) + private String actionSlug; - public DestinationSubscription() { - } + public static final String SERIALIZED_NAME_DESTINATION_ID = "destinationId"; - public DestinationSubscription id(String id) { - - this.id = id; - return this; - } + @SerializedName(SERIALIZED_NAME_DESTINATION_ID) + private String destinationId; - /** - * The unique identifier for the subscription. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier for the subscription.") + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public String getId() { - return id; - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - public void setId(String id) { - this.id = id; - } + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; + public static final String SERIALIZED_NAME_TRIGGER = "trigger"; - public DestinationSubscription name(String name) { - - this.name = name; - return this; - } + @SerializedName(SERIALIZED_NAME_TRIGGER) + private String trigger; - /** - * The name of the subscription. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the subscription.") + public static final String SERIALIZED_NAME_MODEL_ID = "modelId"; - public String getName() { - return name; - } + @SerializedName(SERIALIZED_NAME_MODEL_ID) + private String modelId; + public static final String SERIALIZED_NAME_REVERSE_E_T_L_SCHEDULE = "reverseETLSchedule"; - public void setName(String name) { - this.name = name; - } + @SerializedName(SERIALIZED_NAME_REVERSE_E_T_L_SCHEDULE) + private ReverseEtlScheduleDefinition reverseETLSchedule; + public DestinationSubscription() {} - public DestinationSubscription actionId(String actionId) { - - this.actionId = actionId; - return this; - } + public DestinationSubscription id(String id) { - /** - * The unique identifier for the Destination action to trigger. - * @return actionId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier for the Destination action to trigger.") + this.id = id; + return this; + } - public String getActionId() { - return actionId; - } + /** + * The unique identifier for the subscription. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } - public void setActionId(String actionId) { - this.actionId = actionId; - } + public DestinationSubscription name(String name) { + this.name = name; + return this; + } - public DestinationSubscription actionSlug(String actionSlug) { - - this.actionSlug = actionSlug; - return this; - } + /** + * The name of the subscription. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - /** - * The URL-friendly key for the associated Destination action. - * @return actionSlug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The URL-friendly key for the associated Destination action.") + public void setName(String name) { + this.name = name; + } - public String getActionSlug() { - return actionSlug; - } + public DestinationSubscription actionId(String actionId) { + this.actionId = actionId; + return this; + } - public void setActionSlug(String actionSlug) { - this.actionSlug = actionSlug; - } + /** + * The unique identifier for the Destination action to trigger. + * + * @return actionId + */ + @javax.annotation.Nonnull + public String getActionId() { + return actionId; + } + public void setActionId(String actionId) { + this.actionId = actionId; + } - public DestinationSubscription destinationId(String destinationId) { - - this.destinationId = destinationId; - return this; - } + public DestinationSubscription actionSlug(String actionSlug) { - /** - * The associated Destination instance id. - * @return destinationId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The associated Destination instance id.") + this.actionSlug = actionSlug; + return this; + } - public String getDestinationId() { - return destinationId; - } + /** + * The URL-friendly key for the associated Destination action. + * + * @return actionSlug + */ + @javax.annotation.Nonnull + public String getActionSlug() { + return actionSlug; + } + public void setActionSlug(String actionSlug) { + this.actionSlug = actionSlug; + } - public void setDestinationId(String destinationId) { - this.destinationId = destinationId; - } + public DestinationSubscription destinationId(String destinationId) { + this.destinationId = destinationId; + return this; + } - public DestinationSubscription enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Is the subscription enabled. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Is the subscription enabled.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public DestinationSubscription settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The customer settings for action fields. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The customer settings for action fields.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - public DestinationSubscription trigger(String trigger) { - - this.trigger = trigger; - return this; - } - - /** - * FQL string that describes what events should trigger a Destination action. - * @return trigger - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "FQL string that describes what events should trigger a Destination action.") - - public String getTrigger() { - return trigger; - } - - - public void setTrigger(String trigger) { - this.trigger = trigger; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DestinationSubscription destinationSubscription = (DestinationSubscription) o; - return Objects.equals(this.id, destinationSubscription.id) && - Objects.equals(this.name, destinationSubscription.name) && - Objects.equals(this.actionId, destinationSubscription.actionId) && - Objects.equals(this.actionSlug, destinationSubscription.actionSlug) && - Objects.equals(this.destinationId, destinationSubscription.destinationId) && - Objects.equals(this.enabled, destinationSubscription.enabled) && - Objects.equals(this.settings, destinationSubscription.settings) && - Objects.equals(this.trigger, destinationSubscription.trigger); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, actionId, actionSlug, destinationId, enabled, settings, trigger); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationSubscription {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" actionId: ").append(toIndentedString(actionId)).append("\n"); - sb.append(" actionSlug: ").append(toIndentedString(actionSlug)).append("\n"); - sb.append(" destinationId: ").append(toIndentedString(destinationId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("actionId"); - openapiFields.add("actionSlug"); - openapiFields.add("destinationId"); - openapiFields.add("enabled"); - openapiFields.add("settings"); - openapiFields.add("trigger"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("actionId"); - openapiRequiredFields.add("actionSlug"); - openapiRequiredFields.add("destinationId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("settings"); - openapiRequiredFields.add("trigger"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationSubscription - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationSubscription.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationSubscription is not found in the empty JSON string", DestinationSubscription.openapiRequiredFields.toString())); - } - } + /** + * The associated Destination instance id. + * + * @return destinationId + */ + @javax.annotation.Nonnull + public String getDestinationId() { + return destinationId; + } + + public void setDestinationId(String destinationId) { + this.destinationId = destinationId; + } + + public DestinationSubscription enabled(Boolean enabled) { - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationSubscription.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationSubscription` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + this.enabled = enabled; + return this; + } + + /** + * Is the subscription enabled. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public DestinationSubscription settings(Map settings) { + + this.settings = settings; + return this; + } + + public DestinationSubscription putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); } - } + this.settings.put(key, settingsItem); + return this; + } + + /** + * Represents settings used to configure an action subscription. + * + * @return settings + */ + @javax.annotation.Nonnull + public Map getSettings() { + return settings; + } + + public void setSettings(Map settings) { + this.settings = settings; + } + + public DestinationSubscription trigger(String trigger) { + + this.trigger = trigger; + return this; + } + + /** + * FQL string that describes what events should trigger a Destination action. + * + * @return trigger + */ + @javax.annotation.Nonnull + public String getTrigger() { + return trigger; + } + + public void setTrigger(String trigger) { + this.trigger = trigger; + } + + public DestinationSubscription modelId(String modelId) { + + this.modelId = modelId; + return this; + } + + /** + * The unique identifier for the linked ReverseETLModel, if this part of a Reverse ETL + * connection. + * + * @return modelId + */ + @javax.annotation.Nullable + public String getModelId() { + return modelId; + } + + public void setModelId(String modelId) { + this.modelId = modelId; + } + + public DestinationSubscription reverseETLSchedule( + ReverseEtlScheduleDefinition reverseETLSchedule) { + + this.reverseETLSchedule = reverseETLSchedule; + return this; + } + + /** + * Get reverseETLSchedule + * + * @return reverseETLSchedule + */ + @javax.annotation.Nullable + public ReverseEtlScheduleDefinition getReverseETLSchedule() { + return reverseETLSchedule; + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DestinationSubscription.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + public void setReverseETLSchedule(ReverseEtlScheduleDefinition reverseETLSchedule) { + this.reverseETLSchedule = reverseETLSchedule; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } - } - 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("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("actionId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `actionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actionId").toString())); - } - if (!jsonObj.get("actionSlug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `actionSlug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actionSlug").toString())); - } - if (!jsonObj.get("destinationId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationId").toString())); - } - if (!jsonObj.get("trigger").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `trigger` to be a primitive type in the JSON string but got `%s`", jsonObj.get("trigger").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") + DestinationSubscription destinationSubscription = (DestinationSubscription) o; + return Objects.equals(this.id, destinationSubscription.id) + && Objects.equals(this.name, destinationSubscription.name) + && Objects.equals(this.actionId, destinationSubscription.actionId) + && Objects.equals(this.actionSlug, destinationSubscription.actionSlug) + && Objects.equals(this.destinationId, destinationSubscription.destinationId) + && Objects.equals(this.enabled, destinationSubscription.enabled) + && Objects.equals(this.settings, destinationSubscription.settings) + && Objects.equals(this.trigger, destinationSubscription.trigger) + && Objects.equals(this.modelId, destinationSubscription.modelId) + && Objects.equals( + this.reverseETLSchedule, destinationSubscription.reverseETLSchedule); + } + @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationSubscription.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationSubscription' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationSubscription.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationSubscription value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationSubscription read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of DestinationSubscription given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationSubscription - * @throws IOException if the JSON string is invalid with respect to DestinationSubscription - */ - public static DestinationSubscription fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationSubscription.class); - } - - /** - * Convert an instance of DestinationSubscription to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public int hashCode() { + return Objects.hash( + id, + name, + actionId, + actionSlug, + destinationId, + enabled, + settings, + trigger, + modelId, + reverseETLSchedule); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationSubscription {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" actionId: ").append(toIndentedString(actionId)).append("\n"); + sb.append(" actionSlug: ").append(toIndentedString(actionSlug)).append("\n"); + sb.append(" destinationId: ").append(toIndentedString(destinationId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); + sb.append(" modelId: ").append(toIndentedString(modelId)).append("\n"); + sb.append(" reverseETLSchedule: ") + .append(toIndentedString(reverseETLSchedule)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("name"); + openapiFields.add("actionId"); + openapiFields.add("actionSlug"); + openapiFields.add("destinationId"); + openapiFields.add("enabled"); + openapiFields.add("settings"); + openapiFields.add("trigger"); + openapiFields.add("modelId"); + openapiFields.add("reverseETLSchedule"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("actionId"); + openapiRequiredFields.add("actionSlug"); + openapiRequiredFields.add("destinationId"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("settings"); + openapiRequiredFields.add("trigger"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DestinationSubscription + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationSubscription.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationSubscription is not found" + + " in the empty JSON string", + DestinationSubscription.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationSubscription.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationSubscription` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationSubscription.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("actionId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `actionId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("actionId").toString())); + } + if (!jsonObj.get("actionSlug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `actionSlug` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("actionSlug").toString())); + } + if (!jsonObj.get("destinationId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `destinationId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("destinationId").toString())); + } + if (!jsonObj.get("trigger").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `trigger` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("trigger").toString())); + } + if ((jsonObj.get("modelId") != null && !jsonObj.get("modelId").isJsonNull()) + && !jsonObj.get("modelId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `modelId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("modelId").toString())); + } + // validate the optional field `reverseETLSchedule` + if (jsonObj.get("reverseETLSchedule") != null + && !jsonObj.get("reverseETLSchedule").isJsonNull()) { + ReverseEtlScheduleDefinition.validateJsonElement(jsonObj.get("reverseETLSchedule")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationSubscription.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationSubscription' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DestinationSubscription.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationSubscription value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationSubscription read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DestinationSubscription given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationSubscription + * @throws IOException if the JSON string is invalid with respect to DestinationSubscription + */ + public static DestinationSubscription fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationSubscription.class); + } + + /** + * Convert an instance of DestinationSubscription to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationSubscriptionUpdateInput.java b/src/main/java/com/segment/publicapi/models/DestinationSubscriptionUpdateInput.java index 9f400508..01e7de0d 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationSubscriptionUpdateInput.java +++ b/src/main/java/com/segment/publicapi/models/DestinationSubscriptionUpdateInput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,294 +9,378 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** The input parameters for updating a Destination subscription. */ +public class DestinationSubscriptionUpdateInput { + public static final String SERIALIZED_NAME_NAME = "name"; -/** - * The input parameters for updating a Destination subscription. - */ -@ApiModel(description = "The input parameters for updating a Destination subscription.") + @SerializedName(SERIALIZED_NAME_NAME) + private String name; -public class DestinationSubscriptionUpdateInput { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_TRIGGER = "trigger"; - @SerializedName(SERIALIZED_NAME_TRIGGER) - private String trigger; + public static final String SERIALIZED_NAME_TRIGGER = "trigger"; + + @SerializedName(SERIALIZED_NAME_TRIGGER) + private String trigger; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_SETTINGS = "settings"; + + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; + + public static final String SERIALIZED_NAME_REVERSE_E_T_L_MODEL_ID = "reverseETLModelId"; + + @SerializedName(SERIALIZED_NAME_REVERSE_E_T_L_MODEL_ID) + private String reverseETLModelId; - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + public static final String SERIALIZED_NAME_REVERSE_E_T_L_SCHEDULE = "reverseETLSchedule"; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; + @SerializedName(SERIALIZED_NAME_REVERSE_E_T_L_SCHEDULE) + private ReverseEtlScheduleDefinition reverseETLSchedule; - public DestinationSubscriptionUpdateInput() { - } + public DestinationSubscriptionUpdateInput() {} - public DestinationSubscriptionUpdateInput name(String name) { - - this.name = name; - return this; - } + public DestinationSubscriptionUpdateInput name(String name) { - /** - * The user-defined name for the subscription. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The user-defined name for the subscription.") + this.name = name; + return this; + } - public String getName() { - return name; - } + /** + * The user-defined name for the subscription. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } - public void setName(String name) { - this.name = name; - } + public DestinationSubscriptionUpdateInput trigger(String trigger) { + this.trigger = trigger; + return this; + } - public DestinationSubscriptionUpdateInput trigger(String trigger) { - - this.trigger = trigger; - return this; - } + /** + * The fql statement. + * + * @return trigger + */ + @javax.annotation.Nullable + public String getTrigger() { + return trigger; + } - /** - * The fql statement. - * @return trigger - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The fql statement.") + public void setTrigger(String trigger) { + this.trigger = trigger; + } + + public DestinationSubscriptionUpdateInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } - public String getTrigger() { - return trigger; - } + /** + * Is the subscription enabled. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public void setTrigger(String trigger) { - this.trigger = trigger; - } + public DestinationSubscriptionUpdateInput settings(Map settings) { + this.settings = settings; + return this; + } - public DestinationSubscriptionUpdateInput enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public DestinationSubscriptionUpdateInput putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } - /** - * Is the subscription enabled. - * @return enabled - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Is the subscription enabled.") + /** + * Represents settings used to configure an action subscription. + * + * @return settings + */ + @javax.annotation.Nullable + public Map getSettings() { + return settings; + } - public Boolean getEnabled() { - return enabled; - } + public void setSettings(Map settings) { + this.settings = settings; + } + public DestinationSubscriptionUpdateInput reverseETLModelId(String reverseETLModelId) { - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + this.reverseETLModelId = reverseETLModelId; + return this; + } + /** + * (Reverse ETL only) The reverse ETL model to attach this subscription to. + * + * @return reverseETLModelId + */ + @javax.annotation.Nullable + public String getReverseETLModelId() { + return reverseETLModelId; + } - public DestinationSubscriptionUpdateInput settings(Map settings) { - - this.settings = settings; - return this; - } + public void setReverseETLModelId(String reverseETLModelId) { + this.reverseETLModelId = reverseETLModelId; + } - /** - * The fields used for configuring this action. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The fields used for configuring this action.") + public DestinationSubscriptionUpdateInput reverseETLSchedule( + ReverseEtlScheduleDefinition reverseETLSchedule) { - public Map getSettings() { - return settings; - } + this.reverseETLSchedule = reverseETLSchedule; + return this; + } + /** + * Get reverseETLSchedule + * + * @return reverseETLSchedule + */ + @javax.annotation.Nullable + public ReverseEtlScheduleDefinition getReverseETLSchedule() { + return reverseETLSchedule; + } - public void setSettings(Map settings) { - this.settings = settings; - } + public void setReverseETLSchedule(ReverseEtlScheduleDefinition reverseETLSchedule) { + this.reverseETLSchedule = reverseETLSchedule; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationSubscriptionUpdateInput destinationSubscriptionUpdateInput = + (DestinationSubscriptionUpdateInput) o; + return Objects.equals(this.name, destinationSubscriptionUpdateInput.name) + && Objects.equals(this.trigger, destinationSubscriptionUpdateInput.trigger) + && Objects.equals(this.enabled, destinationSubscriptionUpdateInput.enabled) + && Objects.equals(this.settings, destinationSubscriptionUpdateInput.settings) + && Objects.equals( + this.reverseETLModelId, + destinationSubscriptionUpdateInput.reverseETLModelId) + && Objects.equals( + this.reverseETLSchedule, + destinationSubscriptionUpdateInput.reverseETLSchedule); + } + @Override + public int hashCode() { + return Objects.hash( + name, trigger, enabled, settings, reverseETLModelId, reverseETLSchedule); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationSubscriptionUpdateInput {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" reverseETLModelId: ") + .append(toIndentedString(reverseETLModelId)) + .append("\n"); + sb.append(" reverseETLSchedule: ") + .append(toIndentedString(reverseETLSchedule)) + .append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DestinationSubscriptionUpdateInput destinationSubscriptionUpdateInput = (DestinationSubscriptionUpdateInput) o; - return Objects.equals(this.name, destinationSubscriptionUpdateInput.name) && - Objects.equals(this.trigger, destinationSubscriptionUpdateInput.trigger) && - Objects.equals(this.enabled, destinationSubscriptionUpdateInput.enabled) && - Objects.equals(this.settings, destinationSubscriptionUpdateInput.settings); - } - - @Override - public int hashCode() { - return Objects.hash(name, trigger, enabled, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationSubscriptionUpdateInput {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("trigger"); + openapiFields.add("enabled"); + openapiFields.add("settings"); + openapiFields.add("reverseETLModelId"); + openapiFields.add("reverseETLSchedule"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); } - return o.toString().replace("\n", "\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("trigger"); - openapiFields.add("enabled"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationSubscriptionUpdateInput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationSubscriptionUpdateInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationSubscriptionUpdateInput is not found in the empty JSON string", DestinationSubscriptionUpdateInput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DestinationSubscriptionUpdateInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationSubscriptionUpdateInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationSubscriptionUpdateInput is" + + " not found in the empty JSON string", + DestinationSubscriptionUpdateInput.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationSubscriptionUpdateInput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationSubscriptionUpdateInput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationSubscriptionUpdateInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationSubscriptionUpdateInput` 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())); + } + if ((jsonObj.get("trigger") != null && !jsonObj.get("trigger").isJsonNull()) + && !jsonObj.get("trigger").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `trigger` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("trigger").toString())); + } + if ((jsonObj.get("reverseETLModelId") != null + && !jsonObj.get("reverseETLModelId").isJsonNull()) + && !jsonObj.get("reverseETLModelId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `reverseETLModelId` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("reverseETLModelId").toString())); + } + // validate the optional field `reverseETLSchedule` + if (jsonObj.get("reverseETLSchedule") != null + && !jsonObj.get("reverseETLSchedule").isJsonNull()) { + ReverseEtlScheduleDefinition.validateJsonElement(jsonObj.get("reverseETLSchedule")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationSubscriptionUpdateInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationSubscriptionUpdateInput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DestinationSubscriptionUpdateInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationSubscriptionUpdateInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationSubscriptionUpdateInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("trigger") != null && !jsonObj.get("trigger").isJsonNull()) && !jsonObj.get("trigger").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `trigger` to be a primitive type in the JSON string but got `%s`", jsonObj.get("trigger").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationSubscriptionUpdateInput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationSubscriptionUpdateInput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationSubscriptionUpdateInput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationSubscriptionUpdateInput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationSubscriptionUpdateInput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DestinationSubscriptionUpdateInput given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationSubscriptionUpdateInput - * @throws IOException if the JSON string is invalid with respect to DestinationSubscriptionUpdateInput - */ - public static DestinationSubscriptionUpdateInput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationSubscriptionUpdateInput.class); - } - - /** - * Convert an instance of DestinationSubscriptionUpdateInput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of DestinationSubscriptionUpdateInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationSubscriptionUpdateInput + * @throws IOException if the JSON string is invalid with respect to + * DestinationSubscriptionUpdateInput + */ + public static DestinationSubscriptionUpdateInput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationSubscriptionUpdateInput.class); + } + + /** + * Convert an instance of DestinationSubscriptionUpdateInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DestinationV1.java b/src/main/java/com/segment/publicapi/models/DestinationV1.java index e5666464..08439dd5 100644 --- a/src/main/java/com/segment/publicapi/models/DestinationV1.java +++ b/src/main/java/com/segment/publicapi/models/DestinationV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,376 +9,376 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Metadata; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.HashMap; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - /** - * Business tools or apps that you can connect to the data flowing through Segment. This is equal to the Destination object in Config API, with the following fields omitted: - catalogId - createTime - updateTime - connectionMode. + * Business tools or apps that you can connect to the data flowing through Segment. This is equal to + * the Destination object in Config API, with the following fields omitted: - catalogId - createTime + * - updateTime - connectionMode. */ -@ApiModel(description = "Business tools or apps that you can connect to the data flowing through Segment. This is equal to the Destination object in Config API, with the following fields omitted: - catalogId - createTime - updateTime - connectionMode.") - public class DestinationV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata metadata; + public static final String SERIALIZED_NAME_ID = "id"; - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; + @SerializedName(SERIALIZED_NAME_ID) + private String id; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings = new HashMap<>(); + public static final String SERIALIZED_NAME_NAME = "name"; - public DestinationV1() { - } + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public DestinationV1 id(String id) { - - this.id = id; - return this; - } + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - /** - * The unique identifier of this instance of a Destination. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier of this instance of a Destination. Config API note: analogous to `name`.") + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public String getId() { - return id; - } + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + private DestinationMetadataV1 metadata; - public void setId(String id) { - this.id = id; - } + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; - public DestinationV1 name(String name) { - - this.name = name; - return this; - } + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - /** - * The name of this instance of a Destination. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of this instance of a Destination. Config API note: equal to `displayName`.") + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings = new HashMap<>(); - public String getName() { - return name; - } + public DestinationV1() {} + public DestinationV1 id(String id) { - public void setName(String name) { - this.name = name; - } - - - public DestinationV1 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + this.id = id; + return this; + } - /** - * Whether this instance of a Destination receives data. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether this instance of a Destination receives data.") + /** + * The unique identifier of this instance of a Destination. Config API note: analogous to + * `name`. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - public Boolean getEnabled() { - return enabled; - } + public void setId(String id) { + this.id = id; + } + public DestinationV1 name(String name) { - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + this.name = name; + return this; + } + /** + * The name of this instance of a Destination. Config API note: equal to + * `displayName`. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - public DestinationV1 metadata(Metadata metadata) { - - this.metadata = metadata; - return this; - } + public void setName(String name) { + this.name = name; + } - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public DestinationV1 enabled(Boolean enabled) { - public Metadata getMetadata() { - return metadata; - } + this.enabled = enabled; + return this; + } + /** + * Whether this instance of a Destination receives data. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } - public void setMetadata(Metadata metadata) { - this.metadata = metadata; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + public DestinationV1 metadata(DestinationMetadataV1 metadata) { - public DestinationV1 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + this.metadata = metadata; + return this; + } - /** - * The id of a Source connected to this instance of a Destination. Config API note: analogous to `parent`. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of a Source connected to this instance of a Destination. Config API note: analogous to `parent`.") + /** + * Get metadata + * + * @return metadata + */ + @javax.annotation.Nonnull + public DestinationMetadataV1 getMetadata() { + return metadata; + } - public String getSourceId() { - return sourceId; - } + public void setMetadata(DestinationMetadataV1 metadata) { + this.metadata = metadata; + } + public DestinationV1 sourceId(String sourceId) { - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + this.sourceId = sourceId; + return this; + } + /** + * The id of a Source connected to this instance of a Destination. Config API note: analogous to + * `parent`. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } - public DestinationV1 settings(Map settings) { - - this.settings = settings; - return this; - } + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } - public DestinationV1 putSettingsItem(String key, Object settingsItem) { - this.settings.put(key, settingsItem); - return this; - } + public DestinationV1 settings(Map settings) { - /** - * The collection of settings associated with a Destination. Config API note: equal to `config`. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The collection of settings associated with a Destination. Config API note: equal to `config`.") + this.settings = settings; + return this; + } - public Map getSettings() { - return settings; - } + public DestinationV1 putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + /** + * The collection of settings associated with a Destination. Config API note: equal to + * `config`. + * + * @return settings + */ + @javax.annotation.Nonnull + public Map getSettings() { + return settings; + } - public void setSettings(Map settings) { - this.settings = settings; - } + public void setSettings(Map settings) { + this.settings = settings; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationV1 destinationV1 = (DestinationV1) o; + return Objects.equals(this.id, destinationV1.id) + && Objects.equals(this.name, destinationV1.name) + && Objects.equals(this.enabled, destinationV1.enabled) + && Objects.equals(this.metadata, destinationV1.metadata) + && Objects.equals(this.sourceId, destinationV1.sourceId) + && Objects.equals(this.settings, destinationV1.settings); + } + @Override + public int hashCode() { + return Objects.hash(id, name, enabled, metadata, sourceId, settings); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DestinationV1 destinationV1 = (DestinationV1) o; - return Objects.equals(this.id, destinationV1.id) && - Objects.equals(this.name, destinationV1.name) && - Objects.equals(this.enabled, destinationV1.enabled) && - Objects.equals(this.metadata, destinationV1.metadata) && - Objects.equals(this.sourceId, destinationV1.sourceId) && - Objects.equals(this.settings, destinationV1.settings); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, enabled, metadata, sourceId, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("name"); + openapiFields.add("enabled"); + openapiFields.add("metadata"); + openapiFields.add("sourceId"); + openapiFields.add("settings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("metadata"); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("settings"); } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("enabled"); - openapiFields.add("metadata"); - openapiFields.add("sourceId"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("settings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DestinationV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DestinationV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DestinationV1 is not found in the empty JSON string", DestinationV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DestinationV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DestinationV1 is not found in the" + + " empty JSON string", + DestinationV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DestinationV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DestinationV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DestinationV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DestinationV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DestinationV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 required field `metadata` + DestinationMetadataV1.validateJsonElement(jsonObj.get("metadata")); + if (!jsonObj.get("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DestinationV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DestinationV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("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("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DestinationV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DestinationV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DestinationV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DestinationV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DestinationV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of DestinationV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of DestinationV1 - * @throws IOException if the JSON string is invalid with respect to DestinationV1 - */ - public static DestinationV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DestinationV1.class); - } - - /** - * Convert an instance of DestinationV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of DestinationV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationV1 + * @throws IOException if the JSON string is invalid with respect to DestinationV1 + */ + public static DestinationV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationV1.class); + } + + /** + * Convert an instance of DestinationV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DisableEdgeFunctions200Response.java b/src/main/java/com/segment/publicapi/models/DisableEdgeFunctions200Response.java index db8370ee..3b7ed1be 100644 --- a/src/main/java/com/segment/publicapi/models/DisableEdgeFunctions200Response.java +++ b/src/main/java/com/segment/publicapi/models/DisableEdgeFunctions200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DisableEdgeFunctionsAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * DisableEdgeFunctions200Response - */ - +/** DisableEdgeFunctions200Response */ public class DisableEdgeFunctions200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private DisableEdgeFunctionsAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public DisableEdgeFunctions200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private DisableEdgeFunctionsAlphaOutput data; - public DisableEdgeFunctions200Response data(DisableEdgeFunctionsAlphaOutput data) { - - this.data = data; - return this; - } + public DisableEdgeFunctions200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public DisableEdgeFunctions200Response data(DisableEdgeFunctionsAlphaOutput data) { - public DisableEdgeFunctionsAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public DisableEdgeFunctionsAlphaOutput getData() { + return data; + } - public void setData(DisableEdgeFunctionsAlphaOutput data) { - this.data = data; - } + public void setData(DisableEdgeFunctionsAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisableEdgeFunctions200Response disableEdgeFunctions200Response = + (DisableEdgeFunctions200Response) o; + return Objects.equals(this.data, disableEdgeFunctions200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisableEdgeFunctions200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DisableEdgeFunctions200Response disableEdgeFunctions200Response = (DisableEdgeFunctions200Response) o; - return Objects.equals(this.data, disableEdgeFunctions200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DisableEdgeFunctions200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DisableEdgeFunctions200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DisableEdgeFunctions200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DisableEdgeFunctions200Response is not found in the empty JSON string", DisableEdgeFunctions200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DisableEdgeFunctions200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisableEdgeFunctions200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DisableEdgeFunctions200Response is not" + + " found in the empty JSON string", + DisableEdgeFunctions200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DisableEdgeFunctions200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisableEdgeFunctions200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisableEdgeFunctions200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DisableEdgeFunctions200Response` 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()) { + DisableEdgeFunctionsAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DisableEdgeFunctions200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DisableEdgeFunctions200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DisableEdgeFunctions200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DisableEdgeFunctions200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DisableEdgeFunctions200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisableEdgeFunctions200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisableEdgeFunctions200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DisableEdgeFunctions200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DisableEdgeFunctions200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisableEdgeFunctions200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DisableEdgeFunctions200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisableEdgeFunctions200Response + * @throws IOException if the JSON string is invalid with respect to + * DisableEdgeFunctions200Response + */ + public static DisableEdgeFunctions200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisableEdgeFunctions200Response.class); } - } - - /** - * Create an instance of DisableEdgeFunctions200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of DisableEdgeFunctions200Response - * @throws IOException if the JSON string is invalid with respect to DisableEdgeFunctions200Response - */ - public static DisableEdgeFunctions200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DisableEdgeFunctions200Response.class); - } - - /** - * Convert an instance of DisableEdgeFunctions200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DisableEdgeFunctions200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/DisableEdgeFunctionsAlphaOutput.java b/src/main/java/com/segment/publicapi/models/DisableEdgeFunctionsAlphaOutput.java index 2f045ac7..7c4681ae 100644 --- a/src/main/java/com/segment/publicapi/models/DisableEdgeFunctionsAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/DisableEdgeFunctionsAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,200 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.EdgeFunctions1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Output for DisableEdgeFunctions. - */ -@ApiModel(description = "Output for DisableEdgeFunctions.") - +/** Output for DisableEdgeFunctions. */ public class DisableEdgeFunctionsAlphaOutput { - public static final String SERIALIZED_NAME_EDGE_FUNCTIONS = "edgeFunctions"; - @SerializedName(SERIALIZED_NAME_EDGE_FUNCTIONS) - private EdgeFunctions1 edgeFunctions; + public static final String SERIALIZED_NAME_EDGE_FUNCTIONS = "edgeFunctions"; - public DisableEdgeFunctionsAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_EDGE_FUNCTIONS) + private EdgeFunctionsAlpha edgeFunctions; - public DisableEdgeFunctionsAlphaOutput edgeFunctions(EdgeFunctions1 edgeFunctions) { - - this.edgeFunctions = edgeFunctions; - return this; - } + public DisableEdgeFunctionsAlphaOutput() {} - /** - * Get edgeFunctions - * @return edgeFunctions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public DisableEdgeFunctionsAlphaOutput edgeFunctions(EdgeFunctionsAlpha edgeFunctions) { - public EdgeFunctions1 getEdgeFunctions() { - return edgeFunctions; - } + this.edgeFunctions = edgeFunctions; + return this; + } + /** + * Get edgeFunctions + * + * @return edgeFunctions + */ + @javax.annotation.Nonnull + public EdgeFunctionsAlpha getEdgeFunctions() { + return edgeFunctions; + } - public void setEdgeFunctions(EdgeFunctions1 edgeFunctions) { - this.edgeFunctions = edgeFunctions; - } + public void setEdgeFunctions(EdgeFunctionsAlpha edgeFunctions) { + this.edgeFunctions = edgeFunctions; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisableEdgeFunctionsAlphaOutput disableEdgeFunctionsAlphaOutput = + (DisableEdgeFunctionsAlphaOutput) o; + return Objects.equals(this.edgeFunctions, disableEdgeFunctionsAlphaOutput.edgeFunctions); + } + @Override + public int hashCode() { + return Objects.hash(edgeFunctions); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisableEdgeFunctionsAlphaOutput {\n"); + sb.append(" edgeFunctions: ").append(toIndentedString(edgeFunctions)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - DisableEdgeFunctionsAlphaOutput disableEdgeFunctionsAlphaOutput = (DisableEdgeFunctionsAlphaOutput) o; - return Objects.equals(this.edgeFunctions, disableEdgeFunctionsAlphaOutput.edgeFunctions); - } - - @Override - public int hashCode() { - return Objects.hash(edgeFunctions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DisableEdgeFunctionsAlphaOutput {\n"); - sb.append(" edgeFunctions: ").append(toIndentedString(edgeFunctions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("edgeFunctions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("edgeFunctions"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("edgeFunctions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("edgeFunctions"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to DisableEdgeFunctionsAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!DisableEdgeFunctionsAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DisableEdgeFunctionsAlphaOutput is not found in the empty JSON string", DisableEdgeFunctionsAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * DisableEdgeFunctionsAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisableEdgeFunctionsAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in DisableEdgeFunctionsAlphaOutput is not" + + " found in the empty JSON string", + DisableEdgeFunctionsAlphaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!DisableEdgeFunctionsAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisableEdgeFunctionsAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisableEdgeFunctionsAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `DisableEdgeFunctionsAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DisableEdgeFunctionsAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisableEdgeFunctionsAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `edgeFunctions` + EdgeFunctionsAlpha.validateJsonElement(jsonObj.get("edgeFunctions")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DisableEdgeFunctionsAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DisableEdgeFunctionsAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DisableEdgeFunctionsAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DisableEdgeFunctionsAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DisableEdgeFunctionsAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisableEdgeFunctionsAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisableEdgeFunctionsAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DisableEdgeFunctionsAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DisableEdgeFunctionsAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisableEdgeFunctionsAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DisableEdgeFunctionsAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisableEdgeFunctionsAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * DisableEdgeFunctionsAlphaOutput + */ + public static DisableEdgeFunctionsAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisableEdgeFunctionsAlphaOutput.class); } - } - - /** - * Create an instance of DisableEdgeFunctionsAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of DisableEdgeFunctionsAlphaOutput - * @throws IOException if the JSON string is invalid with respect to DisableEdgeFunctionsAlphaOutput - */ - public static DisableEdgeFunctionsAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DisableEdgeFunctionsAlphaOutput.class); - } - - /** - * Convert an instance of DisableEdgeFunctionsAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of DisableEdgeFunctionsAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Download.java b/src/main/java/com/segment/publicapi/models/Download.java new file mode 100644 index 00000000..24c314e3 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/Download.java @@ -0,0 +1,221 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Download */ +public class Download { + public static final String SERIALIZED_NAME_URLS = "urls"; + + @SerializedName(SERIALIZED_NAME_URLS) + private List urls = new ArrayList<>(); + + public Download() {} + + public Download urls(List urls) { + + this.urls = urls; + return this; + } + + public Download addUrlsItem(String urlsItem) { + if (this.urls == null) { + this.urls = new ArrayList<>(); + } + this.urls.add(urlsItem); + return this; + } + + /** + * List of presigned URLs from S3. + * + * @return urls + */ + @javax.annotation.Nonnull + public List getUrls() { + return urls; + } + + public void setUrls(List urls) { + this.urls = urls; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Download download = (Download) o; + return Objects.equals(this.urls, download.urls); + } + + @Override + public int hashCode() { + return Objects.hash(urls); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Download {\n"); + sb.append(" urls: ").append(toIndentedString(urls)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("urls"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("urls"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Download + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Download.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Download is not found in the empty" + + " JSON string", + Download.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Download.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `Download`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Download.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 required json array is present + if (jsonObj.get("urls") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("urls").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `urls` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("urls").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Download.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Download' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Download.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Download value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Download read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of Download given an JSON string + * + * @param jsonString JSON string + * @return An instance of Download + * @throws IOException if the JSON string is invalid with respect to Download + */ + public static Download fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Download.class); + } + + /** + * Convert an instance of Download to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Echo200Response.java b/src/main/java/com/segment/publicapi/models/Echo200Response.java index 5878e4ba..a1ec817c 100644 --- a/src/main/java/com/segment/publicapi/models/Echo200Response.java +++ b/src/main/java/com/segment/publicapi/models/Echo200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,185 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.EchoAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Echo200Response - */ - +/** Echo200Response */ public class Echo200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private EchoAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public Echo200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private EchoV1Output data; - public Echo200Response data(EchoAlphaOutput data) { - - this.data = data; - return this; - } + public Echo200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public Echo200Response data(EchoV1Output data) { - public EchoAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public EchoV1Output getData() { + return data; + } - public void setData(EchoAlphaOutput data) { - this.data = data; - } + public void setData(EchoV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Echo200Response echo200Response = (Echo200Response) o; + return Objects.equals(this.data, echo200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Echo200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - Echo200Response echo200Response = (Echo200Response) o; - return Objects.equals(this.data, echo200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Echo200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Echo200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Echo200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Echo200Response is not found in the empty JSON string", Echo200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Echo200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Echo200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Echo200Response is not found in the" + + " empty JSON string", + Echo200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Echo200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Echo200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Echo200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `Echo200Response` 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()) { + EchoV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Echo200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Echo200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Echo200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Echo200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Echo200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Echo200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Echo200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Echo200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Echo200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Echo200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of Echo200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of Echo200Response + * @throws IOException if the JSON string is invalid with respect to Echo200Response + */ + public static Echo200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Echo200Response.class); } - } - - /** - * Create an instance of Echo200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of Echo200Response - * @throws IOException if the JSON string is invalid with respect to Echo200Response - */ - public static Echo200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Echo200Response.class); - } - - /** - * Convert an instance of Echo200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of Echo200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Echo200Response1.java b/src/main/java/com/segment/publicapi/models/Echo200Response1.java index 237ce0f8..a5f04a7f 100644 --- a/src/main/java/com/segment/publicapi/models/Echo200Response1.java +++ b/src/main/java/com/segment/publicapi/models/Echo200Response1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,185 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.EchoV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Echo200Response1 - */ - +/** Echo200Response1 */ public class Echo200Response1 { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private EchoV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public Echo200Response1() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private EchoAlphaOutput data; - public Echo200Response1 data(EchoV1Output data) { - - this.data = data; - return this; - } + public Echo200Response1() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public Echo200Response1 data(EchoAlphaOutput data) { - public EchoV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public EchoAlphaOutput getData() { + return data; + } - public void setData(EchoV1Output data) { - this.data = data; - } + public void setData(EchoAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Echo200Response1 echo200Response1 = (Echo200Response1) o; + return Objects.equals(this.data, echo200Response1.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Echo200Response1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - Echo200Response1 echo200Response1 = (Echo200Response1) o; - return Objects.equals(this.data, echo200Response1.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Echo200Response1 {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Echo200Response1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Echo200Response1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Echo200Response1 is not found in the empty JSON string", Echo200Response1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Echo200Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Echo200Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Echo200Response1 is not found in the" + + " empty JSON string", + Echo200Response1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Echo200Response1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Echo200Response1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Echo200Response1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `Echo200Response1` 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()) { + EchoAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Echo200Response1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Echo200Response1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Echo200Response1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Echo200Response1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Echo200Response1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Echo200Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Echo200Response1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Echo200Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Echo200Response1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Echo200Response1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of Echo200Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Echo200Response1 + * @throws IOException if the JSON string is invalid with respect to Echo200Response1 + */ + public static Echo200Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Echo200Response1.class); } - } - - /** - * Create an instance of Echo200Response1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Echo200Response1 - * @throws IOException if the JSON string is invalid with respect to Echo200Response1 - */ - public static Echo200Response1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Echo200Response1.class); - } - - /** - * Convert an instance of Echo200Response1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of Echo200Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/EchoAlphaOutput.java b/src/main/java/com/segment/publicapi/models/EchoAlphaOutput.java index 7632b6df..5cc56151 100644 --- a/src/main/java/com/segment/publicapi/models/EchoAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/EchoAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,327 +9,324 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.HashMap; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Echo response. - */ -@ApiModel(description = "Echo response.") - +/** Echo response. */ public class EchoAlphaOutput { - /** - * The HTTP method used for this round-trip. Currently, this endpoint supports only `get` and `post` methods. - */ - @JsonAdapter(MethodEnum.Adapter.class) - public enum MethodEnum { - GET("get"), - - POST("post"); - - private String value; - - MethodEnum(String value) { - this.value = value; - } + /** + * The HTTP method used for this round-trip. Currently, this endpoint supports only + * `get` and `post` methods. + */ + @JsonAdapter(MethodEnum.Adapter.class) + public enum MethodEnum { + GET("get"), - public String getValue() { - return value; - } + POST("post"); - @Override - public String toString() { - return String.valueOf(value); - } + private String value; - public static MethodEnum fromValue(String value) { - for (MethodEnum b : MethodEnum.values()) { - if (b.value.equals(value)) { - return b; + MethodEnum(String value) { + this.value = value; } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final MethodEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public MethodEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return MethodEnum.fromValue(value); - } - } - } + public String getValue() { + return value; + } - public static final String SERIALIZED_NAME_METHOD = "method"; - @SerializedName(SERIALIZED_NAME_METHOD) - private MethodEnum method; + @Override + public String toString() { + return String.valueOf(value); + } - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - private String message; + public static MethodEnum fromValue(String value) { + for (MethodEnum b : MethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public static final String SERIALIZED_NAME_HEADERS = "headers"; - @SerializedName(SERIALIZED_NAME_HEADERS) - private Map headers = new HashMap<>(); + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MethodEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MethodEnum.fromValue(value); + } + } + } - public EchoAlphaOutput() { - } + public static final String SERIALIZED_NAME_METHOD = "method"; - public EchoAlphaOutput method(MethodEnum method) { - - this.method = method; - return this; - } + @SerializedName(SERIALIZED_NAME_METHOD) + private MethodEnum method; - /** - * The HTTP method used for this round-trip. Currently, this endpoint supports only `get` and `post` methods. - * @return method - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The HTTP method used for this round-trip. Currently, this endpoint supports only `get` and `post` methods.") + public static final String SERIALIZED_NAME_MESSAGE = "message"; - public MethodEnum getMethod() { - return method; - } + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + public static final String SERIALIZED_NAME_HEADERS = "headers"; - public void setMethod(MethodEnum method) { - this.method = method; - } + @SerializedName(SERIALIZED_NAME_HEADERS) + private Map headers = new HashMap<>(); + public EchoAlphaOutput() {} - public EchoAlphaOutput message(String message) { - - this.message = message; - return this; - } + public EchoAlphaOutput method(MethodEnum method) { - /** - * The string passed in the `message` input field. - * @return message - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The string passed in the `message` input field.") + this.method = method; + return this; + } - public String getMessage() { - return message; - } + /** + * The HTTP method used for this round-trip. Currently, this endpoint supports only + * `get` and `post` methods. + * + * @return method + */ + @javax.annotation.Nonnull + public MethodEnum getMethod() { + return method; + } + public void setMethod(MethodEnum method) { + this.method = method; + } - public void setMessage(String message) { - this.message = message; - } + public EchoAlphaOutput message(String message) { + this.message = message; + return this; + } - public EchoAlphaOutput headers(Map headers) { - - this.headers = headers; - return this; - } + /** + * The string passed in the `message` input field. + * + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } - public EchoAlphaOutput putHeadersItem(String key, Object headersItem) { - this.headers.put(key, headersItem); - return this; - } + public void setMessage(String message) { + this.message = message; + } - /** - * The request's HTTP headers. - * @return headers - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The request's HTTP headers.") + public EchoAlphaOutput headers(Map headers) { - public Map getHeaders() { - return headers; - } + this.headers = headers; + return this; + } + public EchoAlphaOutput putHeadersItem(String key, Object headersItem) { + if (this.headers == null) { + this.headers = new HashMap<>(); + } + this.headers.put(key, headersItem); + return this; + } - public void setHeaders(Map headers) { - this.headers = headers; - } + /** + * The request's HTTP headers. + * + * @return headers + */ + @javax.annotation.Nonnull + public Map getHeaders() { + return headers; + } + public void setHeaders(Map headers) { + this.headers = headers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EchoAlphaOutput echoAlphaOutput = (EchoAlphaOutput) o; + return Objects.equals(this.method, echoAlphaOutput.method) + && Objects.equals(this.message, echoAlphaOutput.message) + && Objects.equals(this.headers, echoAlphaOutput.headers); + } + @Override + public int hashCode() { + return Objects.hash(method, message, headers); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EchoAlphaOutput {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - EchoAlphaOutput echoAlphaOutput = (EchoAlphaOutput) o; - return Objects.equals(this.method, echoAlphaOutput.method) && - Objects.equals(this.message, echoAlphaOutput.message) && - Objects.equals(this.headers, echoAlphaOutput.headers); - } - - @Override - public int hashCode() { - return Objects.hash(method, message, headers); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EchoAlphaOutput {\n"); - sb.append(" method: ").append(toIndentedString(method)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("method"); + openapiFields.add("message"); + openapiFields.add("headers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("method"); + openapiRequiredFields.add("message"); + openapiRequiredFields.add("headers"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("method"); - openapiFields.add("message"); - openapiFields.add("headers"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("method"); - openapiRequiredFields.add("message"); - openapiRequiredFields.add("headers"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to EchoAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!EchoAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in EchoAlphaOutput is not found in the empty JSON string", EchoAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EchoAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EchoAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in EchoAlphaOutput is not found in the" + + " empty JSON string", + EchoAlphaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!EchoAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EchoAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EchoAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `EchoAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : EchoAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EchoAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("method").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `method` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("method").toString())); + } + if (!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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EchoAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EchoAlphaOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(EchoAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, EchoAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EchoAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - if (!jsonObj.get("method").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `method` to be a primitive type in the JSON string but got `%s`", jsonObj.get("method").toString())); - } - if (!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())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!EchoAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'EchoAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(EchoAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, EchoAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public EchoAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of EchoAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of EchoAlphaOutput - * @throws IOException if the JSON string is invalid with respect to EchoAlphaOutput - */ - public static EchoAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, EchoAlphaOutput.class); - } - - /** - * Convert an instance of EchoAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of EchoAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of EchoAlphaOutput + * @throws IOException if the JSON string is invalid with respect to EchoAlphaOutput + */ + public static EchoAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EchoAlphaOutput.class); + } + + /** + * Convert an instance of EchoAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/EchoV1Output.java b/src/main/java/com/segment/publicapi/models/EchoV1Output.java index fb4d25f7..d18f2864 100644 --- a/src/main/java/com/segment/publicapi/models/EchoV1Output.java +++ b/src/main/java/com/segment/publicapi/models/EchoV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,327 +9,323 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.HashMap; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Echo response. - */ -@ApiModel(description = "Echo response.") - +/** Echo response. */ public class EchoV1Output { - /** - * The HTTP method used for this round-trip. Currently, this endpoint supports only `get` and `post` methods. - */ - @JsonAdapter(MethodEnum.Adapter.class) - public enum MethodEnum { - GET("get"), - - POST("post"); - - private String value; - - MethodEnum(String value) { - this.value = value; - } + /** + * The HTTP method used for this round-trip. Currently, this endpoint supports only + * `get` and `post` methods. + */ + @JsonAdapter(MethodEnum.Adapter.class) + public enum MethodEnum { + GET("get"), - public String getValue() { - return value; - } + POST("post"); - @Override - public String toString() { - return String.valueOf(value); - } + private String value; - public static MethodEnum fromValue(String value) { - for (MethodEnum b : MethodEnum.values()) { - if (b.value.equals(value)) { - return b; + MethodEnum(String value) { + this.value = value; } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final MethodEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public MethodEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return MethodEnum.fromValue(value); - } - } - } + public String getValue() { + return value; + } - public static final String SERIALIZED_NAME_METHOD = "method"; - @SerializedName(SERIALIZED_NAME_METHOD) - private MethodEnum method; + @Override + public String toString() { + return String.valueOf(value); + } - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - private String message; + public static MethodEnum fromValue(String value) { + for (MethodEnum b : MethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public static final String SERIALIZED_NAME_HEADERS = "headers"; - @SerializedName(SERIALIZED_NAME_HEADERS) - private Map headers = new HashMap<>(); + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MethodEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MethodEnum.fromValue(value); + } + } + } - public EchoV1Output() { - } + public static final String SERIALIZED_NAME_METHOD = "method"; - public EchoV1Output method(MethodEnum method) { - - this.method = method; - return this; - } + @SerializedName(SERIALIZED_NAME_METHOD) + private MethodEnum method; - /** - * The HTTP method used for this round-trip. Currently, this endpoint supports only `get` and `post` methods. - * @return method - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The HTTP method used for this round-trip. Currently, this endpoint supports only `get` and `post` methods.") + public static final String SERIALIZED_NAME_MESSAGE = "message"; - public MethodEnum getMethod() { - return method; - } + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + public static final String SERIALIZED_NAME_HEADERS = "headers"; - public void setMethod(MethodEnum method) { - this.method = method; - } + @SerializedName(SERIALIZED_NAME_HEADERS) + private Map headers = new HashMap<>(); + public EchoV1Output() {} - public EchoV1Output message(String message) { - - this.message = message; - return this; - } + public EchoV1Output method(MethodEnum method) { - /** - * The string passed in the `message` input field. - * @return message - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The string passed in the `message` input field.") + this.method = method; + return this; + } - public String getMessage() { - return message; - } + /** + * The HTTP method used for this round-trip. Currently, this endpoint supports only + * `get` and `post` methods. + * + * @return method + */ + @javax.annotation.Nonnull + public MethodEnum getMethod() { + return method; + } + public void setMethod(MethodEnum method) { + this.method = method; + } - public void setMessage(String message) { - this.message = message; - } + public EchoV1Output message(String message) { + this.message = message; + return this; + } - public EchoV1Output headers(Map headers) { - - this.headers = headers; - return this; - } + /** + * The string passed in the `message` input field. + * + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } - public EchoV1Output putHeadersItem(String key, Object headersItem) { - this.headers.put(key, headersItem); - return this; - } + public void setMessage(String message) { + this.message = message; + } - /** - * The request's HTTP headers. - * @return headers - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The request's HTTP headers.") + public EchoV1Output headers(Map headers) { - public Map getHeaders() { - return headers; - } + this.headers = headers; + return this; + } + public EchoV1Output putHeadersItem(String key, Object headersItem) { + if (this.headers == null) { + this.headers = new HashMap<>(); + } + this.headers.put(key, headersItem); + return this; + } - public void setHeaders(Map headers) { - this.headers = headers; - } + /** + * The request's HTTP headers. + * + * @return headers + */ + @javax.annotation.Nonnull + public Map getHeaders() { + return headers; + } + public void setHeaders(Map headers) { + this.headers = headers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EchoV1Output echoV1Output = (EchoV1Output) o; + return Objects.equals(this.method, echoV1Output.method) + && Objects.equals(this.message, echoV1Output.message) + && Objects.equals(this.headers, echoV1Output.headers); + } + @Override + public int hashCode() { + return Objects.hash(method, message, headers); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EchoV1Output {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - EchoV1Output echoV1Output = (EchoV1Output) o; - return Objects.equals(this.method, echoV1Output.method) && - Objects.equals(this.message, echoV1Output.message) && - Objects.equals(this.headers, echoV1Output.headers); - } - - @Override - public int hashCode() { - return Objects.hash(method, message, headers); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EchoV1Output {\n"); - sb.append(" method: ").append(toIndentedString(method)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("method"); + openapiFields.add("message"); + openapiFields.add("headers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("method"); + openapiRequiredFields.add("message"); + openapiRequiredFields.add("headers"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("method"); - openapiFields.add("message"); - openapiFields.add("headers"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("method"); - openapiRequiredFields.add("message"); - openapiRequiredFields.add("headers"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to EchoV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!EchoV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in EchoV1Output is not found in the empty JSON string", EchoV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EchoV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EchoV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in EchoV1Output is not found in the empty" + + " JSON string", + EchoV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!EchoV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EchoV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EchoV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `EchoV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : EchoV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EchoV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("method").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `method` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("method").toString())); + } + if (!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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EchoV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EchoV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(EchoV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, EchoV1Output value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EchoV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - if (!jsonObj.get("method").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `method` to be a primitive type in the JSON string but got `%s`", jsonObj.get("method").toString())); - } - if (!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())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!EchoV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'EchoV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(EchoV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, EchoV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public EchoV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of EchoV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of EchoV1Output - * @throws IOException if the JSON string is invalid with respect to EchoV1Output - */ - public static EchoV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, EchoV1Output.class); - } - - /** - * Convert an instance of EchoV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of EchoV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of EchoV1Output + * @throws IOException if the JSON string is invalid with respect to EchoV1Output + */ + public static EchoV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EchoV1Output.class); + } + + /** + * Convert an instance of EchoV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/EdgeFunctions.java b/src/main/java/com/segment/publicapi/models/EdgeFunctions.java deleted file mode 100644 index 117c1dfb..00000000 --- a/src/main/java/com/segment/publicapi/models/EdgeFunctions.java +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.math.BigDecimal; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The created Edge Function. - */ -@ApiModel(description = "The created Edge Function.") - -public class EdgeFunctions { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; - - public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; - @SerializedName(SERIALIZED_NAME_CREATED_BY) - private String createdBy; - - public static final String SERIALIZED_NAME_DOWNLOAD_U_R_L = "downloadURL"; - @SerializedName(SERIALIZED_NAME_DOWNLOAD_U_R_L) - private String downloadURL; - - public static final String SERIALIZED_NAME_VERSION = "version"; - @SerializedName(SERIALIZED_NAME_VERSION) - private BigDecimal version; - - public EdgeFunctions() { - } - - public EdgeFunctions id(String id) { - - this.id = id; - return this; - } - - /** - * The Edge Function id. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Edge Function id.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public EdgeFunctions sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } - - /** - * The Source id. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source id.") - - public String getSourceId() { - return sourceId; - } - - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public EdgeFunctions createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } - - /** - * Creation date. - * @return createdAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Creation date.") - - public String getCreatedAt() { - return createdAt; - } - - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - - public EdgeFunctions createdBy(String createdBy) { - - this.createdBy = createdBy; - return this; - } - - /** - * Creating user's id. - * @return createdBy - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Creating user's id.") - - public String getCreatedBy() { - return createdBy; - } - - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - - public EdgeFunctions downloadURL(String downloadURL) { - - this.downloadURL = downloadURL; - return this; - } - - /** - * The CDN URL that can be used to fetch your latest EdgeFunctions bundle. - * @return downloadURL - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The CDN URL that can be used to fetch your latest EdgeFunctions bundle.") - - public String getDownloadURL() { - return downloadURL; - } - - - public void setDownloadURL(String downloadURL) { - this.downloadURL = downloadURL; - } - - - public EdgeFunctions version(BigDecimal version) { - - this.version = version; - return this; - } - - /** - * Revision number associated with the latest Edge Function. - * @return version - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Revision number associated with the latest Edge Function.") - - public BigDecimal getVersion() { - return version; - } - - - public void setVersion(BigDecimal version) { - this.version = version; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EdgeFunctions edgeFunctions = (EdgeFunctions) o; - return Objects.equals(this.id, edgeFunctions.id) && - Objects.equals(this.sourceId, edgeFunctions.sourceId) && - Objects.equals(this.createdAt, edgeFunctions.createdAt) && - Objects.equals(this.createdBy, edgeFunctions.createdBy) && - Objects.equals(this.downloadURL, edgeFunctions.downloadURL) && - Objects.equals(this.version, edgeFunctions.version); - } - - @Override - public int hashCode() { - return Objects.hash(id, sourceId, createdAt, createdBy, downloadURL, version); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EdgeFunctions {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); - sb.append(" downloadURL: ").append(toIndentedString(downloadURL)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("sourceId"); - openapiFields.add("createdAt"); - openapiFields.add("createdBy"); - openapiFields.add("downloadURL"); - openapiFields.add("version"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("createdAt"); - openapiRequiredFields.add("createdBy"); - openapiRequiredFields.add("downloadURL"); - openapiRequiredFields.add("version"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to EdgeFunctions - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!EdgeFunctions.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in EdgeFunctions is not found in the empty JSON string", EdgeFunctions.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!EdgeFunctions.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EdgeFunctions` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : EdgeFunctions.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - if (!jsonObj.get("createdBy").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString())); - } - if (!jsonObj.get("downloadURL").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `downloadURL` to be a primitive type in the JSON string but got `%s`", jsonObj.get("downloadURL").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!EdgeFunctions.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'EdgeFunctions' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(EdgeFunctions.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, EdgeFunctions value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public EdgeFunctions read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of EdgeFunctions given an JSON string - * - * @param jsonString JSON string - * @return An instance of EdgeFunctions - * @throws IOException if the JSON string is invalid with respect to EdgeFunctions - */ - public static EdgeFunctions fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, EdgeFunctions.class); - } - - /** - * Convert an instance of EdgeFunctions to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/EdgeFunctions1.java b/src/main/java/com/segment/publicapi/models/EdgeFunctions1.java deleted file mode 100644 index 2f450246..00000000 --- a/src/main/java/com/segment/publicapi/models/EdgeFunctions1.java +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.math.BigDecimal; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The latest version of Edge Function bundle. - */ -@ApiModel(description = "The latest version of Edge Function bundle.") - -public class EdgeFunctions1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; - - public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; - @SerializedName(SERIALIZED_NAME_CREATED_BY) - private String createdBy; - - public static final String SERIALIZED_NAME_DOWNLOAD_U_R_L = "downloadURL"; - @SerializedName(SERIALIZED_NAME_DOWNLOAD_U_R_L) - private String downloadURL; - - public static final String SERIALIZED_NAME_VERSION = "version"; - @SerializedName(SERIALIZED_NAME_VERSION) - private BigDecimal version; - - public EdgeFunctions1() { - } - - public EdgeFunctions1 id(String id) { - - this.id = id; - return this; - } - - /** - * The Edge Function id. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Edge Function id.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public EdgeFunctions1 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } - - /** - * The Source id. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source id.") - - public String getSourceId() { - return sourceId; - } - - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public EdgeFunctions1 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } - - /** - * Creation date. - * @return createdAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Creation date.") - - public String getCreatedAt() { - return createdAt; - } - - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - - public EdgeFunctions1 createdBy(String createdBy) { - - this.createdBy = createdBy; - return this; - } - - /** - * Creating user's id. - * @return createdBy - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Creating user's id.") - - public String getCreatedBy() { - return createdBy; - } - - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - - public EdgeFunctions1 downloadURL(String downloadURL) { - - this.downloadURL = downloadURL; - return this; - } - - /** - * The CDN URL that can be used to fetch your latest EdgeFunctions bundle. - * @return downloadURL - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The CDN URL that can be used to fetch your latest EdgeFunctions bundle.") - - public String getDownloadURL() { - return downloadURL; - } - - - public void setDownloadURL(String downloadURL) { - this.downloadURL = downloadURL; - } - - - public EdgeFunctions1 version(BigDecimal version) { - - this.version = version; - return this; - } - - /** - * Revision number associated with the latest Edge Function. - * @return version - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Revision number associated with the latest Edge Function.") - - public BigDecimal getVersion() { - return version; - } - - - public void setVersion(BigDecimal version) { - this.version = version; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EdgeFunctions1 edgeFunctions1 = (EdgeFunctions1) o; - return Objects.equals(this.id, edgeFunctions1.id) && - Objects.equals(this.sourceId, edgeFunctions1.sourceId) && - Objects.equals(this.createdAt, edgeFunctions1.createdAt) && - Objects.equals(this.createdBy, edgeFunctions1.createdBy) && - Objects.equals(this.downloadURL, edgeFunctions1.downloadURL) && - Objects.equals(this.version, edgeFunctions1.version); - } - - @Override - public int hashCode() { - return Objects.hash(id, sourceId, createdAt, createdBy, downloadURL, version); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EdgeFunctions1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); - sb.append(" downloadURL: ").append(toIndentedString(downloadURL)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("sourceId"); - openapiFields.add("createdAt"); - openapiFields.add("createdBy"); - openapiFields.add("downloadURL"); - openapiFields.add("version"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("createdAt"); - openapiRequiredFields.add("createdBy"); - openapiRequiredFields.add("downloadURL"); - openapiRequiredFields.add("version"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to EdgeFunctions1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!EdgeFunctions1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in EdgeFunctions1 is not found in the empty JSON string", EdgeFunctions1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!EdgeFunctions1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EdgeFunctions1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : EdgeFunctions1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - if (!jsonObj.get("createdBy").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString())); - } - if (!jsonObj.get("downloadURL").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `downloadURL` to be a primitive type in the JSON string but got `%s`", jsonObj.get("downloadURL").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!EdgeFunctions1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'EdgeFunctions1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(EdgeFunctions1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, EdgeFunctions1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public EdgeFunctions1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of EdgeFunctions1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of EdgeFunctions1 - * @throws IOException if the JSON string is invalid with respect to EdgeFunctions1 - */ - public static EdgeFunctions1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, EdgeFunctions1.class); - } - - /** - * Convert an instance of EdgeFunctions1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/EdgeFunctionsAlpha.java b/src/main/java/com/segment/publicapi/models/EdgeFunctionsAlpha.java index 4a14e427..64d8bee1 100644 --- a/src/main/java/com/segment/publicapi/models/EdgeFunctionsAlpha.java +++ b/src/main/java/com/segment/publicapi/models/EdgeFunctionsAlpha.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,376 +9,373 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Represents an Edge Function bundle. - */ -@ApiModel(description = "Represents an Edge Function bundle.") - +/** Represents an Edge Function bundle. */ public class EdgeFunctionsAlpha { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; - - public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; - @SerializedName(SERIALIZED_NAME_CREATED_BY) - private String createdBy; + public static final String SERIALIZED_NAME_ID = "id"; - public static final String SERIALIZED_NAME_DOWNLOAD_U_R_L = "downloadURL"; - @SerializedName(SERIALIZED_NAME_DOWNLOAD_U_R_L) - private String downloadURL; + @SerializedName(SERIALIZED_NAME_ID) + private String id; - public static final String SERIALIZED_NAME_VERSION = "version"; - @SerializedName(SERIALIZED_NAME_VERSION) - private BigDecimal version; + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - public EdgeFunctionsAlpha() { - } + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; - public EdgeFunctionsAlpha id(String id) { - - this.id = id; - return this; - } + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - /** - * The Edge Function id. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Edge Function id.") + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; - public String getId() { - return id; - } + public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; + @SerializedName(SERIALIZED_NAME_CREATED_BY) + private String createdBy; - public void setId(String id) { - this.id = id; - } + public static final String SERIALIZED_NAME_DOWNLOAD_U_R_L = "downloadURL"; + @SerializedName(SERIALIZED_NAME_DOWNLOAD_U_R_L) + private String downloadURL; - public EdgeFunctionsAlpha sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + public static final String SERIALIZED_NAME_VERSION = "version"; - /** - * The Source id. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source id.") + @SerializedName(SERIALIZED_NAME_VERSION) + private BigDecimal version; - public String getSourceId() { - return sourceId; - } + public EdgeFunctionsAlpha() {} + public EdgeFunctionsAlpha id(String id) { - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public EdgeFunctionsAlpha createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } + this.id = id; + return this; + } - /** - * Creation date. - * @return createdAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Creation date.") + /** + * The Edge Function id. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - public String getCreatedAt() { - return createdAt; - } + public void setId(String id) { + this.id = id; + } + public EdgeFunctionsAlpha sourceId(String sourceId) { - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } + this.sourceId = sourceId; + return this; + } + /** + * The Source id. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } - public EdgeFunctionsAlpha createdBy(String createdBy) { - - this.createdBy = createdBy; - return this; - } + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } - /** - * Creating user's id. - * @return createdBy - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Creating user's id.") + public EdgeFunctionsAlpha createdAt(String createdAt) { - public String getCreatedBy() { - return createdBy; - } + this.createdAt = createdAt; + return this; + } + /** + * Creation date. + * + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + public EdgeFunctionsAlpha createdBy(String createdBy) { - public EdgeFunctionsAlpha downloadURL(String downloadURL) { - - this.downloadURL = downloadURL; - return this; - } + this.createdBy = createdBy; + return this; + } - /** - * The CDN URL that can be used to fetch your latest EdgeFunctions bundle. - * @return downloadURL - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The CDN URL that can be used to fetch your latest EdgeFunctions bundle.") + /** + * Creating user's id. + * + * @return createdBy + */ + @javax.annotation.Nonnull + public String getCreatedBy() { + return createdBy; + } - public String getDownloadURL() { - return downloadURL; - } + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + public EdgeFunctionsAlpha downloadURL(String downloadURL) { - public void setDownloadURL(String downloadURL) { - this.downloadURL = downloadURL; - } + this.downloadURL = downloadURL; + return this; + } + /** + * The CDN URL that can be used to fetch your latest EdgeFunctions bundle. + * + * @return downloadURL + */ + @javax.annotation.Nonnull + public String getDownloadURL() { + return downloadURL; + } - public EdgeFunctionsAlpha version(BigDecimal version) { - - this.version = version; - return this; - } + public void setDownloadURL(String downloadURL) { + this.downloadURL = downloadURL; + } - /** - * Revision number associated with the latest Edge Function. - * @return version - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Revision number associated with the latest Edge Function.") + public EdgeFunctionsAlpha version(BigDecimal version) { - public BigDecimal getVersion() { - return version; - } + this.version = version; + return this; + } + /** + * Revision number associated with the latest Edge Function. + * + * @return version + */ + @javax.annotation.Nonnull + public BigDecimal getVersion() { + return version; + } - public void setVersion(BigDecimal version) { - this.version = version; - } + public void setVersion(BigDecimal version) { + this.version = version; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EdgeFunctionsAlpha edgeFunctionsAlpha = (EdgeFunctionsAlpha) o; + return Objects.equals(this.id, edgeFunctionsAlpha.id) + && Objects.equals(this.sourceId, edgeFunctionsAlpha.sourceId) + && Objects.equals(this.createdAt, edgeFunctionsAlpha.createdAt) + && Objects.equals(this.createdBy, edgeFunctionsAlpha.createdBy) + && Objects.equals(this.downloadURL, edgeFunctionsAlpha.downloadURL) + && Objects.equals(this.version, edgeFunctionsAlpha.version); + } + @Override + public int hashCode() { + return Objects.hash(id, sourceId, createdAt, createdBy, downloadURL, version); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EdgeFunctionsAlpha {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" downloadURL: ").append(toIndentedString(downloadURL)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - EdgeFunctionsAlpha edgeFunctionsAlpha = (EdgeFunctionsAlpha) o; - return Objects.equals(this.id, edgeFunctionsAlpha.id) && - Objects.equals(this.sourceId, edgeFunctionsAlpha.sourceId) && - Objects.equals(this.createdAt, edgeFunctionsAlpha.createdAt) && - Objects.equals(this.createdBy, edgeFunctionsAlpha.createdBy) && - Objects.equals(this.downloadURL, edgeFunctionsAlpha.downloadURL) && - Objects.equals(this.version, edgeFunctionsAlpha.version); - } - - @Override - public int hashCode() { - return Objects.hash(id, sourceId, createdAt, createdBy, downloadURL, version); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EdgeFunctionsAlpha {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); - sb.append(" downloadURL: ").append(toIndentedString(downloadURL)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("sourceId"); + openapiFields.add("createdAt"); + openapiFields.add("createdBy"); + openapiFields.add("downloadURL"); + openapiFields.add("version"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("createdBy"); + openapiRequiredFields.add("downloadURL"); + openapiRequiredFields.add("version"); } - return o.toString().replace("\n", "\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("sourceId"); - openapiFields.add("createdAt"); - openapiFields.add("createdBy"); - openapiFields.add("downloadURL"); - openapiFields.add("version"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("createdAt"); - openapiRequiredFields.add("createdBy"); - openapiRequiredFields.add("downloadURL"); - openapiRequiredFields.add("version"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to EdgeFunctionsAlpha - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!EdgeFunctionsAlpha.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in EdgeFunctionsAlpha is not found in the empty JSON string", EdgeFunctionsAlpha.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EdgeFunctionsAlpha + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EdgeFunctionsAlpha.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in EdgeFunctionsAlpha is not found in the" + + " empty JSON string", + EdgeFunctionsAlpha.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!EdgeFunctionsAlpha.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EdgeFunctionsAlpha` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EdgeFunctionsAlpha.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `EdgeFunctionsAlpha` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : EdgeFunctionsAlpha.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EdgeFunctionsAlpha.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdAt").toString())); + } + if (!jsonObj.get("createdBy").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdBy` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdBy").toString())); + } + if (!jsonObj.get("downloadURL").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `downloadURL` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("downloadURL").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EdgeFunctionsAlpha.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EdgeFunctionsAlpha' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(EdgeFunctionsAlpha.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, EdgeFunctionsAlpha value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EdgeFunctionsAlpha read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - if (!jsonObj.get("createdBy").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString())); - } - if (!jsonObj.get("downloadURL").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `downloadURL` to be a primitive type in the JSON string but got `%s`", jsonObj.get("downloadURL").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!EdgeFunctionsAlpha.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'EdgeFunctionsAlpha' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(EdgeFunctionsAlpha.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, EdgeFunctionsAlpha value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public EdgeFunctionsAlpha read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of EdgeFunctionsAlpha given an JSON string - * - * @param jsonString JSON string - * @return An instance of EdgeFunctionsAlpha - * @throws IOException if the JSON string is invalid with respect to EdgeFunctionsAlpha - */ - public static EdgeFunctionsAlpha fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, EdgeFunctionsAlpha.class); - } - - /** - * Convert an instance of EdgeFunctionsAlpha to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of EdgeFunctionsAlpha given an JSON string + * + * @param jsonString JSON string + * @return An instance of EdgeFunctionsAlpha + * @throws IOException if the JSON string is invalid with respect to EdgeFunctionsAlpha + */ + public static EdgeFunctionsAlpha fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EdgeFunctionsAlpha.class); + } + + /** + * Convert an instance of EdgeFunctionsAlpha to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/EntityDetails.java b/src/main/java/com/segment/publicapi/models/EntityDetails.java new file mode 100644 index 00000000..58a8516f --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/EntityDetails.java @@ -0,0 +1,352 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Entity details. */ +public class EntityDetails { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ID_PROPERTY = "idProperty"; + + @SerializedName(SERIALIZED_NAME_ID_PROPERTY) + private String idProperty; + + public static final String SERIALIZED_NAME_RELATIONSHIP_SLUG = "relationshipSlug"; + + @SerializedName(SERIALIZED_NAME_RELATIONSHIP_SLUG) + private String relationshipSlug; + + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private Map properties; + + public static final String SERIALIZED_NAME_ENTITIES = "entities"; + + @SerializedName(SERIALIZED_NAME_ENTITIES) + private Map entities = new HashMap<>(); + + public EntityDetails() {} + + public EntityDetails id(String id) { + + this.id = id; + return this; + } + + /** + * The entity primary key value. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public EntityDetails idProperty(String idProperty) { + + this.idProperty = idProperty; + return this; + } + + /** + * The entity primary key column name. + * + * @return idProperty + */ + @javax.annotation.Nonnull + public String getIdProperty() { + return idProperty; + } + + public void setIdProperty(String idProperty) { + this.idProperty = idProperty; + } + + public EntityDetails relationshipSlug(String relationshipSlug) { + + this.relationshipSlug = relationshipSlug; + return this; + } + + /** + * The entity relationship slug. + * + * @return relationshipSlug + */ + @javax.annotation.Nonnull + public String getRelationshipSlug() { + return relationshipSlug; + } + + public void setRelationshipSlug(String relationshipSlug) { + this.relationshipSlug = relationshipSlug; + } + + public EntityDetails properties(Map properties) { + + this.properties = properties; + return this; + } + + public EntityDetails putPropertiesItem(String key, Object propertiesItem) { + if (this.properties == null) { + this.properties = new HashMap<>(); + } + this.properties.put(key, propertiesItem); + return this; + } + + /** + * Entity properties. + * + * @return properties + */ + @javax.annotation.Nullable + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } + + public EntityDetails entities(Map entities) { + + this.entities = entities; + return this; + } + + public EntityDetails putEntitiesItem(String key, Object entitiesItem) { + if (this.entities == null) { + this.entities = new HashMap<>(); + } + this.entities.put(key, entitiesItem); + return this; + } + + /** + * Related entities that are one level deeper will only be returned if those entities are + * referenced in the audience definition. + * + * @return entities + */ + @javax.annotation.Nullable + public Map getEntities() { + return entities; + } + + public void setEntities(Map entities) { + this.entities = entities; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EntityDetails entityDetails = (EntityDetails) o; + return Objects.equals(this.id, entityDetails.id) + && Objects.equals(this.idProperty, entityDetails.idProperty) + && Objects.equals(this.relationshipSlug, entityDetails.relationshipSlug) + && Objects.equals(this.properties, entityDetails.properties) + && Objects.equals(this.entities, entityDetails.entities); + } + + @Override + public int hashCode() { + return Objects.hash(id, idProperty, relationshipSlug, properties, entities); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EntityDetails {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" idProperty: ").append(toIndentedString(idProperty)).append("\n"); + sb.append(" relationshipSlug: ").append(toIndentedString(relationshipSlug)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" entities: ").append(toIndentedString(entities)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("idProperty"); + openapiFields.add("relationshipSlug"); + openapiFields.add("properties"); + openapiFields.add("entities"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("idProperty"); + openapiRequiredFields.add("relationshipSlug"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EntityDetails + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EntityDetails.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in EntityDetails is not found in the" + + " empty JSON string", + EntityDetails.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EntityDetails.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `EntityDetails` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EntityDetails.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("idProperty").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `idProperty` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("idProperty").toString())); + } + if (!jsonObj.get("relationshipSlug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `relationshipSlug` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("relationshipSlug").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EntityDetails.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EntityDetails' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(EntityDetails.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, EntityDetails value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EntityDetails read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of EntityDetails given an JSON string + * + * @param jsonString JSON string + * @return An instance of EntityDetails + * @throws IOException if the JSON string is invalid with respect to EntityDetails + */ + public static EntityDetails fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EntityDetails.class); + } + + /** + * Convert an instance of EntityDetails to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/EventSourceV1.java b/src/main/java/com/segment/publicapi/models/EventSourceV1.java index 9cdfa2cd..9d9db41e 100644 --- a/src/main/java/com/segment/publicapi/models/EventSourceV1.java +++ b/src/main/java/com/segment/publicapi/models/EventSourceV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,274 +9,270 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Source represents a Segment Source. */ +public class EventSourceV1 { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * Source represents a Segment Source. - */ -@ApiModel(description = "Source represents a Segment Source.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class EventSourceV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; + public static final String SERIALIZED_NAME_SLUG = "slug"; - public EventSourceV1() { - } + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; - public EventSourceV1 id(String id) { - - this.id = id; - return this; - } + public EventSourceV1() {} - /** - * The id of the Source where the events came from. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source where the events came from.") + public EventSourceV1 id(String id) { - public String getId() { - return id; - } + this.id = id; + return this; + } + /** + * The id of the Source where the events came from. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } + public EventSourceV1 name(String name) { - public EventSourceV1 name(String name) { - - this.name = name; - return this; - } + this.name = name; + return this; + } - /** - * The name of the Source, if applicable. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Source, if applicable.") + /** + * The name of the Source, if applicable. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - public String getName() { - return name; - } + public void setName(String name) { + this.name = name; + } + public EventSourceV1 slug(String slug) { - public void setName(String name) { - this.name = name; - } + this.slug = slug; + return this; + } + /** + * The slug of the Source, if applicable. + * + * @return slug + */ + @javax.annotation.Nullable + public String getSlug() { + return slug; + } - public EventSourceV1 slug(String slug) { - - this.slug = slug; - return this; - } + public void setSlug(String slug) { + this.slug = slug; + } - /** - * The slug of the Source, if applicable. - * @return slug - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The slug of the Source, if applicable.") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EventSourceV1 eventSourceV1 = (EventSourceV1) o; + return Objects.equals(this.id, eventSourceV1.id) + && Objects.equals(this.name, eventSourceV1.name) + && Objects.equals(this.slug, eventSourceV1.slug); + } - public String getSlug() { - return slug; - } + @Override + public int hashCode() { + return Objects.hash(id, name, slug); + } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventSourceV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public void setSlug(String slug) { - this.slug = slug; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("name"); + openapiFields.add("slug"); - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EventSourceV1 eventSourceV1 = (EventSourceV1) o; - return Objects.equals(this.id, eventSourceV1.id) && - Objects.equals(this.name, eventSourceV1.name) && - Objects.equals(this.slug, eventSourceV1.slug); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, slug); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EventSourceV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("slug"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to EventSourceV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!EventSourceV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in EventSourceV1 is not found in the empty JSON string", EventSourceV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EventSourceV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventSourceV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in EventSourceV1 is not found in the" + + " empty JSON string", + EventSourceV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!EventSourceV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EventSourceV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EventSourceV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `EventSourceV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : EventSourceV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventSourceV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("slug") != null && !jsonObj.get("slug").isJsonNull()) + && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").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())); - } - 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("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!EventSourceV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'EventSourceV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(EventSourceV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, EventSourceV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public EventSourceV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of EventSourceV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of EventSourceV1 - * @throws IOException if the JSON string is invalid with respect to EventSourceV1 - */ - public static EventSourceV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, EventSourceV1.class); - } - - /** - * Convert an instance of EventSourceV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EventSourceV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventSourceV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(EventSourceV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, EventSourceV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EventSourceV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of EventSourceV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventSourceV1 + * @throws IOException if the JSON string is invalid with respect to EventSourceV1 + */ + public static EventSourceV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventSourceV1.class); + } + + /** + * Convert an instance of EventSourceV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/FQLDefinedPropertyV1.java b/src/main/java/com/segment/publicapi/models/FQLDefinedPropertyV1.java new file mode 100644 index 00000000..909bbdb8 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/FQLDefinedPropertyV1.java @@ -0,0 +1,243 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** FQLDefinedPropertyV1 */ +public class FQLDefinedPropertyV1 { + public static final String SERIALIZED_NAME_FQL = "fql"; + + @SerializedName(SERIALIZED_NAME_FQL) + private String fql; + + public static final String SERIALIZED_NAME_PROPERTY_NAME = "propertyName"; + + @SerializedName(SERIALIZED_NAME_PROPERTY_NAME) + private String propertyName; + + public FQLDefinedPropertyV1() {} + + public FQLDefinedPropertyV1 fql(String fql) { + + this.fql = fql; + return this; + } + + /** + * The FQL expression used to compute the property. + * + * @return fql + */ + @javax.annotation.Nonnull + public String getFql() { + return fql; + } + + public void setFql(String fql) { + this.fql = fql; + } + + public FQLDefinedPropertyV1 propertyName(String propertyName) { + + this.propertyName = propertyName; + return this; + } + + /** + * The new property name. + * + * @return propertyName + */ + @javax.annotation.Nonnull + public String getPropertyName() { + return propertyName; + } + + public void setPropertyName(String propertyName) { + this.propertyName = propertyName; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FQLDefinedPropertyV1 fqLDefinedPropertyV1 = (FQLDefinedPropertyV1) o; + return Objects.equals(this.fql, fqLDefinedPropertyV1.fql) + && Objects.equals(this.propertyName, fqLDefinedPropertyV1.propertyName); + } + + @Override + public int hashCode() { + return Objects.hash(fql, propertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FQLDefinedPropertyV1 {\n"); + sb.append(" fql: ").append(toIndentedString(fql)).append("\n"); + sb.append(" propertyName: ").append(toIndentedString(propertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fql"); + openapiFields.add("propertyName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fql"); + openapiRequiredFields.add("propertyName"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FQLDefinedPropertyV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FQLDefinedPropertyV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in FQLDefinedPropertyV1 is not found in" + + " the empty JSON string", + FQLDefinedPropertyV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FQLDefinedPropertyV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `FQLDefinedPropertyV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FQLDefinedPropertyV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("fql").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fql` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("fql").toString())); + } + if (!jsonObj.get("propertyName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("propertyName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FQLDefinedPropertyV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FQLDefinedPropertyV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(FQLDefinedPropertyV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, FQLDefinedPropertyV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FQLDefinedPropertyV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of FQLDefinedPropertyV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of FQLDefinedPropertyV1 + * @throws IOException if the JSON string is invalid with respect to FQLDefinedPropertyV1 + */ + public static FQLDefinedPropertyV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FQLDefinedPropertyV1.class); + } + + /** + * Convert an instance of FQLDefinedPropertyV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Filter.java b/src/main/java/com/segment/publicapi/models/Filter.java index d40fa789..1f034764 100644 --- a/src/main/java/com/segment/publicapi/models/Filter.java +++ b/src/main/java/com/segment/publicapi/models/Filter.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,516 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DestinationFilterActionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Filter output. */ +public class Filter { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * The filter to preview. - */ -@ApiModel(description = "The filter to preview.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class Filter { - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; - - public static final String SERIALIZED_NAME_ACTIONS = "actions"; - @SerializedName(SERIALIZED_NAME_ACTIONS) - private List actions = new ArrayList<>(); - - public Filter() { - } - - public Filter _if(String _if) { - - this._if = _if; - return this; - } - - /** - * A FQL statement which determines if the provided filter's actions will apply to the provided JSON payload. The literal string \"all\" will result in this filter to all events. For guidance on using FQL, see the Segment documentation site. - * @return _if - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A FQL statement which determines if the provided filter's actions will apply to the provided JSON payload. The literal string \"all\" will result in this filter to all events. For guidance on using FQL, see the Segment documentation site.") - - public String getIf() { - return _if; - } - - - public void setIf(String _if) { - this._if = _if; - } - - - public Filter actions(List actions) { - - this.actions = actions; - return this; - } - - public Filter addActionsItem(DestinationFilterActionV1 actionsItem) { - this.actions.add(actionsItem); - return this; - } - - /** - * The filtering action to take on events that match the \"if\" statement. Action types must be one of: \"drop\", \"allow_properties\", \"drop_properties\" or \"sample\". - * @return actions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The filtering action to take on events that match the \"if\" statement. Action types must be one of: \"drop\", \"allow_properties\", \"drop_properties\" or \"sample\".") - - public List getActions() { - return actions; - } - - - public void setActions(List actions) { - this.actions = actions; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Filter filter = (Filter) o; - return Objects.equals(this._if, filter._if) && - Objects.equals(this.actions, filter.actions); - } - - @Override - public int hashCode() { - return Objects.hash(_if, actions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Filter {\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("if"); - openapiFields.add("actions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("if"); - openapiRequiredFields.add("actions"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Filter - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Filter.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Filter is not found in the empty JSON string", Filter.openapiRequiredFields.toString())); + public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; + + @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) + private String workspaceId; + + public static final String SERIALIZED_NAME_INTEGRATION_ID = "integrationId"; + + @SerializedName(SERIALIZED_NAME_INTEGRATION_ID) + private String integrationId; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_IF = "if"; + + @SerializedName(SERIALIZED_NAME_IF) + private String _if; + + public static final String SERIALIZED_NAME_DROP = "drop"; + + @SerializedName(SERIALIZED_NAME_DROP) + private Boolean drop; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private String updatedAt; + + public Filter() {} + + public Filter id(String id) { + + this.id = id; + return this; + } + + /** + * The newly created filter id. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Filter workspaceId(String workspaceId) { + + this.workspaceId = workspaceId; + return this; + } + + /** + * The Workspace id to create the filter. + * + * @return workspaceId + */ + @javax.annotation.Nonnull + public String getWorkspaceId() { + return workspaceId; + } + + public void setWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + } + + public Filter integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The Integration id of the resource. + * + * @return integrationId + */ + @javax.annotation.Nonnull + public String getIntegrationId() { + return integrationId; + } + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + public Filter enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Whether the filter is enabled. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public Filter name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the filter. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Filter description(String description) { + + this.description = description; + return this; + } + + /** + * The description of the filter. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Filter _if(String _if) { + + this._if = _if; + return this; + } + + /** + * The \"if\" statement for a filter. + * + * @return _if + */ + @javax.annotation.Nullable + public String getIf() { + return _if; + } + + public void setIf(String _if) { + this._if = _if; + } + + public Filter drop(Boolean drop) { + + this.drop = drop; + return this; + } + + /** + * Whether the event is dropped. + * + * @return drop + */ + @javax.annotation.Nullable + public Boolean getDrop() { + return drop; + } + + public void setDrop(Boolean drop) { + this.drop = drop; + } + + public Filter createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp of this filter's creation. + * + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public Filter updatedAt(String updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp of this filter's last change. + * + * @return updatedAt + */ + @javax.annotation.Nonnull + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Filter filter = (Filter) o; + return Objects.equals(this.id, filter.id) + && Objects.equals(this.workspaceId, filter.workspaceId) + && Objects.equals(this.integrationId, filter.integrationId) + && Objects.equals(this.enabled, filter.enabled) + && Objects.equals(this.name, filter.name) + && Objects.equals(this.description, filter.description) + && Objects.equals(this._if, filter._if) + && Objects.equals(this.drop, filter.drop) + && Objects.equals(this.createdAt, filter.createdAt) + && Objects.equals(this.updatedAt, filter.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + workspaceId, + integrationId, + enabled, + name, + description, + _if, + drop, + createdAt, + updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Filter {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" drop: ").append(toIndentedString(drop)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).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 "); + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Filter.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Filter` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + 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("workspaceId"); + openapiFields.add("integrationId"); + openapiFields.add("enabled"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("if"); + openapiFields.add("drop"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("workspaceId"); + openapiRequiredFields.add("integrationId"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Filter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Filter.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Filter is not found in the empty JSON" + + " string", + Filter.openapiRequiredFields.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Filter.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Filter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `Filter`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - if (!jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("actions").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `actions` to be an array in the JSON string but got `%s`", jsonObj.get("actions").toString())); - } - - JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Filter.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Filter' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Filter.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Filter value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Filter read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Filter given an JSON string - * - * @param jsonString JSON string - * @return An instance of Filter - * @throws IOException if the JSON string is invalid with respect to Filter - */ - public static Filter fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Filter.class); - } - - /** - * Convert an instance of Filter to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Filter.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("workspaceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `workspaceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("workspaceId").toString())); + } + if (!jsonObj.get("integrationId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `integrationId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("integrationId").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("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("if") != null && !jsonObj.get("if").isJsonNull()) + && !jsonObj.get("if").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `if` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("if").toString())); + } + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdAt").toString())); + } + if (!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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Filter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Filter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Filter.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Filter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Filter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of Filter given an JSON string + * + * @param jsonString JSON string + * @return An instance of Filter + * @throws IOException if the JSON string is invalid with respect to Filter + */ + public static Filter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Filter.class); + } + + /** + * Convert an instance of Filter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Filter1.java b/src/main/java/com/segment/publicapi/models/Filter1.java deleted file mode 100644 index 304395fb..00000000 --- a/src/main/java/com/segment/publicapi/models/Filter1.java +++ /dev/null @@ -1,530 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DestinationFilterActionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The requested Destination filter. - */ -@ApiModel(description = "The requested Destination filter.") - -public class Filter1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_DESTINATION_ID = "destinationId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_ID) - private String destinationId; - - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; - - public static final String SERIALIZED_NAME_ACTIONS = "actions"; - @SerializedName(SERIALIZED_NAME_ACTIONS) - private List actions = new ArrayList<>(); - - public static final String SERIALIZED_NAME_TITLE = "title"; - @SerializedName(SERIALIZED_NAME_TITLE) - private String title; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; - - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private String updatedAt; - - public Filter1() { - } - - public Filter1 id(String id) { - - this.id = id; - return this; - } - - /** - * The unique id of this filter. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique id of this filter.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Filter1 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } - - /** - * The id of the Source associated with this filter. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source associated with this filter.") - - public String getSourceId() { - return sourceId; - } - - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public Filter1 destinationId(String destinationId) { - - this.destinationId = destinationId; - return this; - } - - /** - * The id of the Destination associated with this filter. - * @return destinationId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Destination associated with this filter.") - - public String getDestinationId() { - return destinationId; - } - - - public void setDestinationId(String destinationId) { - this.destinationId = destinationId; - } - - - public Filter1 _if(String _if) { - - this._if = _if; - return this; - } - - /** - * A condition that defines whether to apply this filter to a payload. - * @return _if - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A condition that defines whether to apply this filter to a payload.") - - public String getIf() { - return _if; - } - - - public void setIf(String _if) { - this._if = _if; - } - - - public Filter1 actions(List actions) { - - this.actions = actions; - return this; - } - - public Filter1 addActionsItem(DestinationFilterActionV1 actionsItem) { - this.actions.add(actionsItem); - return this; - } - - /** - * A list of actions this filter performs. - * @return actions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of actions this filter performs.") - - public List getActions() { - return actions; - } - - - public void setActions(List actions) { - this.actions = actions; - } - - - public Filter1 title(String title) { - - this.title = title; - return this; - } - - /** - * A title for this filter. - * @return title - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A title for this filter.") - - public String getTitle() { - return title; - } - - - public void setTitle(String title) { - this.title = title; - } - - - public Filter1 description(String description) { - - this.description = description; - return this; - } - - /** - * A description for this filter. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A description for this filter.") - - public String getDescription() { - return description; - } - - - public void setDescription(String description) { - this.description = description; - } - - - public Filter1 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * When set to true, this filter is active. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "When set to true, this filter is active.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Filter1 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } - - /** - * The timestamp of this filter's creation. - * @return createdAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The timestamp of this filter's creation.") - - public String getCreatedAt() { - return createdAt; - } - - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - - public Filter1 updatedAt(String updatedAt) { - - this.updatedAt = updatedAt; - return this; - } - - /** - * The timestamp of this filter's last change. - * @return updatedAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The timestamp of this filter's last change.") - - public String getUpdatedAt() { - return updatedAt; - } - - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Filter1 filter1 = (Filter1) o; - return Objects.equals(this.id, filter1.id) && - Objects.equals(this.sourceId, filter1.sourceId) && - Objects.equals(this.destinationId, filter1.destinationId) && - Objects.equals(this._if, filter1._if) && - Objects.equals(this.actions, filter1.actions) && - Objects.equals(this.title, filter1.title) && - Objects.equals(this.description, filter1.description) && - Objects.equals(this.enabled, filter1.enabled) && - Objects.equals(this.createdAt, filter1.createdAt) && - Objects.equals(this.updatedAt, filter1.updatedAt); - } - - @Override - public int hashCode() { - return Objects.hash(id, sourceId, destinationId, _if, actions, title, description, enabled, createdAt, updatedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Filter1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" destinationId: ").append(toIndentedString(destinationId)).append("\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); - sb.append(" title: ").append(toIndentedString(title)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).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("id"); - openapiFields.add("sourceId"); - openapiFields.add("destinationId"); - openapiFields.add("if"); - openapiFields.add("actions"); - openapiFields.add("title"); - openapiFields.add("description"); - openapiFields.add("enabled"); - openapiFields.add("createdAt"); - openapiFields.add("updatedAt"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("destinationId"); - openapiRequiredFields.add("if"); - openapiRequiredFields.add("actions"); - openapiRequiredFields.add("title"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("createdAt"); - openapiRequiredFields.add("updatedAt"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Filter1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Filter1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Filter1 is not found in the empty JSON string", Filter1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Filter1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Filter1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Filter1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("destinationId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationId").toString())); - } - if (!jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("actions").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `actions` to be an array in the JSON string but got `%s`", jsonObj.get("actions").toString())); - } - - JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); - if (!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("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("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - if (!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())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Filter1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Filter1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Filter1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Filter1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Filter1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Filter1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Filter1 - * @throws IOException if the JSON string is invalid with respect to Filter1 - */ - public static Filter1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Filter1.class); - } - - /** - * Convert an instance of Filter1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Filter2.java b/src/main/java/com/segment/publicapi/models/Filter2.java deleted file mode 100644 index 1bc7325e..00000000 --- a/src/main/java/com/segment/publicapi/models/Filter2.java +++ /dev/null @@ -1,530 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DestinationFilterActionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The newly created Destination filter. - */ -@ApiModel(description = "The newly created Destination filter.") - -public class Filter2 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_DESTINATION_ID = "destinationId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_ID) - private String destinationId; - - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; - - public static final String SERIALIZED_NAME_ACTIONS = "actions"; - @SerializedName(SERIALIZED_NAME_ACTIONS) - private List actions = new ArrayList<>(); - - public static final String SERIALIZED_NAME_TITLE = "title"; - @SerializedName(SERIALIZED_NAME_TITLE) - private String title; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; - - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private String updatedAt; - - public Filter2() { - } - - public Filter2 id(String id) { - - this.id = id; - return this; - } - - /** - * The unique id of this filter. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique id of this filter.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Filter2 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } - - /** - * The id of the Source associated with this filter. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source associated with this filter.") - - public String getSourceId() { - return sourceId; - } - - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public Filter2 destinationId(String destinationId) { - - this.destinationId = destinationId; - return this; - } - - /** - * The id of the Destination associated with this filter. - * @return destinationId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Destination associated with this filter.") - - public String getDestinationId() { - return destinationId; - } - - - public void setDestinationId(String destinationId) { - this.destinationId = destinationId; - } - - - public Filter2 _if(String _if) { - - this._if = _if; - return this; - } - - /** - * A condition that defines whether to apply this filter to a payload. - * @return _if - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A condition that defines whether to apply this filter to a payload.") - - public String getIf() { - return _if; - } - - - public void setIf(String _if) { - this._if = _if; - } - - - public Filter2 actions(List actions) { - - this.actions = actions; - return this; - } - - public Filter2 addActionsItem(DestinationFilterActionV1 actionsItem) { - this.actions.add(actionsItem); - return this; - } - - /** - * A list of actions this filter performs. - * @return actions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of actions this filter performs.") - - public List getActions() { - return actions; - } - - - public void setActions(List actions) { - this.actions = actions; - } - - - public Filter2 title(String title) { - - this.title = title; - return this; - } - - /** - * A title for this filter. - * @return title - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A title for this filter.") - - public String getTitle() { - return title; - } - - - public void setTitle(String title) { - this.title = title; - } - - - public Filter2 description(String description) { - - this.description = description; - return this; - } - - /** - * A description for this filter. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A description for this filter.") - - public String getDescription() { - return description; - } - - - public void setDescription(String description) { - this.description = description; - } - - - public Filter2 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * When set to true, this filter is active. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "When set to true, this filter is active.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Filter2 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } - - /** - * The timestamp of this filter's creation. - * @return createdAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The timestamp of this filter's creation.") - - public String getCreatedAt() { - return createdAt; - } - - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - - public Filter2 updatedAt(String updatedAt) { - - this.updatedAt = updatedAt; - return this; - } - - /** - * The timestamp of this filter's last change. - * @return updatedAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The timestamp of this filter's last change.") - - public String getUpdatedAt() { - return updatedAt; - } - - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Filter2 filter2 = (Filter2) o; - return Objects.equals(this.id, filter2.id) && - Objects.equals(this.sourceId, filter2.sourceId) && - Objects.equals(this.destinationId, filter2.destinationId) && - Objects.equals(this._if, filter2._if) && - Objects.equals(this.actions, filter2.actions) && - Objects.equals(this.title, filter2.title) && - Objects.equals(this.description, filter2.description) && - Objects.equals(this.enabled, filter2.enabled) && - Objects.equals(this.createdAt, filter2.createdAt) && - Objects.equals(this.updatedAt, filter2.updatedAt); - } - - @Override - public int hashCode() { - return Objects.hash(id, sourceId, destinationId, _if, actions, title, description, enabled, createdAt, updatedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Filter2 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" destinationId: ").append(toIndentedString(destinationId)).append("\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); - sb.append(" title: ").append(toIndentedString(title)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).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("id"); - openapiFields.add("sourceId"); - openapiFields.add("destinationId"); - openapiFields.add("if"); - openapiFields.add("actions"); - openapiFields.add("title"); - openapiFields.add("description"); - openapiFields.add("enabled"); - openapiFields.add("createdAt"); - openapiFields.add("updatedAt"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("destinationId"); - openapiRequiredFields.add("if"); - openapiRequiredFields.add("actions"); - openapiRequiredFields.add("title"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("createdAt"); - openapiRequiredFields.add("updatedAt"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Filter2 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Filter2.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Filter2 is not found in the empty JSON string", Filter2.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Filter2.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Filter2` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Filter2.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("destinationId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationId").toString())); - } - if (!jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("actions").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `actions` to be an array in the JSON string but got `%s`", jsonObj.get("actions").toString())); - } - - JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); - if (!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("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("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - if (!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())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Filter2.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Filter2' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Filter2.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Filter2 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Filter2 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Filter2 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Filter2 - * @throws IOException if the JSON string is invalid with respect to Filter2 - */ - public static Filter2 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Filter2.class); - } - - /** - * Convert an instance of Filter2 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Filter3.java b/src/main/java/com/segment/publicapi/models/Filter3.java deleted file mode 100644 index eb7930e3..00000000 --- a/src/main/java/com/segment/publicapi/models/Filter3.java +++ /dev/null @@ -1,530 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DestinationFilterActionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The updated Destination filter. - */ -@ApiModel(description = "The updated Destination filter.") - -public class Filter3 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_DESTINATION_ID = "destinationId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_ID) - private String destinationId; - - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; - - public static final String SERIALIZED_NAME_ACTIONS = "actions"; - @SerializedName(SERIALIZED_NAME_ACTIONS) - private List actions = new ArrayList<>(); - - public static final String SERIALIZED_NAME_TITLE = "title"; - @SerializedName(SERIALIZED_NAME_TITLE) - private String title; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; - - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private String updatedAt; - - public Filter3() { - } - - public Filter3 id(String id) { - - this.id = id; - return this; - } - - /** - * The unique id of this filter. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique id of this filter.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Filter3 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } - - /** - * The id of the Source associated with this filter. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source associated with this filter.") - - public String getSourceId() { - return sourceId; - } - - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public Filter3 destinationId(String destinationId) { - - this.destinationId = destinationId; - return this; - } - - /** - * The id of the Destination associated with this filter. - * @return destinationId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Destination associated with this filter.") - - public String getDestinationId() { - return destinationId; - } - - - public void setDestinationId(String destinationId) { - this.destinationId = destinationId; - } - - - public Filter3 _if(String _if) { - - this._if = _if; - return this; - } - - /** - * A condition that defines whether to apply this filter to a payload. - * @return _if - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A condition that defines whether to apply this filter to a payload.") - - public String getIf() { - return _if; - } - - - public void setIf(String _if) { - this._if = _if; - } - - - public Filter3 actions(List actions) { - - this.actions = actions; - return this; - } - - public Filter3 addActionsItem(DestinationFilterActionV1 actionsItem) { - this.actions.add(actionsItem); - return this; - } - - /** - * A list of actions this filter performs. - * @return actions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of actions this filter performs.") - - public List getActions() { - return actions; - } - - - public void setActions(List actions) { - this.actions = actions; - } - - - public Filter3 title(String title) { - - this.title = title; - return this; - } - - /** - * A title for this filter. - * @return title - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A title for this filter.") - - public String getTitle() { - return title; - } - - - public void setTitle(String title) { - this.title = title; - } - - - public Filter3 description(String description) { - - this.description = description; - return this; - } - - /** - * A description for this filter. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A description for this filter.") - - public String getDescription() { - return description; - } - - - public void setDescription(String description) { - this.description = description; - } - - - public Filter3 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * When set to true, this filter is active. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "When set to true, this filter is active.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Filter3 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } - - /** - * The timestamp of this filter's creation. - * @return createdAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The timestamp of this filter's creation.") - - public String getCreatedAt() { - return createdAt; - } - - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - - public Filter3 updatedAt(String updatedAt) { - - this.updatedAt = updatedAt; - return this; - } - - /** - * The timestamp of this filter's last change. - * @return updatedAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The timestamp of this filter's last change.") - - public String getUpdatedAt() { - return updatedAt; - } - - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Filter3 filter3 = (Filter3) o; - return Objects.equals(this.id, filter3.id) && - Objects.equals(this.sourceId, filter3.sourceId) && - Objects.equals(this.destinationId, filter3.destinationId) && - Objects.equals(this._if, filter3._if) && - Objects.equals(this.actions, filter3.actions) && - Objects.equals(this.title, filter3.title) && - Objects.equals(this.description, filter3.description) && - Objects.equals(this.enabled, filter3.enabled) && - Objects.equals(this.createdAt, filter3.createdAt) && - Objects.equals(this.updatedAt, filter3.updatedAt); - } - - @Override - public int hashCode() { - return Objects.hash(id, sourceId, destinationId, _if, actions, title, description, enabled, createdAt, updatedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Filter3 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" destinationId: ").append(toIndentedString(destinationId)).append("\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); - sb.append(" title: ").append(toIndentedString(title)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).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("id"); - openapiFields.add("sourceId"); - openapiFields.add("destinationId"); - openapiFields.add("if"); - openapiFields.add("actions"); - openapiFields.add("title"); - openapiFields.add("description"); - openapiFields.add("enabled"); - openapiFields.add("createdAt"); - openapiFields.add("updatedAt"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("destinationId"); - openapiRequiredFields.add("if"); - openapiRequiredFields.add("actions"); - openapiRequiredFields.add("title"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("createdAt"); - openapiRequiredFields.add("updatedAt"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Filter3 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Filter3.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Filter3 is not found in the empty JSON string", Filter3.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Filter3.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Filter3` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Filter3.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("destinationId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationId").toString())); - } - if (!jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("actions").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `actions` to be an array in the JSON string but got `%s`", jsonObj.get("actions").toString())); - } - - JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); - if (!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("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("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - if (!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())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Filter3.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Filter3' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Filter3.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Filter3 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Filter3 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Filter3 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Filter3 - * @throws IOException if the JSON string is invalid with respect to Filter3 - */ - public static Filter3 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Filter3.class); - } - - /** - * Convert an instance of Filter3 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Function.java b/src/main/java/com/segment/publicapi/models/Function.java deleted file mode 100644 index e4ff434a..00000000 --- a/src/main/java/com/segment/publicapi/models/Function.java +++ /dev/null @@ -1,709 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.FunctionSettingV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * A Function object. - */ -@ApiModel(description = "A Function object.") - -public class Function { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - /** - * The Function type. Config API note: equal to `type`. - */ - @JsonAdapter(ResourceTypeEnum.Adapter.class) - public enum ResourceTypeEnum { - DESTINATION("DESTINATION"), - - SOURCE("SOURCE"); - - private String value; - - ResourceTypeEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ResourceTypeEnum fromValue(String value) { - for (ResourceTypeEnum b : ResourceTypeEnum.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 ResourceTypeEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ResourceTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return ResourceTypeEnum.fromValue(value); - } - } - } - - public static final String SERIALIZED_NAME_RESOURCE_TYPE = "resourceType"; - @SerializedName(SERIALIZED_NAME_RESOURCE_TYPE) - private ResourceTypeEnum resourceType; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; - - public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; - @SerializedName(SERIALIZED_NAME_CREATED_BY) - private String createdBy; - - public static final String SERIALIZED_NAME_CODE = "code"; - @SerializedName(SERIALIZED_NAME_CODE) - private String code; - - public static final String SERIALIZED_NAME_DEPLOYED_AT = "deployedAt"; - @SerializedName(SERIALIZED_NAME_DEPLOYED_AT) - private String deployedAt; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private List settings = null; - - public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; - @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) - private String displayName; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_LOGO_URL = "logoUrl"; - @SerializedName(SERIALIZED_NAME_LOGO_URL) - private String logoUrl; - - public static final String SERIALIZED_NAME_PREVIEW_WEBHOOK_URL = "previewWebhookUrl"; - @SerializedName(SERIALIZED_NAME_PREVIEW_WEBHOOK_URL) - private String previewWebhookUrl; - - public static final String SERIALIZED_NAME_BATCH_MAX_COUNT = "batchMaxCount"; - @SerializedName(SERIALIZED_NAME_BATCH_MAX_COUNT) - private BigDecimal batchMaxCount; - - public static final String SERIALIZED_NAME_CATALOG_ID = "catalogId"; - @SerializedName(SERIALIZED_NAME_CATALOG_ID) - private String catalogId; - - public static final String SERIALIZED_NAME_IS_LATEST_VERSION = "isLatestVersion"; - @SerializedName(SERIALIZED_NAME_IS_LATEST_VERSION) - private Boolean isLatestVersion; - - public Function() { - } - - public Function id(String id) { - - this.id = id; - return this; - } - - /** - * An identifier for this Function. - * @return id - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An identifier for this Function.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Function resourceType(ResourceTypeEnum resourceType) { - - this.resourceType = resourceType; - return this; - } - - /** - * The Function type. Config API note: equal to `type`. - * @return resourceType - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Function type. Config API note: equal to `type`.") - - public ResourceTypeEnum getResourceType() { - return resourceType; - } - - - public void setResourceType(ResourceTypeEnum resourceType) { - this.resourceType = resourceType; - } - - - public Function createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } - - /** - * The time this Function was created. - * @return createdAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The time this Function was created.") - - public String getCreatedAt() { - return createdAt; - } - - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - - public Function createdBy(String createdBy) { - - this.createdBy = createdBy; - return this; - } - - /** - * The id of the user who created this Function. - * @return createdBy - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the user who created this Function.") - - public String getCreatedBy() { - return createdBy; - } - - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - - public Function code(String code) { - - this.code = code; - return this; - } - - /** - * The Function code. - * @return code - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Function code.") - - public String getCode() { - return code; - } - - - public void setCode(String code) { - this.code = code; - } - - - public Function deployedAt(String deployedAt) { - - this.deployedAt = deployedAt; - return this; - } - - /** - * The time of this Function's last deployment. - * @return deployedAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The time of this Function's last deployment.") - - public String getDeployedAt() { - return deployedAt; - } - - - public void setDeployedAt(String deployedAt) { - this.deployedAt = deployedAt; - } - - - public Function settings(List settings) { - - this.settings = settings; - return this; - } - - public Function addSettingsItem(FunctionSettingV1 settingsItem) { - if (this.settings == null) { - this.settings = new ArrayList<>(); - } - this.settings.add(settingsItem); - return this; - } - - /** - * The list of settings for this Function. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The list of settings for this Function.") - - public List getSettings() { - return settings; - } - - - public void setSettings(List settings) { - this.settings = settings; - } - - - public Function displayName(String displayName) { - - this.displayName = displayName; - return this; - } - - /** - * A display name for this Function. - * @return displayName - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A display name for this Function.") - - public String getDisplayName() { - return displayName; - } - - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - - public Function description(String description) { - - this.description = description; - return this; - } - - /** - * A description for this Function. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A description for this Function.") - - public String getDescription() { - return description; - } - - - public void setDescription(String description) { - this.description = description; - } - - - public Function logoUrl(String logoUrl) { - - this.logoUrl = logoUrl; - return this; - } - - /** - * The URL of the logo for this Function. - * @return logoUrl - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The URL of the logo for this Function.") - - public String getLogoUrl() { - return logoUrl; - } - - - public void setLogoUrl(String logoUrl) { - this.logoUrl = logoUrl; - } - - - public Function previewWebhookUrl(String previewWebhookUrl) { - - this.previewWebhookUrl = previewWebhookUrl; - return this; - } - - /** - * The preview webhook URL for this Function. - * @return previewWebhookUrl - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The preview webhook URL for this Function.") - - public String getPreviewWebhookUrl() { - return previewWebhookUrl; - } - - - public void setPreviewWebhookUrl(String previewWebhookUrl) { - this.previewWebhookUrl = previewWebhookUrl; - } - - - public Function batchMaxCount(BigDecimal batchMaxCount) { - - this.batchMaxCount = batchMaxCount; - return this; - } - - /** - * The max count of the batch for this Function. - * @return batchMaxCount - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The max count of the batch for this Function.") - - public BigDecimal getBatchMaxCount() { - return batchMaxCount; - } - - - public void setBatchMaxCount(BigDecimal batchMaxCount) { - this.batchMaxCount = batchMaxCount; - } - - - public Function catalogId(String catalogId) { - - this.catalogId = catalogId; - return this; - } - - /** - * The catalog id of this Function. - * @return catalogId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The catalog id of this Function.") - - public String getCatalogId() { - return catalogId; - } - - - public void setCatalogId(String catalogId) { - this.catalogId = catalogId; - } - - - public Function isLatestVersion(Boolean isLatestVersion) { - - this.isLatestVersion = isLatestVersion; - return this; - } - - /** - * Whether the deployment of this Function is the latest version. - * @return isLatestVersion - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether the deployment of this Function is the latest version.") - - public Boolean getIsLatestVersion() { - return isLatestVersion; - } - - - public void setIsLatestVersion(Boolean isLatestVersion) { - this.isLatestVersion = isLatestVersion; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Function function = (Function) o; - return Objects.equals(this.id, function.id) && - Objects.equals(this.resourceType, function.resourceType) && - Objects.equals(this.createdAt, function.createdAt) && - Objects.equals(this.createdBy, function.createdBy) && - Objects.equals(this.code, function.code) && - Objects.equals(this.deployedAt, function.deployedAt) && - Objects.equals(this.settings, function.settings) && - Objects.equals(this.displayName, function.displayName) && - Objects.equals(this.description, function.description) && - Objects.equals(this.logoUrl, function.logoUrl) && - Objects.equals(this.previewWebhookUrl, function.previewWebhookUrl) && - Objects.equals(this.batchMaxCount, function.batchMaxCount) && - Objects.equals(this.catalogId, function.catalogId) && - Objects.equals(this.isLatestVersion, function.isLatestVersion); - } - - 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(id, resourceType, createdAt, createdBy, code, deployedAt, settings, displayName, description, logoUrl, previewWebhookUrl, batchMaxCount, catalogId, isLatestVersion); - } - - 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 Function {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" deployedAt: ").append(toIndentedString(deployedAt)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" logoUrl: ").append(toIndentedString(logoUrl)).append("\n"); - sb.append(" previewWebhookUrl: ").append(toIndentedString(previewWebhookUrl)).append("\n"); - sb.append(" batchMaxCount: ").append(toIndentedString(batchMaxCount)).append("\n"); - sb.append(" catalogId: ").append(toIndentedString(catalogId)).append("\n"); - sb.append(" isLatestVersion: ").append(toIndentedString(isLatestVersion)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("resourceType"); - openapiFields.add("createdAt"); - openapiFields.add("createdBy"); - openapiFields.add("code"); - openapiFields.add("deployedAt"); - openapiFields.add("settings"); - openapiFields.add("displayName"); - openapiFields.add("description"); - openapiFields.add("logoUrl"); - openapiFields.add("previewWebhookUrl"); - openapiFields.add("batchMaxCount"); - openapiFields.add("catalogId"); - openapiFields.add("isLatestVersion"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Function - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Function.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Function is not found in the empty JSON string", Function.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Function.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Function` properties. JSON: %s", entry.getKey(), jsonObj.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())); - } - if ((jsonObj.get("resourceType") != null && !jsonObj.get("resourceType").isJsonNull()) && !jsonObj.get("resourceType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `resourceType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resourceType").toString())); - } - if ((jsonObj.get("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) && !jsonObj.get("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - if ((jsonObj.get("createdBy") != null && !jsonObj.get("createdBy").isJsonNull()) && !jsonObj.get("createdBy").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString())); - } - if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); - } - if ((jsonObj.get("deployedAt") != null && !jsonObj.get("deployedAt").isJsonNull()) && !jsonObj.get("deployedAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `deployedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deployedAt").toString())); - } - if (jsonObj.get("settings") != null && !jsonObj.get("settings").isJsonNull()) { - JsonArray jsonArraysettings = jsonObj.getAsJsonArray("settings"); - if (jsonArraysettings != null) { - // ensure the json data is an array - if (!jsonObj.get("settings").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `settings` to be an array in the JSON string but got `%s`", jsonObj.get("settings").toString())); - } - } - } - if ((jsonObj.get("displayName") != null && !jsonObj.get("displayName").isJsonNull()) && !jsonObj.get("displayName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayName").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("logoUrl") != null && !jsonObj.get("logoUrl").isJsonNull()) && !jsonObj.get("logoUrl").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `logoUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("logoUrl").toString())); - } - if ((jsonObj.get("previewWebhookUrl") != null && !jsonObj.get("previewWebhookUrl").isJsonNull()) && !jsonObj.get("previewWebhookUrl").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `previewWebhookUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("previewWebhookUrl").toString())); - } - if ((jsonObj.get("catalogId") != null && !jsonObj.get("catalogId").isJsonNull()) && !jsonObj.get("catalogId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `catalogId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("catalogId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Function.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Function' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Function.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Function value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Function read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Function given an JSON string - * - * @param jsonString JSON string - * @return An instance of Function - * @throws IOException if the JSON string is invalid with respect to Function - */ - public static Function fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Function.class); - } - - /** - * Convert an instance of Function to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Function1.java b/src/main/java/com/segment/publicapi/models/Function1.java deleted file mode 100644 index a351abf5..00000000 --- a/src/main/java/com/segment/publicapi/models/Function1.java +++ /dev/null @@ -1,709 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.FunctionSettingV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * A Function object. - */ -@ApiModel(description = "A Function object.") - -public class Function1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - /** - * The Function type. Config API note: equal to `type`. - */ - @JsonAdapter(ResourceTypeEnum.Adapter.class) - public enum ResourceTypeEnum { - DESTINATION("DESTINATION"), - - SOURCE("SOURCE"); - - private String value; - - ResourceTypeEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ResourceTypeEnum fromValue(String value) { - for (ResourceTypeEnum b : ResourceTypeEnum.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 ResourceTypeEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ResourceTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return ResourceTypeEnum.fromValue(value); - } - } - } - - public static final String SERIALIZED_NAME_RESOURCE_TYPE = "resourceType"; - @SerializedName(SERIALIZED_NAME_RESOURCE_TYPE) - private ResourceTypeEnum resourceType; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; - - public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; - @SerializedName(SERIALIZED_NAME_CREATED_BY) - private String createdBy; - - public static final String SERIALIZED_NAME_CODE = "code"; - @SerializedName(SERIALIZED_NAME_CODE) - private String code; - - public static final String SERIALIZED_NAME_DEPLOYED_AT = "deployedAt"; - @SerializedName(SERIALIZED_NAME_DEPLOYED_AT) - private String deployedAt; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private List settings = null; - - public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; - @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) - private String displayName; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_LOGO_URL = "logoUrl"; - @SerializedName(SERIALIZED_NAME_LOGO_URL) - private String logoUrl; - - public static final String SERIALIZED_NAME_PREVIEW_WEBHOOK_URL = "previewWebhookUrl"; - @SerializedName(SERIALIZED_NAME_PREVIEW_WEBHOOK_URL) - private String previewWebhookUrl; - - public static final String SERIALIZED_NAME_BATCH_MAX_COUNT = "batchMaxCount"; - @SerializedName(SERIALIZED_NAME_BATCH_MAX_COUNT) - private BigDecimal batchMaxCount; - - public static final String SERIALIZED_NAME_CATALOG_ID = "catalogId"; - @SerializedName(SERIALIZED_NAME_CATALOG_ID) - private String catalogId; - - public static final String SERIALIZED_NAME_IS_LATEST_VERSION = "isLatestVersion"; - @SerializedName(SERIALIZED_NAME_IS_LATEST_VERSION) - private Boolean isLatestVersion; - - public Function1() { - } - - public Function1 id(String id) { - - this.id = id; - return this; - } - - /** - * An identifier for this Function. - * @return id - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An identifier for this Function.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Function1 resourceType(ResourceTypeEnum resourceType) { - - this.resourceType = resourceType; - return this; - } - - /** - * The Function type. Config API note: equal to `type`. - * @return resourceType - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Function type. Config API note: equal to `type`.") - - public ResourceTypeEnum getResourceType() { - return resourceType; - } - - - public void setResourceType(ResourceTypeEnum resourceType) { - this.resourceType = resourceType; - } - - - public Function1 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } - - /** - * The time this Function was created. - * @return createdAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The time this Function was created.") - - public String getCreatedAt() { - return createdAt; - } - - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - - public Function1 createdBy(String createdBy) { - - this.createdBy = createdBy; - return this; - } - - /** - * The id of the user who created this Function. - * @return createdBy - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the user who created this Function.") - - public String getCreatedBy() { - return createdBy; - } - - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - - public Function1 code(String code) { - - this.code = code; - return this; - } - - /** - * The Function code. - * @return code - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Function code.") - - public String getCode() { - return code; - } - - - public void setCode(String code) { - this.code = code; - } - - - public Function1 deployedAt(String deployedAt) { - - this.deployedAt = deployedAt; - return this; - } - - /** - * The time of this Function's last deployment. - * @return deployedAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The time of this Function's last deployment.") - - public String getDeployedAt() { - return deployedAt; - } - - - public void setDeployedAt(String deployedAt) { - this.deployedAt = deployedAt; - } - - - public Function1 settings(List settings) { - - this.settings = settings; - return this; - } - - public Function1 addSettingsItem(FunctionSettingV1 settingsItem) { - if (this.settings == null) { - this.settings = new ArrayList<>(); - } - this.settings.add(settingsItem); - return this; - } - - /** - * The list of settings for this Function. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The list of settings for this Function.") - - public List getSettings() { - return settings; - } - - - public void setSettings(List settings) { - this.settings = settings; - } - - - public Function1 displayName(String displayName) { - - this.displayName = displayName; - return this; - } - - /** - * A display name for this Function. - * @return displayName - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A display name for this Function.") - - public String getDisplayName() { - return displayName; - } - - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - - public Function1 description(String description) { - - this.description = description; - return this; - } - - /** - * A description for this Function. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A description for this Function.") - - public String getDescription() { - return description; - } - - - public void setDescription(String description) { - this.description = description; - } - - - public Function1 logoUrl(String logoUrl) { - - this.logoUrl = logoUrl; - return this; - } - - /** - * The URL of the logo for this Function. - * @return logoUrl - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The URL of the logo for this Function.") - - public String getLogoUrl() { - return logoUrl; - } - - - public void setLogoUrl(String logoUrl) { - this.logoUrl = logoUrl; - } - - - public Function1 previewWebhookUrl(String previewWebhookUrl) { - - this.previewWebhookUrl = previewWebhookUrl; - return this; - } - - /** - * The preview webhook URL for this Function. - * @return previewWebhookUrl - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The preview webhook URL for this Function.") - - public String getPreviewWebhookUrl() { - return previewWebhookUrl; - } - - - public void setPreviewWebhookUrl(String previewWebhookUrl) { - this.previewWebhookUrl = previewWebhookUrl; - } - - - public Function1 batchMaxCount(BigDecimal batchMaxCount) { - - this.batchMaxCount = batchMaxCount; - return this; - } - - /** - * The max count of the batch for this Function. - * @return batchMaxCount - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The max count of the batch for this Function.") - - public BigDecimal getBatchMaxCount() { - return batchMaxCount; - } - - - public void setBatchMaxCount(BigDecimal batchMaxCount) { - this.batchMaxCount = batchMaxCount; - } - - - public Function1 catalogId(String catalogId) { - - this.catalogId = catalogId; - return this; - } - - /** - * The catalog id of this Function. - * @return catalogId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The catalog id of this Function.") - - public String getCatalogId() { - return catalogId; - } - - - public void setCatalogId(String catalogId) { - this.catalogId = catalogId; - } - - - public Function1 isLatestVersion(Boolean isLatestVersion) { - - this.isLatestVersion = isLatestVersion; - return this; - } - - /** - * Whether the deployment of this Function is the latest version. - * @return isLatestVersion - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether the deployment of this Function is the latest version.") - - public Boolean getIsLatestVersion() { - return isLatestVersion; - } - - - public void setIsLatestVersion(Boolean isLatestVersion) { - this.isLatestVersion = isLatestVersion; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Function1 function1 = (Function1) o; - return Objects.equals(this.id, function1.id) && - Objects.equals(this.resourceType, function1.resourceType) && - Objects.equals(this.createdAt, function1.createdAt) && - Objects.equals(this.createdBy, function1.createdBy) && - Objects.equals(this.code, function1.code) && - Objects.equals(this.deployedAt, function1.deployedAt) && - Objects.equals(this.settings, function1.settings) && - Objects.equals(this.displayName, function1.displayName) && - Objects.equals(this.description, function1.description) && - Objects.equals(this.logoUrl, function1.logoUrl) && - Objects.equals(this.previewWebhookUrl, function1.previewWebhookUrl) && - Objects.equals(this.batchMaxCount, function1.batchMaxCount) && - Objects.equals(this.catalogId, function1.catalogId) && - Objects.equals(this.isLatestVersion, function1.isLatestVersion); - } - - 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(id, resourceType, createdAt, createdBy, code, deployedAt, settings, displayName, description, logoUrl, previewWebhookUrl, batchMaxCount, catalogId, isLatestVersion); - } - - 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 Function1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" deployedAt: ").append(toIndentedString(deployedAt)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" logoUrl: ").append(toIndentedString(logoUrl)).append("\n"); - sb.append(" previewWebhookUrl: ").append(toIndentedString(previewWebhookUrl)).append("\n"); - sb.append(" batchMaxCount: ").append(toIndentedString(batchMaxCount)).append("\n"); - sb.append(" catalogId: ").append(toIndentedString(catalogId)).append("\n"); - sb.append(" isLatestVersion: ").append(toIndentedString(isLatestVersion)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("resourceType"); - openapiFields.add("createdAt"); - openapiFields.add("createdBy"); - openapiFields.add("code"); - openapiFields.add("deployedAt"); - openapiFields.add("settings"); - openapiFields.add("displayName"); - openapiFields.add("description"); - openapiFields.add("logoUrl"); - openapiFields.add("previewWebhookUrl"); - openapiFields.add("batchMaxCount"); - openapiFields.add("catalogId"); - openapiFields.add("isLatestVersion"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Function1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Function1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Function1 is not found in the empty JSON string", Function1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Function1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Function1` properties. JSON: %s", entry.getKey(), jsonObj.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())); - } - if ((jsonObj.get("resourceType") != null && !jsonObj.get("resourceType").isJsonNull()) && !jsonObj.get("resourceType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `resourceType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resourceType").toString())); - } - if ((jsonObj.get("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) && !jsonObj.get("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - if ((jsonObj.get("createdBy") != null && !jsonObj.get("createdBy").isJsonNull()) && !jsonObj.get("createdBy").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString())); - } - if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); - } - if ((jsonObj.get("deployedAt") != null && !jsonObj.get("deployedAt").isJsonNull()) && !jsonObj.get("deployedAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `deployedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deployedAt").toString())); - } - if (jsonObj.get("settings") != null && !jsonObj.get("settings").isJsonNull()) { - JsonArray jsonArraysettings = jsonObj.getAsJsonArray("settings"); - if (jsonArraysettings != null) { - // ensure the json data is an array - if (!jsonObj.get("settings").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `settings` to be an array in the JSON string but got `%s`", jsonObj.get("settings").toString())); - } - } - } - if ((jsonObj.get("displayName") != null && !jsonObj.get("displayName").isJsonNull()) && !jsonObj.get("displayName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayName").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("logoUrl") != null && !jsonObj.get("logoUrl").isJsonNull()) && !jsonObj.get("logoUrl").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `logoUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("logoUrl").toString())); - } - if ((jsonObj.get("previewWebhookUrl") != null && !jsonObj.get("previewWebhookUrl").isJsonNull()) && !jsonObj.get("previewWebhookUrl").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `previewWebhookUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("previewWebhookUrl").toString())); - } - if ((jsonObj.get("catalogId") != null && !jsonObj.get("catalogId").isJsonNull()) && !jsonObj.get("catalogId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `catalogId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("catalogId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Function1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Function1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Function1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Function1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Function1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Function1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Function1 - * @throws IOException if the JSON string is invalid with respect to Function1 - */ - public static Function1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Function1.class); - } - - /** - * Convert an instance of Function1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Function2.java b/src/main/java/com/segment/publicapi/models/Function2.java deleted file mode 100644 index 68a53f10..00000000 --- a/src/main/java/com/segment/publicapi/models/Function2.java +++ /dev/null @@ -1,709 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.FunctionSettingV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The updated Function object. - */ -@ApiModel(description = "The updated Function object.") - -public class Function2 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - /** - * The Function type. Config API note: equal to `type`. - */ - @JsonAdapter(ResourceTypeEnum.Adapter.class) - public enum ResourceTypeEnum { - DESTINATION("DESTINATION"), - - SOURCE("SOURCE"); - - private String value; - - ResourceTypeEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static ResourceTypeEnum fromValue(String value) { - for (ResourceTypeEnum b : ResourceTypeEnum.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 ResourceTypeEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ResourceTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return ResourceTypeEnum.fromValue(value); - } - } - } - - public static final String SERIALIZED_NAME_RESOURCE_TYPE = "resourceType"; - @SerializedName(SERIALIZED_NAME_RESOURCE_TYPE) - private ResourceTypeEnum resourceType; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; - - public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; - @SerializedName(SERIALIZED_NAME_CREATED_BY) - private String createdBy; - - public static final String SERIALIZED_NAME_CODE = "code"; - @SerializedName(SERIALIZED_NAME_CODE) - private String code; - - public static final String SERIALIZED_NAME_DEPLOYED_AT = "deployedAt"; - @SerializedName(SERIALIZED_NAME_DEPLOYED_AT) - private String deployedAt; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private List settings = null; - - public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; - @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) - private String displayName; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_LOGO_URL = "logoUrl"; - @SerializedName(SERIALIZED_NAME_LOGO_URL) - private String logoUrl; - - public static final String SERIALIZED_NAME_PREVIEW_WEBHOOK_URL = "previewWebhookUrl"; - @SerializedName(SERIALIZED_NAME_PREVIEW_WEBHOOK_URL) - private String previewWebhookUrl; - - public static final String SERIALIZED_NAME_BATCH_MAX_COUNT = "batchMaxCount"; - @SerializedName(SERIALIZED_NAME_BATCH_MAX_COUNT) - private BigDecimal batchMaxCount; - - public static final String SERIALIZED_NAME_CATALOG_ID = "catalogId"; - @SerializedName(SERIALIZED_NAME_CATALOG_ID) - private String catalogId; - - public static final String SERIALIZED_NAME_IS_LATEST_VERSION = "isLatestVersion"; - @SerializedName(SERIALIZED_NAME_IS_LATEST_VERSION) - private Boolean isLatestVersion; - - public Function2() { - } - - public Function2 id(String id) { - - this.id = id; - return this; - } - - /** - * An identifier for this Function. - * @return id - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An identifier for this Function.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Function2 resourceType(ResourceTypeEnum resourceType) { - - this.resourceType = resourceType; - return this; - } - - /** - * The Function type. Config API note: equal to `type`. - * @return resourceType - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Function type. Config API note: equal to `type`.") - - public ResourceTypeEnum getResourceType() { - return resourceType; - } - - - public void setResourceType(ResourceTypeEnum resourceType) { - this.resourceType = resourceType; - } - - - public Function2 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } - - /** - * The time this Function was created. - * @return createdAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The time this Function was created.") - - public String getCreatedAt() { - return createdAt; - } - - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - - public Function2 createdBy(String createdBy) { - - this.createdBy = createdBy; - return this; - } - - /** - * The id of the user who created this Function. - * @return createdBy - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the user who created this Function.") - - public String getCreatedBy() { - return createdBy; - } - - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - - public Function2 code(String code) { - - this.code = code; - return this; - } - - /** - * The Function code. - * @return code - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Function code.") - - public String getCode() { - return code; - } - - - public void setCode(String code) { - this.code = code; - } - - - public Function2 deployedAt(String deployedAt) { - - this.deployedAt = deployedAt; - return this; - } - - /** - * The time of this Function's last deployment. - * @return deployedAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The time of this Function's last deployment.") - - public String getDeployedAt() { - return deployedAt; - } - - - public void setDeployedAt(String deployedAt) { - this.deployedAt = deployedAt; - } - - - public Function2 settings(List settings) { - - this.settings = settings; - return this; - } - - public Function2 addSettingsItem(FunctionSettingV1 settingsItem) { - if (this.settings == null) { - this.settings = new ArrayList<>(); - } - this.settings.add(settingsItem); - return this; - } - - /** - * The list of settings for this Function. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The list of settings for this Function.") - - public List getSettings() { - return settings; - } - - - public void setSettings(List settings) { - this.settings = settings; - } - - - public Function2 displayName(String displayName) { - - this.displayName = displayName; - return this; - } - - /** - * A display name for this Function. - * @return displayName - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A display name for this Function.") - - public String getDisplayName() { - return displayName; - } - - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - - public Function2 description(String description) { - - this.description = description; - return this; - } - - /** - * A description for this Function. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A description for this Function.") - - public String getDescription() { - return description; - } - - - public void setDescription(String description) { - this.description = description; - } - - - public Function2 logoUrl(String logoUrl) { - - this.logoUrl = logoUrl; - return this; - } - - /** - * The URL of the logo for this Function. - * @return logoUrl - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The URL of the logo for this Function.") - - public String getLogoUrl() { - return logoUrl; - } - - - public void setLogoUrl(String logoUrl) { - this.logoUrl = logoUrl; - } - - - public Function2 previewWebhookUrl(String previewWebhookUrl) { - - this.previewWebhookUrl = previewWebhookUrl; - return this; - } - - /** - * The preview webhook URL for this Function. - * @return previewWebhookUrl - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The preview webhook URL for this Function.") - - public String getPreviewWebhookUrl() { - return previewWebhookUrl; - } - - - public void setPreviewWebhookUrl(String previewWebhookUrl) { - this.previewWebhookUrl = previewWebhookUrl; - } - - - public Function2 batchMaxCount(BigDecimal batchMaxCount) { - - this.batchMaxCount = batchMaxCount; - return this; - } - - /** - * The max count of the batch for this Function. - * @return batchMaxCount - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The max count of the batch for this Function.") - - public BigDecimal getBatchMaxCount() { - return batchMaxCount; - } - - - public void setBatchMaxCount(BigDecimal batchMaxCount) { - this.batchMaxCount = batchMaxCount; - } - - - public Function2 catalogId(String catalogId) { - - this.catalogId = catalogId; - return this; - } - - /** - * The catalog id of this Function. - * @return catalogId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The catalog id of this Function.") - - public String getCatalogId() { - return catalogId; - } - - - public void setCatalogId(String catalogId) { - this.catalogId = catalogId; - } - - - public Function2 isLatestVersion(Boolean isLatestVersion) { - - this.isLatestVersion = isLatestVersion; - return this; - } - - /** - * Whether the deployment of this Function is the latest version. - * @return isLatestVersion - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether the deployment of this Function is the latest version.") - - public Boolean getIsLatestVersion() { - return isLatestVersion; - } - - - public void setIsLatestVersion(Boolean isLatestVersion) { - this.isLatestVersion = isLatestVersion; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Function2 function2 = (Function2) o; - return Objects.equals(this.id, function2.id) && - Objects.equals(this.resourceType, function2.resourceType) && - Objects.equals(this.createdAt, function2.createdAt) && - Objects.equals(this.createdBy, function2.createdBy) && - Objects.equals(this.code, function2.code) && - Objects.equals(this.deployedAt, function2.deployedAt) && - Objects.equals(this.settings, function2.settings) && - Objects.equals(this.displayName, function2.displayName) && - Objects.equals(this.description, function2.description) && - Objects.equals(this.logoUrl, function2.logoUrl) && - Objects.equals(this.previewWebhookUrl, function2.previewWebhookUrl) && - Objects.equals(this.batchMaxCount, function2.batchMaxCount) && - Objects.equals(this.catalogId, function2.catalogId) && - Objects.equals(this.isLatestVersion, function2.isLatestVersion); - } - - 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(id, resourceType, createdAt, createdBy, code, deployedAt, settings, displayName, description, logoUrl, previewWebhookUrl, batchMaxCount, catalogId, isLatestVersion); - } - - 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 Function2 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" deployedAt: ").append(toIndentedString(deployedAt)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" logoUrl: ").append(toIndentedString(logoUrl)).append("\n"); - sb.append(" previewWebhookUrl: ").append(toIndentedString(previewWebhookUrl)).append("\n"); - sb.append(" batchMaxCount: ").append(toIndentedString(batchMaxCount)).append("\n"); - sb.append(" catalogId: ").append(toIndentedString(catalogId)).append("\n"); - sb.append(" isLatestVersion: ").append(toIndentedString(isLatestVersion)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("resourceType"); - openapiFields.add("createdAt"); - openapiFields.add("createdBy"); - openapiFields.add("code"); - openapiFields.add("deployedAt"); - openapiFields.add("settings"); - openapiFields.add("displayName"); - openapiFields.add("description"); - openapiFields.add("logoUrl"); - openapiFields.add("previewWebhookUrl"); - openapiFields.add("batchMaxCount"); - openapiFields.add("catalogId"); - openapiFields.add("isLatestVersion"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Function2 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Function2.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Function2 is not found in the empty JSON string", Function2.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Function2.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Function2` properties. JSON: %s", entry.getKey(), jsonObj.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())); - } - if ((jsonObj.get("resourceType") != null && !jsonObj.get("resourceType").isJsonNull()) && !jsonObj.get("resourceType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `resourceType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resourceType").toString())); - } - if ((jsonObj.get("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) && !jsonObj.get("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - if ((jsonObj.get("createdBy") != null && !jsonObj.get("createdBy").isJsonNull()) && !jsonObj.get("createdBy").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString())); - } - if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); - } - if ((jsonObj.get("deployedAt") != null && !jsonObj.get("deployedAt").isJsonNull()) && !jsonObj.get("deployedAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `deployedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deployedAt").toString())); - } - if (jsonObj.get("settings") != null && !jsonObj.get("settings").isJsonNull()) { - JsonArray jsonArraysettings = jsonObj.getAsJsonArray("settings"); - if (jsonArraysettings != null) { - // ensure the json data is an array - if (!jsonObj.get("settings").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `settings` to be an array in the JSON string but got `%s`", jsonObj.get("settings").toString())); - } - } - } - if ((jsonObj.get("displayName") != null && !jsonObj.get("displayName").isJsonNull()) && !jsonObj.get("displayName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayName").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("logoUrl") != null && !jsonObj.get("logoUrl").isJsonNull()) && !jsonObj.get("logoUrl").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `logoUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("logoUrl").toString())); - } - if ((jsonObj.get("previewWebhookUrl") != null && !jsonObj.get("previewWebhookUrl").isJsonNull()) && !jsonObj.get("previewWebhookUrl").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `previewWebhookUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("previewWebhookUrl").toString())); - } - if ((jsonObj.get("catalogId") != null && !jsonObj.get("catalogId").isJsonNull()) && !jsonObj.get("catalogId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `catalogId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("catalogId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Function2.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Function2' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Function2.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Function2 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Function2 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Function2 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Function2 - * @throws IOException if the JSON string is invalid with respect to Function2 - */ - public static Function2 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Function2.class); - } - - /** - * Convert an instance of Function2 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/FunctionDeployment.java b/src/main/java/com/segment/publicapi/models/FunctionDeployment.java index 2d7a82f6..213a24ba 100644 --- a/src/main/java/com/segment/publicapi/models/FunctionDeployment.java +++ b/src/main/java/com/segment/publicapi/models/FunctionDeployment.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,244 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The status of the operation. - */ -@ApiModel(description = "The status of the operation.") - +/** The status of the operation. */ public class FunctionDeployment { - /** - * Gets or Sets status - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** Gets or Sets status */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public FunctionDeployment() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public FunctionDeployment status(StatusEnum status) { - - this.status = status; - return this; - } + public FunctionDeployment() {} - /** - * Get status - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public FunctionDeployment status(StatusEnum status) { - public StatusEnum getStatus() { - return 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 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; + } + FunctionDeployment functionDeployment = (FunctionDeployment) o; + return Objects.equals(this.status, functionDeployment.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FunctionDeployment {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - FunctionDeployment functionDeployment = (FunctionDeployment) o; - return Objects.equals(this.status, functionDeployment.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FunctionDeployment {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to FunctionDeployment - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!FunctionDeployment.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in FunctionDeployment is not found in the empty JSON string", FunctionDeployment.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FunctionDeployment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FunctionDeployment.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in FunctionDeployment is not found in the" + + " empty JSON string", + FunctionDeployment.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!FunctionDeployment.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FunctionDeployment` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FunctionDeployment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `FunctionDeployment` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionDeployment.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FunctionDeployment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!FunctionDeployment.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionDeployment' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionDeployment.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, FunctionDeployment value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public FunctionDeployment read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of FunctionDeployment given an JSON string - * - * @param jsonString JSON string - * @return An instance of FunctionDeployment - * @throws IOException if the JSON string is invalid with respect to FunctionDeployment - */ - public static FunctionDeployment fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionDeployment.class); - } - - /** - * Convert an instance of FunctionDeployment to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FunctionDeployment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FunctionDeployment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(FunctionDeployment.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, FunctionDeployment value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FunctionDeployment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of FunctionDeployment given an JSON string + * + * @param jsonString JSON string + * @return An instance of FunctionDeployment + * @throws IOException if the JSON string is invalid with respect to FunctionDeployment + */ + public static FunctionDeployment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FunctionDeployment.class); + } + + /** + * Convert an instance of FunctionDeployment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/FunctionSettingV1.java b/src/main/java/com/segment/publicapi/models/FunctionSettingV1.java index a81fc488..1a58f9ea 100644 --- a/src/main/java/com/segment/publicapi/models/FunctionSettingV1.java +++ b/src/main/java/com/segment/publicapi/models/FunctionSettingV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,422 +9,416 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** FunctionSettingV1 */ +public class FunctionSettingV1 { + public static final String SERIALIZED_NAME_NAME = "name"; -/** - * FunctionSettingV1 - */ + @SerializedName(SERIALIZED_NAME_NAME) + private String name; -public class FunctionSettingV1 { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_LABEL = "label"; - @SerializedName(SERIALIZED_NAME_LABEL) - private String label; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - /** - * The Function type. - */ - @JsonAdapter(TypeEnum.Adapter.class) - public enum TypeEnum { - ARRAY("ARRAY"), - - BOOLEAN("BOOLEAN"), - - STRING("STRING"), - - TEXT_MAP("TEXT_MAP"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } + public static final String SERIALIZED_NAME_LABEL = "label"; - public String getValue() { - return value; - } + @SerializedName(SERIALIZED_NAME_LABEL) + private String label; - @Override - public String toString() { - return String.valueOf(value); - } + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - 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); - } - } - } + /** The type of this Function Setting. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ARRAY("ARRAY"), - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - private TypeEnum type; + BOOLEAN("BOOLEAN"), - public static final String SERIALIZED_NAME_REQUIRED = "required"; - @SerializedName(SERIALIZED_NAME_REQUIRED) - private Boolean required; + STRING("STRING"), - public static final String SERIALIZED_NAME_SENSITIVE = "sensitive"; - @SerializedName(SERIALIZED_NAME_SENSITIVE) - private Boolean sensitive; + TEXT_MAP("TEXT_MAP"); - public FunctionSettingV1() { - } + private String value; - public FunctionSettingV1 name(String name) { - - this.name = name; - return this; - } + TypeEnum(String value) { + this.value = value; + } - /** - * The name of this Function. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of this Function.") + public String getValue() { + return value; + } - public String getName() { - return name; - } + @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 void setName(String name) { - this.name = name; - } + 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"; - public FunctionSettingV1 label(String label) { - - this.label = label; - return this; - } + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; - /** - * The label for this Function. - * @return label - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The label for this Function.") + public static final String SERIALIZED_NAME_REQUIRED = "required"; - public String getLabel() { - return label; - } + @SerializedName(SERIALIZED_NAME_REQUIRED) + private Boolean required; + public static final String SERIALIZED_NAME_SENSITIVE = "sensitive"; - public void setLabel(String label) { - this.label = label; - } + @SerializedName(SERIALIZED_NAME_SENSITIVE) + private Boolean sensitive; + public FunctionSettingV1() {} - public FunctionSettingV1 description(String description) { - - this.description = description; - return this; - } + public FunctionSettingV1 name(String name) { - /** - * A description of this Function. - * @return description - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A description of this Function.") + this.name = name; + return this; + } - public String getDescription() { - return description; - } + /** + * The name of this Function Setting. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public FunctionSettingV1 label(String label) { - public void setDescription(String description) { - this.description = description; - } + this.label = label; + return this; + } + /** + * The label for this Function Setting. + * + * @return label + */ + @javax.annotation.Nonnull + public String getLabel() { + return label; + } - public FunctionSettingV1 type(TypeEnum type) { - - this.type = type; - return this; - } + public void setLabel(String label) { + this.label = label; + } - /** - * The Function type. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Function type.") + public FunctionSettingV1 description(String description) { - public TypeEnum getType() { - return type; - } + this.description = description; + return this; + } + /** + * A description of this Function Setting. + * + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } - public void setType(TypeEnum type) { - this.type = type; - } + public void setDescription(String description) { + this.description = description; + } + public FunctionSettingV1 type(TypeEnum type) { - public FunctionSettingV1 required(Boolean required) { - - this.required = required; - return this; - } + this.type = type; + return this; + } - /** - * Whether this Function is required. - * @return required - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether this Function is required.") + /** + * The type of this Function Setting. + * + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } - public Boolean getRequired() { - return required; - } + public void setType(TypeEnum type) { + this.type = type; + } + public FunctionSettingV1 required(Boolean required) { - public void setRequired(Boolean required) { - this.required = required; - } + this.required = required; + return this; + } + /** + * Whether this Function Setting is required. + * + * @return required + */ + @javax.annotation.Nonnull + public Boolean getRequired() { + return required; + } - public FunctionSettingV1 sensitive(Boolean sensitive) { - - this.sensitive = sensitive; - return this; - } + public void setRequired(Boolean required) { + this.required = required; + } - /** - * Whether this Function contains sensitive information. - * @return sensitive - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether this Function contains sensitive information.") + public FunctionSettingV1 sensitive(Boolean sensitive) { - public Boolean getSensitive() { - return sensitive; - } + this.sensitive = sensitive; + return this; + } + /** + * Whether this Function Setting contains sensitive information. + * + * @return sensitive + */ + @javax.annotation.Nonnull + public Boolean getSensitive() { + return sensitive; + } - public void setSensitive(Boolean sensitive) { - this.sensitive = sensitive; - } + public void setSensitive(Boolean sensitive) { + this.sensitive = sensitive; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FunctionSettingV1 functionSettingV1 = (FunctionSettingV1) o; + return Objects.equals(this.name, functionSettingV1.name) + && Objects.equals(this.label, functionSettingV1.label) + && Objects.equals(this.description, functionSettingV1.description) + && Objects.equals(this.type, functionSettingV1.type) + && Objects.equals(this.required, functionSettingV1.required) + && Objects.equals(this.sensitive, functionSettingV1.sensitive); + } + @Override + public int hashCode() { + return Objects.hash(name, label, description, type, required, sensitive); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FunctionSettingV1 {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append(" sensitive: ").append(toIndentedString(sensitive)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - FunctionSettingV1 functionSettingV1 = (FunctionSettingV1) o; - return Objects.equals(this.name, functionSettingV1.name) && - Objects.equals(this.label, functionSettingV1.label) && - Objects.equals(this.description, functionSettingV1.description) && - Objects.equals(this.type, functionSettingV1.type) && - Objects.equals(this.required, functionSettingV1.required) && - Objects.equals(this.sensitive, functionSettingV1.sensitive); - } - - @Override - public int hashCode() { - return Objects.hash(name, label, description, type, required, sensitive); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FunctionSettingV1 {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" label: ").append(toIndentedString(label)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" required: ").append(toIndentedString(required)).append("\n"); - sb.append(" sensitive: ").append(toIndentedString(sensitive)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("label"); + openapiFields.add("description"); + openapiFields.add("type"); + openapiFields.add("required"); + openapiFields.add("sensitive"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("label"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("required"); + openapiRequiredFields.add("sensitive"); } - return o.toString().replace("\n", "\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("label"); - openapiFields.add("description"); - openapiFields.add("type"); - openapiFields.add("required"); - openapiFields.add("sensitive"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("label"); - openapiRequiredFields.add("description"); - openapiRequiredFields.add("type"); - openapiRequiredFields.add("required"); - openapiRequiredFields.add("sensitive"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to FunctionSettingV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!FunctionSettingV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in FunctionSettingV1 is not found in the empty JSON string", FunctionSettingV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FunctionSettingV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FunctionSettingV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in FunctionSettingV1 is not found in the" + + " empty JSON string", + FunctionSettingV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!FunctionSettingV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FunctionSettingV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FunctionSettingV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `FunctionSettingV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionSettingV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FunctionSettingV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("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("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 (!FunctionSettingV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FunctionSettingV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(FunctionSettingV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, FunctionSettingV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FunctionSettingV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("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("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("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 (!FunctionSettingV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionSettingV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionSettingV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, FunctionSettingV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public FunctionSettingV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of FunctionSettingV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of FunctionSettingV1 - * @throws IOException if the JSON string is invalid with respect to FunctionSettingV1 - */ - public static FunctionSettingV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionSettingV1.class); - } - - /** - * Convert an instance of FunctionSettingV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of FunctionSettingV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of FunctionSettingV1 + * @throws IOException if the JSON string is invalid with respect to FunctionSettingV1 + */ + public static FunctionSettingV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FunctionSettingV1.class); + } + + /** + * Convert an instance of FunctionSettingV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/FunctionV1.java b/src/main/java/com/segment/publicapi/models/FunctionV1.java index b17078fe..4460e65b 100644 --- a/src/main/java/com/segment/publicapi/models/FunctionV1.java +++ b/src/main/java/com/segment/publicapi/models/FunctionV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,700 +9,749 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.segment.publicapi.models.FunctionSettingV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; -import java.util.List; -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 java.lang.reflect.Type; -import java.util.HashMap; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; +import org.openapitools.jackson.nullable.JsonNullable; -import com.segment.publicapi.JSON; +/** Represents a Function. */ +public class FunctionV1 { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * Represents a Function. - */ -@ApiModel(description = "Represents a Function.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class FunctionV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + /** The Function type. Config API note: equal to `type`. */ + @JsonAdapter(ResourceTypeEnum.Adapter.class) + public enum ResourceTypeEnum { + DESTINATION("DESTINATION"), - /** - * The Function type. Config API note: equal to `type`. - */ - @JsonAdapter(ResourceTypeEnum.Adapter.class) - public enum ResourceTypeEnum { - DESTINATION("DESTINATION"), - - SOURCE("SOURCE"); + INSERT_DESTINATION("INSERT_DESTINATION"), - private String value; + INSERT_SOURCE("INSERT_SOURCE"), - ResourceTypeEnum(String value) { - this.value = value; - } + SOURCE("SOURCE"); - public String getValue() { - return value; - } + private String value; - @Override - public String toString() { - return String.valueOf(value); - } + ResourceTypeEnum(String value) { + this.value = value; + } - public static ResourceTypeEnum fromValue(String value) { - for (ResourceTypeEnum b : ResourceTypeEnum.values()) { - if (b.value.equals(value)) { - return b; + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final ResourceTypeEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } + public static ResourceTypeEnum fromValue(String value) { + for (ResourceTypeEnum b : ResourceTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - @Override - public ResourceTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return ResourceTypeEnum.fromValue(value); - } + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ResourceTypeEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ResourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ResourceTypeEnum.fromValue(value); + } + } } - } - public static final String SERIALIZED_NAME_RESOURCE_TYPE = "resourceType"; - @SerializedName(SERIALIZED_NAME_RESOURCE_TYPE) - private ResourceTypeEnum resourceType; + public static final String SERIALIZED_NAME_RESOURCE_TYPE = "resourceType"; - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; + @SerializedName(SERIALIZED_NAME_RESOURCE_TYPE) + private ResourceTypeEnum resourceType; - public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; - @SerializedName(SERIALIZED_NAME_CREATED_BY) - private String createdBy; + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - public static final String SERIALIZED_NAME_CODE = "code"; - @SerializedName(SERIALIZED_NAME_CODE) - private String code; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; - public static final String SERIALIZED_NAME_DEPLOYED_AT = "deployedAt"; - @SerializedName(SERIALIZED_NAME_DEPLOYED_AT) - private String deployedAt; + public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private List settings = null; + @SerializedName(SERIALIZED_NAME_CREATED_BY) + private String createdBy; - public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; - @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) - private String displayName; + public static final String SERIALIZED_NAME_CODE = "code"; - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + @SerializedName(SERIALIZED_NAME_CODE) + private String code; - public static final String SERIALIZED_NAME_LOGO_URL = "logoUrl"; - @SerializedName(SERIALIZED_NAME_LOGO_URL) - private String logoUrl; + public static final String SERIALIZED_NAME_DEPLOYED_AT = "deployedAt"; - public static final String SERIALIZED_NAME_PREVIEW_WEBHOOK_URL = "previewWebhookUrl"; - @SerializedName(SERIALIZED_NAME_PREVIEW_WEBHOOK_URL) - private String previewWebhookUrl; + @SerializedName(SERIALIZED_NAME_DEPLOYED_AT) + private String deployedAt; - public static final String SERIALIZED_NAME_BATCH_MAX_COUNT = "batchMaxCount"; - @SerializedName(SERIALIZED_NAME_BATCH_MAX_COUNT) - private BigDecimal batchMaxCount; + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - public static final String SERIALIZED_NAME_CATALOG_ID = "catalogId"; - @SerializedName(SERIALIZED_NAME_CATALOG_ID) - private String catalogId; + @SerializedName(SERIALIZED_NAME_SETTINGS) + private List settings; - public static final String SERIALIZED_NAME_IS_LATEST_VERSION = "isLatestVersion"; - @SerializedName(SERIALIZED_NAME_IS_LATEST_VERSION) - private Boolean isLatestVersion; + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; - public FunctionV1() { - } + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + private String displayName; - public FunctionV1 id(String id) { - - this.id = id; - return this; - } + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - /** - * An identifier for this Function. - * @return id - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An identifier for this Function.") + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - public String getId() { - return id; - } + public static final String SERIALIZED_NAME_LOGO_URL = "logoUrl"; + @SerializedName(SERIALIZED_NAME_LOGO_URL) + private String logoUrl; - public void setId(String id) { - this.id = id; - } + public static final String SERIALIZED_NAME_PREVIEW_WEBHOOK_URL = "previewWebhookUrl"; + @SerializedName(SERIALIZED_NAME_PREVIEW_WEBHOOK_URL) + private String previewWebhookUrl; - public FunctionV1 resourceType(ResourceTypeEnum resourceType) { - - this.resourceType = resourceType; - return this; - } + public static final String SERIALIZED_NAME_BATCH_MAX_COUNT = "batchMaxCount"; - /** - * The Function type. Config API note: equal to `type`. - * @return resourceType - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Function type. Config API note: equal to `type`.") + @SerializedName(SERIALIZED_NAME_BATCH_MAX_COUNT) + private BigDecimal batchMaxCount; - public ResourceTypeEnum getResourceType() { - return resourceType; - } + public static final String SERIALIZED_NAME_CATALOG_ID = "catalogId"; + @SerializedName(SERIALIZED_NAME_CATALOG_ID) + private String catalogId; - public void setResourceType(ResourceTypeEnum resourceType) { - this.resourceType = resourceType; - } + public static final String SERIALIZED_NAME_IS_LATEST_VERSION = "isLatestVersion"; + @SerializedName(SERIALIZED_NAME_IS_LATEST_VERSION) + private Boolean isLatestVersion; - public FunctionV1 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } + public FunctionV1() {} - /** - * The time this Function was created. - * @return createdAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The time this Function was created.") + public FunctionV1 id(String id) { - public String getCreatedAt() { - return createdAt; - } + this.id = id; + return this; + } + /** + * An identifier for this Function. + * + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } + public void setId(String id) { + this.id = id; + } + public FunctionV1 resourceType(ResourceTypeEnum resourceType) { - public FunctionV1 createdBy(String createdBy) { - - this.createdBy = createdBy; - return this; - } + this.resourceType = resourceType; + return this; + } - /** - * The id of the user who created this Function. - * @return createdBy - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The id of the user who created this Function.") + /** + * The Function type. Config API note: equal to `type`. + * + * @return resourceType + */ + @javax.annotation.Nullable + public ResourceTypeEnum getResourceType() { + return resourceType; + } - public String getCreatedBy() { - return createdBy; - } + public void setResourceType(ResourceTypeEnum resourceType) { + this.resourceType = resourceType; + } + public FunctionV1 createdAt(String createdAt) { - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } + this.createdAt = createdAt; + return this; + } + /** + * The time this Function was created. + * + * @return createdAt + */ + @javax.annotation.Nullable + public String getCreatedAt() { + return createdAt; + } - public FunctionV1 code(String code) { - - this.code = code; - return this; - } + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } - /** - * The Function code. - * @return code - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Function code.") + public FunctionV1 createdBy(String createdBy) { - public String getCode() { - return code; - } + this.createdBy = createdBy; + return this; + } + /** + * The id of the user who created this Function. + * + * @return createdBy + */ + @javax.annotation.Nullable + public String getCreatedBy() { + return createdBy; + } - public void setCode(String code) { - this.code = code; - } + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + public FunctionV1 code(String code) { - public FunctionV1 deployedAt(String deployedAt) { - - this.deployedAt = deployedAt; - return this; - } + this.code = code; + return this; + } - /** - * The time of this Function's last deployment. - * @return deployedAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The time of this Function's last deployment.") + /** + * The Function code. + * + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } - public String getDeployedAt() { - return deployedAt; - } + public void setCode(String code) { + this.code = code; + } + public FunctionV1 deployedAt(String deployedAt) { - public void setDeployedAt(String deployedAt) { - this.deployedAt = deployedAt; - } + this.deployedAt = deployedAt; + return this; + } + /** + * The time of this Function's last deployment. + * + * @return deployedAt + */ + @javax.annotation.Nullable + public String getDeployedAt() { + return deployedAt; + } - public FunctionV1 settings(List settings) { - - this.settings = settings; - return this; - } + public void setDeployedAt(String deployedAt) { + this.deployedAt = deployedAt; + } - public FunctionV1 addSettingsItem(FunctionSettingV1 settingsItem) { - if (this.settings == null) { - this.settings = new ArrayList<>(); + public FunctionV1 settings(List settings) { + + this.settings = settings; + return this; } - this.settings.add(settingsItem); - return this; - } - /** - * The list of settings for this Function. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The list of settings for this Function.") + public FunctionV1 addSettingsItem(FunctionSettingV1 settingsItem) { + if (this.settings == null) { + this.settings = new ArrayList<>(); + } + this.settings.add(settingsItem); + return this; + } - public List getSettings() { - return settings; - } + /** + * The list of settings for this Function. + * + * @return settings + */ + @javax.annotation.Nullable + public List getSettings() { + return settings; + } + public void setSettings(List settings) { + this.settings = settings; + } - public void setSettings(List settings) { - this.settings = settings; - } + public FunctionV1 displayName(String displayName) { + this.displayName = displayName; + return this; + } - public FunctionV1 displayName(String displayName) { - - this.displayName = displayName; - return this; - } + /** + * A display name for this Function. + * + * @return displayName + */ + @javax.annotation.Nullable + public String getDisplayName() { + return displayName; + } - /** - * A display name for this Function. - * @return displayName - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A display name for this Function.") + public void setDisplayName(String displayName) { + this.displayName = displayName; + } - public String getDisplayName() { - return displayName; - } + public FunctionV1 description(String description) { + this.description = description; + return this; + } - public void setDisplayName(String displayName) { - this.displayName = displayName; - } + /** + * A description for this Function. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } - public FunctionV1 description(String description) { - - this.description = description; - return this; - } + public FunctionV1 logoUrl(String logoUrl) { - /** - * A description for this Function. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A description for this Function.") + this.logoUrl = logoUrl; + return this; + } - public String getDescription() { - return description; - } + /** + * The URL of the logo for this Function. + * + * @return logoUrl + */ + @javax.annotation.Nullable + public String getLogoUrl() { + return logoUrl; + } + public void setLogoUrl(String logoUrl) { + this.logoUrl = logoUrl; + } - public void setDescription(String description) { - this.description = description; - } + public FunctionV1 previewWebhookUrl(String previewWebhookUrl) { + this.previewWebhookUrl = previewWebhookUrl; + return this; + } - public FunctionV1 logoUrl(String logoUrl) { - - this.logoUrl = logoUrl; - return this; - } + /** + * The preview webhook URL for this Function. + * + * @return previewWebhookUrl + */ + @javax.annotation.Nullable + public String getPreviewWebhookUrl() { + return previewWebhookUrl; + } - /** - * The URL of the logo for this Function. - * @return logoUrl - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The URL of the logo for this Function.") + public void setPreviewWebhookUrl(String previewWebhookUrl) { + this.previewWebhookUrl = previewWebhookUrl; + } - public String getLogoUrl() { - return logoUrl; - } + public FunctionV1 batchMaxCount(BigDecimal batchMaxCount) { + this.batchMaxCount = batchMaxCount; + return this; + } - public void setLogoUrl(String logoUrl) { - this.logoUrl = logoUrl; - } + /** + * The max count of the batch for this Function. + * + * @return batchMaxCount + */ + @javax.annotation.Nullable + public BigDecimal getBatchMaxCount() { + return batchMaxCount; + } + public void setBatchMaxCount(BigDecimal batchMaxCount) { + this.batchMaxCount = batchMaxCount; + } - public FunctionV1 previewWebhookUrl(String previewWebhookUrl) { - - this.previewWebhookUrl = previewWebhookUrl; - return this; - } + public FunctionV1 catalogId(String catalogId) { - /** - * The preview webhook URL for this Function. - * @return previewWebhookUrl - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The preview webhook URL for this Function.") + this.catalogId = catalogId; + return this; + } - public String getPreviewWebhookUrl() { - return previewWebhookUrl; - } + /** + * The catalog id of this Function. + * + * @return catalogId + */ + @javax.annotation.Nullable + public String getCatalogId() { + return catalogId; + } + public void setCatalogId(String catalogId) { + this.catalogId = catalogId; + } - public void setPreviewWebhookUrl(String previewWebhookUrl) { - this.previewWebhookUrl = previewWebhookUrl; - } + public FunctionV1 isLatestVersion(Boolean isLatestVersion) { + this.isLatestVersion = isLatestVersion; + return this; + } - public FunctionV1 batchMaxCount(BigDecimal batchMaxCount) { - - this.batchMaxCount = batchMaxCount; - return this; - } + /** + * Whether the deployment of this Function is the latest version. + * + * @return isLatestVersion + */ + @javax.annotation.Nullable + public Boolean getIsLatestVersion() { + return isLatestVersion; + } - /** - * The max count of the batch for this Function. - * @return batchMaxCount - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The max count of the batch for this Function.") + public void setIsLatestVersion(Boolean isLatestVersion) { + this.isLatestVersion = isLatestVersion; + } - public BigDecimal getBatchMaxCount() { - return batchMaxCount; - } - - - public void setBatchMaxCount(BigDecimal batchMaxCount) { - this.batchMaxCount = batchMaxCount; - } - - - public FunctionV1 catalogId(String catalogId) { - - this.catalogId = catalogId; - return this; - } - - /** - * The catalog id of this Function. - * @return catalogId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The catalog id of this Function.") - - public String getCatalogId() { - return catalogId; - } - - - public void setCatalogId(String catalogId) { - this.catalogId = catalogId; - } - - - public FunctionV1 isLatestVersion(Boolean isLatestVersion) { - - this.isLatestVersion = isLatestVersion; - return this; - } - - /** - * Whether the deployment of this Function is the latest version. - * @return isLatestVersion - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether the deployment of this Function is the latest version.") - - public Boolean getIsLatestVersion() { - return isLatestVersion; - } - - - public void setIsLatestVersion(Boolean isLatestVersion) { - this.isLatestVersion = isLatestVersion; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - FunctionV1 functionV1 = (FunctionV1) o; - return Objects.equals(this.id, functionV1.id) && - Objects.equals(this.resourceType, functionV1.resourceType) && - Objects.equals(this.createdAt, functionV1.createdAt) && - Objects.equals(this.createdBy, functionV1.createdBy) && - Objects.equals(this.code, functionV1.code) && - Objects.equals(this.deployedAt, functionV1.deployedAt) && - Objects.equals(this.settings, functionV1.settings) && - Objects.equals(this.displayName, functionV1.displayName) && - Objects.equals(this.description, functionV1.description) && - Objects.equals(this.logoUrl, functionV1.logoUrl) && - Objects.equals(this.previewWebhookUrl, functionV1.previewWebhookUrl) && - Objects.equals(this.batchMaxCount, functionV1.batchMaxCount) && - Objects.equals(this.catalogId, functionV1.catalogId) && - Objects.equals(this.isLatestVersion, functionV1.isLatestVersion); - } - - 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(id, resourceType, createdAt, createdBy, code, deployedAt, settings, displayName, description, logoUrl, previewWebhookUrl, batchMaxCount, catalogId, isLatestVersion); - } - - 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 FunctionV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" deployedAt: ").append(toIndentedString(deployedAt)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" logoUrl: ").append(toIndentedString(logoUrl)).append("\n"); - sb.append(" previewWebhookUrl: ").append(toIndentedString(previewWebhookUrl)).append("\n"); - sb.append(" batchMaxCount: ").append(toIndentedString(batchMaxCount)).append("\n"); - sb.append(" catalogId: ").append(toIndentedString(catalogId)).append("\n"); - sb.append(" isLatestVersion: ").append(toIndentedString(isLatestVersion)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("resourceType"); - openapiFields.add("createdAt"); - openapiFields.add("createdBy"); - openapiFields.add("code"); - openapiFields.add("deployedAt"); - openapiFields.add("settings"); - openapiFields.add("displayName"); - openapiFields.add("description"); - openapiFields.add("logoUrl"); - openapiFields.add("previewWebhookUrl"); - openapiFields.add("batchMaxCount"); - openapiFields.add("catalogId"); - openapiFields.add("isLatestVersion"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to FunctionV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!FunctionV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in FunctionV1 is not found in the empty JSON string", FunctionV1.openapiRequiredFields.toString())); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!FunctionV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FunctionV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + if (o == null || getClass() != o.getClass()) { + return false; } - } - 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("resourceType") != null && !jsonObj.get("resourceType").isJsonNull()) && !jsonObj.get("resourceType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `resourceType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resourceType").toString())); - } - if ((jsonObj.get("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) && !jsonObj.get("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - if ((jsonObj.get("createdBy") != null && !jsonObj.get("createdBy").isJsonNull()) && !jsonObj.get("createdBy").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString())); - } - if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); - } - if ((jsonObj.get("deployedAt") != null && !jsonObj.get("deployedAt").isJsonNull()) && !jsonObj.get("deployedAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `deployedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deployedAt").toString())); - } - if (jsonObj.get("settings") != null && !jsonObj.get("settings").isJsonNull()) { - JsonArray jsonArraysettings = jsonObj.getAsJsonArray("settings"); - if (jsonArraysettings != null) { - // ensure the json data is an array - if (!jsonObj.get("settings").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `settings` to be an array in the JSON string but got `%s`", jsonObj.get("settings").toString())); - } + FunctionV1 functionV1 = (FunctionV1) o; + return Objects.equals(this.id, functionV1.id) + && Objects.equals(this.resourceType, functionV1.resourceType) + && Objects.equals(this.createdAt, functionV1.createdAt) + && Objects.equals(this.createdBy, functionV1.createdBy) + && Objects.equals(this.code, functionV1.code) + && Objects.equals(this.deployedAt, functionV1.deployedAt) + && Objects.equals(this.settings, functionV1.settings) + && Objects.equals(this.displayName, functionV1.displayName) + && Objects.equals(this.description, functionV1.description) + && Objects.equals(this.logoUrl, functionV1.logoUrl) + && Objects.equals(this.previewWebhookUrl, functionV1.previewWebhookUrl) + && Objects.equals(this.batchMaxCount, functionV1.batchMaxCount) + && Objects.equals(this.catalogId, functionV1.catalogId) + && Objects.equals(this.isLatestVersion, functionV1.isLatestVersion); + } + + 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( + id, + resourceType, + createdAt, + createdBy, + code, + deployedAt, + settings, + displayName, + description, + logoUrl, + previewWebhookUrl, + batchMaxCount, + catalogId, + isLatestVersion); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - } - if ((jsonObj.get("displayName") != null && !jsonObj.get("displayName").isJsonNull()) && !jsonObj.get("displayName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayName").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("logoUrl") != null && !jsonObj.get("logoUrl").isJsonNull()) && !jsonObj.get("logoUrl").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `logoUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("logoUrl").toString())); - } - if ((jsonObj.get("previewWebhookUrl") != null && !jsonObj.get("previewWebhookUrl").isJsonNull()) && !jsonObj.get("previewWebhookUrl").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `previewWebhookUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("previewWebhookUrl").toString())); - } - if ((jsonObj.get("catalogId") != null && !jsonObj.get("catalogId").isJsonNull()) && !jsonObj.get("catalogId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `catalogId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("catalogId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!FunctionV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, FunctionV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public FunctionV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of FunctionV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of FunctionV1 - * @throws IOException if the JSON string is invalid with respect to FunctionV1 - */ - public static FunctionV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionV1.class); - } - - /** - * Convert an instance of FunctionV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FunctionV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" deployedAt: ").append(toIndentedString(deployedAt)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" logoUrl: ").append(toIndentedString(logoUrl)).append("\n"); + sb.append(" previewWebhookUrl: ") + .append(toIndentedString(previewWebhookUrl)) + .append("\n"); + sb.append(" batchMaxCount: ").append(toIndentedString(batchMaxCount)).append("\n"); + sb.append(" catalogId: ").append(toIndentedString(catalogId)).append("\n"); + sb.append(" isLatestVersion: ").append(toIndentedString(isLatestVersion)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("resourceType"); + openapiFields.add("createdAt"); + openapiFields.add("createdBy"); + openapiFields.add("code"); + openapiFields.add("deployedAt"); + openapiFields.add("settings"); + openapiFields.add("displayName"); + openapiFields.add("description"); + openapiFields.add("logoUrl"); + openapiFields.add("previewWebhookUrl"); + openapiFields.add("batchMaxCount"); + openapiFields.add("catalogId"); + openapiFields.add("isLatestVersion"); + + // 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 FunctionV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FunctionV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in FunctionV1 is not found in the empty" + + " JSON string", + FunctionV1.openapiRequiredFields.toString())); + } + } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FunctionV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `FunctionV1` 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("resourceType") != null && !jsonObj.get("resourceType").isJsonNull()) + && !jsonObj.get("resourceType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `resourceType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("resourceType").toString())); + } + if ((jsonObj.get("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) + && !jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdAt").toString())); + } + if ((jsonObj.get("createdBy") != null && !jsonObj.get("createdBy").isJsonNull()) + && !jsonObj.get("createdBy").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdBy` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdBy").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("deployedAt") != null && !jsonObj.get("deployedAt").isJsonNull()) + && !jsonObj.get("deployedAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `deployedAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("deployedAt").toString())); + } + if (jsonObj.get("settings") != null && !jsonObj.get("settings").isJsonNull()) { + JsonArray jsonArraysettings = jsonObj.getAsJsonArray("settings"); + if (jsonArraysettings != null) { + // ensure the json data is an array + if (!jsonObj.get("settings").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `settings` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("settings").toString())); + } + + // validate the optional field `settings` (array) + for (int i = 0; i < jsonArraysettings.size(); i++) { + FunctionSettingV1.validateJsonElement(jsonArraysettings.get(i)); + } + ; + } + } + if ((jsonObj.get("displayName") != null && !jsonObj.get("displayName").isJsonNull()) + && !jsonObj.get("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `displayName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("displayName").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("logoUrl") != null && !jsonObj.get("logoUrl").isJsonNull()) + && !jsonObj.get("logoUrl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `logoUrl` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("logoUrl").toString())); + } + if ((jsonObj.get("previewWebhookUrl") != null + && !jsonObj.get("previewWebhookUrl").isJsonNull()) + && !jsonObj.get("previewWebhookUrl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `previewWebhookUrl` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("previewWebhookUrl").toString())); + } + if ((jsonObj.get("catalogId") != null && !jsonObj.get("catalogId").isJsonNull()) + && !jsonObj.get("catalogId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `catalogId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("catalogId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FunctionV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FunctionV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(FunctionV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, FunctionV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FunctionV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of FunctionV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of FunctionV1 + * @throws IOException if the JSON string is invalid with respect to FunctionV1 + */ + public static FunctionV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FunctionV1.class); + } + + /** + * Convert an instance of FunctionV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GenerateUploadURLForEdgeFunctions200Response.java b/src/main/java/com/segment/publicapi/models/GenerateUploadURLForEdgeFunctions200Response.java index 32eaff2e..3f2b1428 100644 --- a/src/main/java/com/segment/publicapi/models/GenerateUploadURLForEdgeFunctions200Response.java +++ b/src/main/java/com/segment/publicapi/models/GenerateUploadURLForEdgeFunctions200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,201 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GenerateUploadURLForEdgeFunctionsAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GenerateUploadURLForEdgeFunctions200Response - */ - +/** GenerateUploadURLForEdgeFunctions200Response */ public class GenerateUploadURLForEdgeFunctions200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GenerateUploadURLForEdgeFunctionsAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GenerateUploadURLForEdgeFunctions200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GenerateUploadURLForEdgeFunctionsAlphaOutput data; - public GenerateUploadURLForEdgeFunctions200Response data(GenerateUploadURLForEdgeFunctionsAlphaOutput data) { - - this.data = data; - return this; - } + public GenerateUploadURLForEdgeFunctions200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GenerateUploadURLForEdgeFunctions200Response data( + GenerateUploadURLForEdgeFunctionsAlphaOutput data) { - public GenerateUploadURLForEdgeFunctionsAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GenerateUploadURLForEdgeFunctionsAlphaOutput getData() { + return data; + } - public void setData(GenerateUploadURLForEdgeFunctionsAlphaOutput data) { - this.data = data; - } + public void setData(GenerateUploadURLForEdgeFunctionsAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GenerateUploadURLForEdgeFunctions200Response generateUploadURLForEdgeFunctions200Response = + (GenerateUploadURLForEdgeFunctions200Response) o; + return Objects.equals(this.data, generateUploadURLForEdgeFunctions200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GenerateUploadURLForEdgeFunctions200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GenerateUploadURLForEdgeFunctions200Response generateUploadURLForEdgeFunctions200Response = (GenerateUploadURLForEdgeFunctions200Response) o; - return Objects.equals(this.data, generateUploadURLForEdgeFunctions200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GenerateUploadURLForEdgeFunctions200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GenerateUploadURLForEdgeFunctions200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GenerateUploadURLForEdgeFunctions200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GenerateUploadURLForEdgeFunctions200Response is not found in the empty JSON string", GenerateUploadURLForEdgeFunctions200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GenerateUploadURLForEdgeFunctions200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GenerateUploadURLForEdgeFunctions200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GenerateUploadURLForEdgeFunctions200Response is not found" + + " in the empty JSON string", + GenerateUploadURLForEdgeFunctions200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GenerateUploadURLForEdgeFunctions200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GenerateUploadURLForEdgeFunctions200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GenerateUploadURLForEdgeFunctions200Response.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GenerateUploadURLForEdgeFunctions200Response` 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()) { + GenerateUploadURLForEdgeFunctionsAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GenerateUploadURLForEdgeFunctions200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GenerateUploadURLForEdgeFunctions200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GenerateUploadURLForEdgeFunctions200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GenerateUploadURLForEdgeFunctions200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GenerateUploadURLForEdgeFunctions200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GenerateUploadURLForEdgeFunctions200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GenerateUploadURLForEdgeFunctions200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(GenerateUploadURLForEdgeFunctions200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GenerateUploadURLForEdgeFunctions200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GenerateUploadURLForEdgeFunctions200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GenerateUploadURLForEdgeFunctions200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GenerateUploadURLForEdgeFunctions200Response + * @throws IOException if the JSON string is invalid with respect to + * GenerateUploadURLForEdgeFunctions200Response + */ + public static GenerateUploadURLForEdgeFunctions200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GenerateUploadURLForEdgeFunctions200Response.class); } - } - - /** - * Create an instance of GenerateUploadURLForEdgeFunctions200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GenerateUploadURLForEdgeFunctions200Response - * @throws IOException if the JSON string is invalid with respect to GenerateUploadURLForEdgeFunctions200Response - */ - public static GenerateUploadURLForEdgeFunctions200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GenerateUploadURLForEdgeFunctions200Response.class); - } - - /** - * Convert an instance of GenerateUploadURLForEdgeFunctions200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GenerateUploadURLForEdgeFunctions200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GenerateUploadURLForEdgeFunctionsAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GenerateUploadURLForEdgeFunctionsAlphaOutput.java index e6e3929f..c6a0b3d6 100644 --- a/src/main/java/com/segment/publicapi/models/GenerateUploadURLForEdgeFunctionsAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/GenerateUploadURLForEdgeFunctionsAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,208 +9,216 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Output for GenerateSignedUrl. - */ -@ApiModel(description = "Output for GenerateSignedUrl.") - +/** Output for GenerateSignedUrl. */ public class GenerateUploadURLForEdgeFunctionsAlphaOutput { - public static final String SERIALIZED_NAME_UPLOAD_U_R_L = "uploadURL"; - @SerializedName(SERIALIZED_NAME_UPLOAD_U_R_L) - private String uploadURL; + public static final String SERIALIZED_NAME_UPLOAD_U_R_L = "uploadURL"; - public GenerateUploadURLForEdgeFunctionsAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_UPLOAD_U_R_L) + private String uploadURL; - public GenerateUploadURLForEdgeFunctionsAlphaOutput uploadURL(String uploadURL) { - - this.uploadURL = uploadURL; - return this; - } + public GenerateUploadURLForEdgeFunctionsAlphaOutput() {} - /** - * A temporary URL that can be used to upload your Edge Functions bundle. Expires in 15 minutes. - * @return uploadURL - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A temporary URL that can be used to upload your Edge Functions bundle. Expires in 15 minutes.") + public GenerateUploadURLForEdgeFunctionsAlphaOutput uploadURL(String uploadURL) { - public String getUploadURL() { - return uploadURL; - } + this.uploadURL = uploadURL; + return this; + } + /** + * A temporary URL that can be used to upload your Edge Functions bundle. Expires in 15 minutes. + * + * @return uploadURL + */ + @javax.annotation.Nonnull + public String getUploadURL() { + return uploadURL; + } - public void setUploadURL(String uploadURL) { - this.uploadURL = uploadURL; - } + public void setUploadURL(String uploadURL) { + this.uploadURL = uploadURL; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GenerateUploadURLForEdgeFunctionsAlphaOutput generateUploadURLForEdgeFunctionsAlphaOutput = + (GenerateUploadURLForEdgeFunctionsAlphaOutput) o; + return Objects.equals( + this.uploadURL, generateUploadURLForEdgeFunctionsAlphaOutput.uploadURL); + } + @Override + public int hashCode() { + return Objects.hash(uploadURL); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GenerateUploadURLForEdgeFunctionsAlphaOutput {\n"); + sb.append(" uploadURL: ").append(toIndentedString(uploadURL)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GenerateUploadURLForEdgeFunctionsAlphaOutput generateUploadURLForEdgeFunctionsAlphaOutput = (GenerateUploadURLForEdgeFunctionsAlphaOutput) o; - return Objects.equals(this.uploadURL, generateUploadURLForEdgeFunctionsAlphaOutput.uploadURL); - } - - @Override - public int hashCode() { - return Objects.hash(uploadURL); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GenerateUploadURLForEdgeFunctionsAlphaOutput {\n"); - sb.append(" uploadURL: ").append(toIndentedString(uploadURL)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("uploadURL"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("uploadURL"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("uploadURL"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("uploadURL"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GenerateUploadURLForEdgeFunctionsAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GenerateUploadURLForEdgeFunctionsAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GenerateUploadURLForEdgeFunctionsAlphaOutput is not found in the empty JSON string", GenerateUploadURLForEdgeFunctionsAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GenerateUploadURLForEdgeFunctionsAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GenerateUploadURLForEdgeFunctionsAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GenerateUploadURLForEdgeFunctionsAlphaOutput is not found" + + " in the empty JSON string", + GenerateUploadURLForEdgeFunctionsAlphaOutput.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GenerateUploadURLForEdgeFunctionsAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GenerateUploadURLForEdgeFunctionsAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GenerateUploadURLForEdgeFunctionsAlphaOutput.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GenerateUploadURLForEdgeFunctionsAlphaOutput` properties." + + " JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GenerateUploadURLForEdgeFunctionsAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + GenerateUploadURLForEdgeFunctionsAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("uploadURL").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `uploadURL` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("uploadURL").toString())); } - } - if (!jsonObj.get("uploadURL").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `uploadURL` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uploadURL").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GenerateUploadURLForEdgeFunctionsAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GenerateUploadURLForEdgeFunctionsAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GenerateUploadURLForEdgeFunctionsAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GenerateUploadURLForEdgeFunctionsAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GenerateUploadURLForEdgeFunctionsAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of GenerateUploadURLForEdgeFunctionsAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of GenerateUploadURLForEdgeFunctionsAlphaOutput - * @throws IOException if the JSON string is invalid with respect to GenerateUploadURLForEdgeFunctionsAlphaOutput - */ - public static GenerateUploadURLForEdgeFunctionsAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GenerateUploadURLForEdgeFunctionsAlphaOutput.class); - } - - /** - * Convert an instance of GenerateUploadURLForEdgeFunctionsAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GenerateUploadURLForEdgeFunctionsAlphaOutput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GenerateUploadURLForEdgeFunctionsAlphaOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(GenerateUploadURLForEdgeFunctionsAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GenerateUploadURLForEdgeFunctionsAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GenerateUploadURLForEdgeFunctionsAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GenerateUploadURLForEdgeFunctionsAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GenerateUploadURLForEdgeFunctionsAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * GenerateUploadURLForEdgeFunctionsAlphaOutput + */ + public static GenerateUploadURLForEdgeFunctionsAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GenerateUploadURLForEdgeFunctionsAlphaOutput.class); + } + + /** + * Convert an instance of GenerateUploadURLForEdgeFunctionsAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetActivationFromAudience200Response.java b/src/main/java/com/segment/publicapi/models/GetActivationFromAudience200Response.java new file mode 100644 index 00000000..1a3b4340 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetActivationFromAudience200Response.java @@ -0,0 +1,203 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetActivationFromAudience200Response */ +public class GetActivationFromAudience200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetActivationFromAudienceOutput data; + + public GetActivationFromAudience200Response() {} + + public GetActivationFromAudience200Response data(GetActivationFromAudienceOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetActivationFromAudienceOutput getData() { + return data; + } + + public void setData(GetActivationFromAudienceOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetActivationFromAudience200Response getActivationFromAudience200Response = + (GetActivationFromAudience200Response) o; + return Objects.equals(this.data, getActivationFromAudience200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetActivationFromAudience200Response {\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 + * GetActivationFromAudience200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetActivationFromAudience200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetActivationFromAudience200Response" + + " is not found in the empty JSON string", + GetActivationFromAudience200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetActivationFromAudience200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetActivationFromAudience200Response` 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()) { + GetActivationFromAudienceOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetActivationFromAudience200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetActivationFromAudience200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetActivationFromAudience200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetActivationFromAudience200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetActivationFromAudience200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetActivationFromAudience200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetActivationFromAudience200Response + * @throws IOException if the JSON string is invalid with respect to + * GetActivationFromAudience200Response + */ + public static GetActivationFromAudience200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetActivationFromAudience200Response.class); + } + + /** + * Convert an instance of GetActivationFromAudience200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetActivationFromAudienceOutput.java b/src/main/java/com/segment/publicapi/models/GetActivationFromAudienceOutput.java new file mode 100644 index 00000000..acb430b7 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetActivationFromAudienceOutput.java @@ -0,0 +1,208 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output for getting an activation from space and audience. */ +public class GetActivationFromAudienceOutput { + public static final String SERIALIZED_NAME_ACTIVATION = "activation"; + + @SerializedName(SERIALIZED_NAME_ACTIVATION) + private ActivationSummaryOutput activation; + + public GetActivationFromAudienceOutput() {} + + public GetActivationFromAudienceOutput activation(ActivationSummaryOutput activation) { + + this.activation = activation; + return this; + } + + /** + * Get activation + * + * @return activation + */ + @javax.annotation.Nonnull + public ActivationSummaryOutput getActivation() { + return activation; + } + + public void setActivation(ActivationSummaryOutput activation) { + this.activation = activation; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetActivationFromAudienceOutput getActivationFromAudienceOutput = + (GetActivationFromAudienceOutput) o; + return Objects.equals(this.activation, getActivationFromAudienceOutput.activation); + } + + @Override + public int hashCode() { + return Objects.hash(activation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetActivationFromAudienceOutput {\n"); + sb.append(" activation: ").append(toIndentedString(activation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("activation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("activation"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetActivationFromAudienceOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetActivationFromAudienceOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetActivationFromAudienceOutput is not" + + " found in the empty JSON string", + GetActivationFromAudienceOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetActivationFromAudienceOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetActivationFromAudienceOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetActivationFromAudienceOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `activation` + ActivationSummaryOutput.validateJsonElement(jsonObj.get("activation")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetActivationFromAudienceOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetActivationFromAudienceOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetActivationFromAudienceOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetActivationFromAudienceOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetActivationFromAudienceOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetActivationFromAudienceOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetActivationFromAudienceOutput + * @throws IOException if the JSON string is invalid with respect to + * GetActivationFromAudienceOutput + */ + public static GetActivationFromAudienceOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetActivationFromAudienceOutput.class); + } + + /** + * Convert an instance of GetActivationFromAudienceOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetAdvancedSyncScheduleFromWarehouse200Response.java b/src/main/java/com/segment/publicapi/models/GetAdvancedSyncScheduleFromWarehouse200Response.java index 57187c0d..d8703f24 100644 --- a/src/main/java/com/segment/publicapi/models/GetAdvancedSyncScheduleFromWarehouse200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetAdvancedSyncScheduleFromWarehouse200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,204 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetAdvancedSyncScheduleFromWarehouseV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetAdvancedSyncScheduleFromWarehouse200Response - */ - +/** GetAdvancedSyncScheduleFromWarehouse200Response */ public class GetAdvancedSyncScheduleFromWarehouse200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetAdvancedSyncScheduleFromWarehouseV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetAdvancedSyncScheduleFromWarehouse200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetAdvancedSyncScheduleFromWarehouseV1Output data; - public GetAdvancedSyncScheduleFromWarehouse200Response data(GetAdvancedSyncScheduleFromWarehouseV1Output data) { - - this.data = data; - return this; - } + public GetAdvancedSyncScheduleFromWarehouse200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetAdvancedSyncScheduleFromWarehouse200Response data( + GetAdvancedSyncScheduleFromWarehouseV1Output data) { - public GetAdvancedSyncScheduleFromWarehouseV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetAdvancedSyncScheduleFromWarehouseV1Output getData() { + return data; + } - public void setData(GetAdvancedSyncScheduleFromWarehouseV1Output data) { - this.data = data; - } + public void setData(GetAdvancedSyncScheduleFromWarehouseV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAdvancedSyncScheduleFromWarehouse200Response + getAdvancedSyncScheduleFromWarehouse200Response = + (GetAdvancedSyncScheduleFromWarehouse200Response) o; + return Objects.equals(this.data, getAdvancedSyncScheduleFromWarehouse200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAdvancedSyncScheduleFromWarehouse200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetAdvancedSyncScheduleFromWarehouse200Response getAdvancedSyncScheduleFromWarehouse200Response = (GetAdvancedSyncScheduleFromWarehouse200Response) o; - return Objects.equals(this.data, getAdvancedSyncScheduleFromWarehouse200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetAdvancedSyncScheduleFromWarehouse200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetAdvancedSyncScheduleFromWarehouse200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetAdvancedSyncScheduleFromWarehouse200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetAdvancedSyncScheduleFromWarehouse200Response is not found in the empty JSON string", GetAdvancedSyncScheduleFromWarehouse200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetAdvancedSyncScheduleFromWarehouse200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetAdvancedSyncScheduleFromWarehouse200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetAdvancedSyncScheduleFromWarehouse200Response is not" + + " found in the empty JSON string", + GetAdvancedSyncScheduleFromWarehouse200Response + .openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetAdvancedSyncScheduleFromWarehouse200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetAdvancedSyncScheduleFromWarehouse200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetAdvancedSyncScheduleFromWarehouse200Response.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetAdvancedSyncScheduleFromWarehouse200Response`" + + " 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()) { + GetAdvancedSyncScheduleFromWarehouseV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetAdvancedSyncScheduleFromWarehouse200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetAdvancedSyncScheduleFromWarehouse200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetAdvancedSyncScheduleFromWarehouse200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetAdvancedSyncScheduleFromWarehouse200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetAdvancedSyncScheduleFromWarehouse200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetAdvancedSyncScheduleFromWarehouse200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetAdvancedSyncScheduleFromWarehouse200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(GetAdvancedSyncScheduleFromWarehouse200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + GetAdvancedSyncScheduleFromWarehouse200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetAdvancedSyncScheduleFromWarehouse200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetAdvancedSyncScheduleFromWarehouse200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetAdvancedSyncScheduleFromWarehouse200Response + * @throws IOException if the JSON string is invalid with respect to + * GetAdvancedSyncScheduleFromWarehouse200Response + */ + public static GetAdvancedSyncScheduleFromWarehouse200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetAdvancedSyncScheduleFromWarehouse200Response.class); } - } - - /** - * Create an instance of GetAdvancedSyncScheduleFromWarehouse200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetAdvancedSyncScheduleFromWarehouse200Response - * @throws IOException if the JSON string is invalid with respect to GetAdvancedSyncScheduleFromWarehouse200Response - */ - public static GetAdvancedSyncScheduleFromWarehouse200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetAdvancedSyncScheduleFromWarehouse200Response.class); - } - - /** - * Convert an instance of GetAdvancedSyncScheduleFromWarehouse200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetAdvancedSyncScheduleFromWarehouse200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetAdvancedSyncScheduleFromWarehouseV1Output.java b/src/main/java/com/segment/publicapi/models/GetAdvancedSyncScheduleFromWarehouseV1Output.java index 907fb380..975eb4d2 100644 --- a/src/main/java/com/segment/publicapi/models/GetAdvancedSyncScheduleFromWarehouseV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetAdvancedSyncScheduleFromWarehouseV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,236 +9,242 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Schedule; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the advanced sync schedule for a Warehouse. - */ -@ApiModel(description = "Returns the advanced sync schedule for a Warehouse.") - +/** Returns the advanced sync schedule for a Warehouse. */ public class GetAdvancedSyncScheduleFromWarehouseV1Output { - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_SCHEDULE = "schedule"; - @SerializedName(SERIALIZED_NAME_SCHEDULE) - private Schedule schedule; + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public GetAdvancedSyncScheduleFromWarehouseV1Output() { - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public GetAdvancedSyncScheduleFromWarehouseV1Output enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public static final String SERIALIZED_NAME_SCHEDULE = "schedule"; - /** - * Indicates if an advanced sync schedule is enabled for this Warehouse. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Indicates if an advanced sync schedule is enabled for this Warehouse.") + @SerializedName(SERIALIZED_NAME_SCHEDULE) + private AdvancedWarehouseSyncScheduleV1Output schedule; - public Boolean getEnabled() { - return enabled; - } + public GetAdvancedSyncScheduleFromWarehouseV1Output() {} + public GetAdvancedSyncScheduleFromWarehouseV1Output enabled(Boolean enabled) { - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + this.enabled = enabled; + return this; + } + /** + * Indicates if an advanced sync schedule is enabled for this Warehouse. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } - public GetAdvancedSyncScheduleFromWarehouseV1Output schedule(Schedule schedule) { - - this.schedule = schedule; - return this; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - /** - * Get schedule - * @return schedule - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetAdvancedSyncScheduleFromWarehouseV1Output schedule( + AdvancedWarehouseSyncScheduleV1Output schedule) { - public Schedule getSchedule() { - return schedule; - } + this.schedule = schedule; + return this; + } + /** + * Get schedule + * + * @return schedule + */ + @javax.annotation.Nullable + public AdvancedWarehouseSyncScheduleV1Output getSchedule() { + return schedule; + } - public void setSchedule(Schedule schedule) { - this.schedule = schedule; - } + public void setSchedule(AdvancedWarehouseSyncScheduleV1Output schedule) { + this.schedule = schedule; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAdvancedSyncScheduleFromWarehouseV1Output getAdvancedSyncScheduleFromWarehouseV1Output = + (GetAdvancedSyncScheduleFromWarehouseV1Output) o; + return Objects.equals(this.enabled, getAdvancedSyncScheduleFromWarehouseV1Output.enabled) + && Objects.equals( + this.schedule, getAdvancedSyncScheduleFromWarehouseV1Output.schedule); + } + @Override + public int hashCode() { + return Objects.hash(enabled, schedule); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAdvancedSyncScheduleFromWarehouseV1Output {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" schedule: ").append(toIndentedString(schedule)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetAdvancedSyncScheduleFromWarehouseV1Output getAdvancedSyncScheduleFromWarehouseV1Output = (GetAdvancedSyncScheduleFromWarehouseV1Output) o; - return Objects.equals(this.enabled, getAdvancedSyncScheduleFromWarehouseV1Output.enabled) && - Objects.equals(this.schedule, getAdvancedSyncScheduleFromWarehouseV1Output.schedule); - } - - @Override - public int hashCode() { - return Objects.hash(enabled, schedule); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetAdvancedSyncScheduleFromWarehouseV1Output {\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" schedule: ").append(toIndentedString(schedule)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("enabled"); + openapiFields.add("schedule"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("enabled"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("enabled"); - openapiFields.add("schedule"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("enabled"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetAdvancedSyncScheduleFromWarehouseV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetAdvancedSyncScheduleFromWarehouseV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetAdvancedSyncScheduleFromWarehouseV1Output is not found in the empty JSON string", GetAdvancedSyncScheduleFromWarehouseV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetAdvancedSyncScheduleFromWarehouseV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetAdvancedSyncScheduleFromWarehouseV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetAdvancedSyncScheduleFromWarehouseV1Output is not found" + + " in the empty JSON string", + GetAdvancedSyncScheduleFromWarehouseV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetAdvancedSyncScheduleFromWarehouseV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetAdvancedSyncScheduleFromWarehouseV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetAdvancedSyncScheduleFromWarehouseV1Output.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetAdvancedSyncScheduleFromWarehouseV1Output` properties." + + " JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetAdvancedSyncScheduleFromWarehouseV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + GetAdvancedSyncScheduleFromWarehouseV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `schedule` + if (jsonObj.get("schedule") != null && !jsonObj.get("schedule").isJsonNull()) { + AdvancedWarehouseSyncScheduleV1Output.validateJsonElement(jsonObj.get("schedule")); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetAdvancedSyncScheduleFromWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetAdvancedSyncScheduleFromWarehouseV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetAdvancedSyncScheduleFromWarehouseV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetAdvancedSyncScheduleFromWarehouseV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetAdvancedSyncScheduleFromWarehouseV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetAdvancedSyncScheduleFromWarehouseV1Output.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetAdvancedSyncScheduleFromWarehouseV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(GetAdvancedSyncScheduleFromWarehouseV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetAdvancedSyncScheduleFromWarehouseV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetAdvancedSyncScheduleFromWarehouseV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetAdvancedSyncScheduleFromWarehouseV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetAdvancedSyncScheduleFromWarehouseV1Output + * @throws IOException if the JSON string is invalid with respect to + * GetAdvancedSyncScheduleFromWarehouseV1Output + */ + public static GetAdvancedSyncScheduleFromWarehouseV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetAdvancedSyncScheduleFromWarehouseV1Output.class); } - } - - /** - * Create an instance of GetAdvancedSyncScheduleFromWarehouseV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetAdvancedSyncScheduleFromWarehouseV1Output - * @throws IOException if the JSON string is invalid with respect to GetAdvancedSyncScheduleFromWarehouseV1Output - */ - public static GetAdvancedSyncScheduleFromWarehouseV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetAdvancedSyncScheduleFromWarehouseV1Output.class); - } - - /** - * Convert an instance of GetAdvancedSyncScheduleFromWarehouseV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetAdvancedSyncScheduleFromWarehouseV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetAudience200Response.java b/src/main/java/com/segment/publicapi/models/GetAudience200Response.java new file mode 100644 index 00000000..5aa99d79 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetAudience200Response.java @@ -0,0 +1,193 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetAudience200Response */ +public class GetAudience200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetAudienceBetaOutput data; + + public GetAudience200Response() {} + + public GetAudience200Response data(GetAudienceBetaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetAudienceBetaOutput getData() { + return data; + } + + public void setData(GetAudienceBetaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAudience200Response getAudience200Response = (GetAudience200Response) o; + return Objects.equals(this.data, getAudience200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAudience200Response {\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 GetAudience200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetAudience200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetAudience200Response is not found in" + + " the empty JSON string", + GetAudience200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetAudience200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetAudience200Response` 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()) { + GetAudienceBetaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetAudience200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetAudience200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetAudience200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetAudience200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetAudience200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetAudience200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetAudience200Response + * @throws IOException if the JSON string is invalid with respect to GetAudience200Response + */ + public static GetAudience200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetAudience200Response.class); + } + + /** + * Convert an instance of GetAudience200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetAudience200Response1.java b/src/main/java/com/segment/publicapi/models/GetAudience200Response1.java new file mode 100644 index 00000000..76dfcb8c --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetAudience200Response1.java @@ -0,0 +1,194 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetAudience200Response1 */ +public class GetAudience200Response1 { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetAudienceAlphaOutput data; + + public GetAudience200Response1() {} + + public GetAudience200Response1 data(GetAudienceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetAudienceAlphaOutput getData() { + return data; + } + + public void setData(GetAudienceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAudience200Response1 getAudience200Response1 = (GetAudience200Response1) o; + return Objects.equals(this.data, getAudience200Response1.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAudience200Response1 {\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 GetAudience200Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetAudience200Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetAudience200Response1 is not found" + + " in the empty JSON string", + GetAudience200Response1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetAudience200Response1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetAudience200Response1` 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()) { + GetAudienceAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetAudience200Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetAudience200Response1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetAudience200Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetAudience200Response1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetAudience200Response1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetAudience200Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetAudience200Response1 + * @throws IOException if the JSON string is invalid with respect to GetAudience200Response1 + */ + public static GetAudience200Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetAudience200Response1.class); + } + + /** + * Convert an instance of GetAudience200Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetAudienceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GetAudienceAlphaOutput.java new file mode 100644 index 00000000..10e9179d --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetAudienceAlphaOutput.java @@ -0,0 +1,202 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Audience output for get. */ +public class GetAudienceAlphaOutput { + public static final String SERIALIZED_NAME_AUDIENCE = "audience"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE) + private AudienceSummaryWithAudienceTypeAndLookback audience; + + public GetAudienceAlphaOutput() {} + + public GetAudienceAlphaOutput audience(AudienceSummaryWithAudienceTypeAndLookback audience) { + + this.audience = audience; + return this; + } + + /** + * Get audience + * + * @return audience + */ + @javax.annotation.Nonnull + public AudienceSummaryWithAudienceTypeAndLookback getAudience() { + return audience; + } + + public void setAudience(AudienceSummaryWithAudienceTypeAndLookback audience) { + this.audience = audience; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAudienceAlphaOutput getAudienceAlphaOutput = (GetAudienceAlphaOutput) o; + return Objects.equals(this.audience, getAudienceAlphaOutput.audience); + } + + @Override + public int hashCode() { + return Objects.hash(audience); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAudienceAlphaOutput {\n"); + sb.append(" audience: ").append(toIndentedString(audience)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("audience"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("audience"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetAudienceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetAudienceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetAudienceAlphaOutput is not found in" + + " the empty JSON string", + GetAudienceAlphaOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetAudienceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetAudienceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetAudienceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `audience` + AudienceSummaryWithAudienceTypeAndLookback.validateJsonElement(jsonObj.get("audience")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetAudienceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetAudienceAlphaOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetAudienceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetAudienceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetAudienceAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetAudienceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetAudienceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to GetAudienceAlphaOutput + */ + public static GetAudienceAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetAudienceAlphaOutput.class); + } + + /** + * Convert an instance of GetAudienceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetAudienceBetaOutput.java b/src/main/java/com/segment/publicapi/models/GetAudienceBetaOutput.java new file mode 100644 index 00000000..0ff36009 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetAudienceBetaOutput.java @@ -0,0 +1,202 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Audience output for get. */ +public class GetAudienceBetaOutput { + public static final String SERIALIZED_NAME_AUDIENCE = "audience"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE) + private AudienceSummaryWithAudienceTypeAndLookback audience; + + public GetAudienceBetaOutput() {} + + public GetAudienceBetaOutput audience(AudienceSummaryWithAudienceTypeAndLookback audience) { + + this.audience = audience; + return this; + } + + /** + * Get audience + * + * @return audience + */ + @javax.annotation.Nonnull + public AudienceSummaryWithAudienceTypeAndLookback getAudience() { + return audience; + } + + public void setAudience(AudienceSummaryWithAudienceTypeAndLookback audience) { + this.audience = audience; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAudienceBetaOutput getAudienceBetaOutput = (GetAudienceBetaOutput) o; + return Objects.equals(this.audience, getAudienceBetaOutput.audience); + } + + @Override + public int hashCode() { + return Objects.hash(audience); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAudienceBetaOutput {\n"); + sb.append(" audience: ").append(toIndentedString(audience)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("audience"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("audience"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetAudienceBetaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetAudienceBetaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetAudienceBetaOutput is not found in" + + " the empty JSON string", + GetAudienceBetaOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetAudienceBetaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetAudienceBetaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetAudienceBetaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `audience` + AudienceSummaryWithAudienceTypeAndLookback.validateJsonElement(jsonObj.get("audience")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetAudienceBetaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetAudienceBetaOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetAudienceBetaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetAudienceBetaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetAudienceBetaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetAudienceBetaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetAudienceBetaOutput + * @throws IOException if the JSON string is invalid with respect to GetAudienceBetaOutput + */ + public static GetAudienceBetaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetAudienceBetaOutput.class); + } + + /** + * Convert an instance of GetAudienceBetaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetAudiencePreview200Response.java b/src/main/java/com/segment/publicapi/models/GetAudiencePreview200Response.java new file mode 100644 index 00000000..e5b85f5b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetAudiencePreview200Response.java @@ -0,0 +1,199 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetAudiencePreview200Response */ +public class GetAudiencePreview200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetAudiencePreviewAlphaOutput data; + + public GetAudiencePreview200Response() {} + + public GetAudiencePreview200Response data(GetAudiencePreviewAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetAudiencePreviewAlphaOutput getData() { + return data; + } + + public void setData(GetAudiencePreviewAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAudiencePreview200Response getAudiencePreview200Response = + (GetAudiencePreview200Response) o; + return Objects.equals(this.data, getAudiencePreview200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAudiencePreview200Response {\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 + * GetAudiencePreview200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetAudiencePreview200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetAudiencePreview200Response is not" + + " found in the empty JSON string", + GetAudiencePreview200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetAudiencePreview200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetAudiencePreview200Response` 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()) { + GetAudiencePreviewAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetAudiencePreview200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetAudiencePreview200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetAudiencePreview200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetAudiencePreview200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetAudiencePreview200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetAudiencePreview200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetAudiencePreview200Response + * @throws IOException if the JSON string is invalid with respect to + * GetAudiencePreview200Response + */ + public static GetAudiencePreview200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetAudiencePreview200Response.class); + } + + /** + * Convert an instance of GetAudiencePreview200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetAudiencePreviewAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GetAudiencePreviewAlphaOutput.java new file mode 100644 index 00000000..91363b74 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetAudiencePreviewAlphaOutput.java @@ -0,0 +1,208 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output when reading an audience preview. */ +public class GetAudiencePreviewAlphaOutput { + public static final String SERIALIZED_NAME_AUDIENCE_PREVIEW = "audiencePreview"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE_PREVIEW) + private AudiencePreview audiencePreview; + + public GetAudiencePreviewAlphaOutput() {} + + public GetAudiencePreviewAlphaOutput audiencePreview(AudiencePreview audiencePreview) { + + this.audiencePreview = audiencePreview; + return this; + } + + /** + * Get audiencePreview + * + * @return audiencePreview + */ + @javax.annotation.Nonnull + public AudiencePreview getAudiencePreview() { + return audiencePreview; + } + + public void setAudiencePreview(AudiencePreview audiencePreview) { + this.audiencePreview = audiencePreview; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAudiencePreviewAlphaOutput getAudiencePreviewAlphaOutput = + (GetAudiencePreviewAlphaOutput) o; + return Objects.equals(this.audiencePreview, getAudiencePreviewAlphaOutput.audiencePreview); + } + + @Override + public int hashCode() { + return Objects.hash(audiencePreview); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAudiencePreviewAlphaOutput {\n"); + sb.append(" audiencePreview: ").append(toIndentedString(audiencePreview)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("audiencePreview"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("audiencePreview"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetAudiencePreviewAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetAudiencePreviewAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetAudiencePreviewAlphaOutput is not" + + " found in the empty JSON string", + GetAudiencePreviewAlphaOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetAudiencePreviewAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetAudiencePreviewAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetAudiencePreviewAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `audiencePreview` + AudiencePreview.validateJsonElement(jsonObj.get("audiencePreview")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetAudiencePreviewAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetAudiencePreviewAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetAudiencePreviewAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetAudiencePreviewAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetAudiencePreviewAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetAudiencePreviewAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetAudiencePreviewAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * GetAudiencePreviewAlphaOutput + */ + public static GetAudiencePreviewAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetAudiencePreviewAlphaOutput.class); + } + + /** + * Convert an instance of GetAudiencePreviewAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetAudienceScheduleFromSpaceAndAudience200Response.java b/src/main/java/com/segment/publicapi/models/GetAudienceScheduleFromSpaceAndAudience200Response.java new file mode 100644 index 00000000..22661112 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetAudienceScheduleFromSpaceAndAudience200Response.java @@ -0,0 +1,215 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetAudienceScheduleFromSpaceAndAudience200Response */ +public class GetAudienceScheduleFromSpaceAndAudience200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetAudienceScheduleFromSpaceAndAudienceAlphaOutput data; + + public GetAudienceScheduleFromSpaceAndAudience200Response() {} + + public GetAudienceScheduleFromSpaceAndAudience200Response data( + GetAudienceScheduleFromSpaceAndAudienceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetAudienceScheduleFromSpaceAndAudienceAlphaOutput getData() { + return data; + } + + public void setData(GetAudienceScheduleFromSpaceAndAudienceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAudienceScheduleFromSpaceAndAudience200Response + getAudienceScheduleFromSpaceAndAudience200Response = + (GetAudienceScheduleFromSpaceAndAudience200Response) o; + return Objects.equals(this.data, getAudienceScheduleFromSpaceAndAudience200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAudienceScheduleFromSpaceAndAudience200Response {\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 + * GetAudienceScheduleFromSpaceAndAudience200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetAudienceScheduleFromSpaceAndAudience200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetAudienceScheduleFromSpaceAndAudience200Response is not" + + " found in the empty JSON string", + GetAudienceScheduleFromSpaceAndAudience200Response + .openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetAudienceScheduleFromSpaceAndAudience200Response.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetAudienceScheduleFromSpaceAndAudience200Response`" + + " 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()) { + GetAudienceScheduleFromSpaceAndAudienceAlphaOutput.validateJsonElement( + jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetAudienceScheduleFromSpaceAndAudience200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetAudienceScheduleFromSpaceAndAudience200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetAudienceScheduleFromSpaceAndAudience200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + GetAudienceScheduleFromSpaceAndAudience200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetAudienceScheduleFromSpaceAndAudience200Response read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetAudienceScheduleFromSpaceAndAudience200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetAudienceScheduleFromSpaceAndAudience200Response + * @throws IOException if the JSON string is invalid with respect to + * GetAudienceScheduleFromSpaceAndAudience200Response + */ + public static GetAudienceScheduleFromSpaceAndAudience200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetAudienceScheduleFromSpaceAndAudience200Response.class); + } + + /** + * Convert an instance of GetAudienceScheduleFromSpaceAndAudience200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetAudienceScheduleFromSpaceAndAudienceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GetAudienceScheduleFromSpaceAndAudienceAlphaOutput.java new file mode 100644 index 00000000..44f75ed2 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetAudienceScheduleFromSpaceAndAudienceAlphaOutput.java @@ -0,0 +1,226 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output for get audience schedule. */ +public class GetAudienceScheduleFromSpaceAndAudienceAlphaOutput { + public static final String SERIALIZED_NAME_AUDIENCE_SCHEDULE = "audienceSchedule"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE_SCHEDULE) + private AudienceSchedule audienceSchedule; + + public GetAudienceScheduleFromSpaceAndAudienceAlphaOutput() {} + + public GetAudienceScheduleFromSpaceAndAudienceAlphaOutput audienceSchedule( + AudienceSchedule audienceSchedule) { + + this.audienceSchedule = audienceSchedule; + return this; + } + + /** + * Get audienceSchedule + * + * @return audienceSchedule + */ + @javax.annotation.Nonnull + public AudienceSchedule getAudienceSchedule() { + return audienceSchedule; + } + + public void setAudienceSchedule(AudienceSchedule audienceSchedule) { + this.audienceSchedule = audienceSchedule; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAudienceScheduleFromSpaceAndAudienceAlphaOutput + getAudienceScheduleFromSpaceAndAudienceAlphaOutput = + (GetAudienceScheduleFromSpaceAndAudienceAlphaOutput) o; + return Objects.equals( + this.audienceSchedule, + getAudienceScheduleFromSpaceAndAudienceAlphaOutput.audienceSchedule); + } + + @Override + public int hashCode() { + return Objects.hash(audienceSchedule); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAudienceScheduleFromSpaceAndAudienceAlphaOutput {\n"); + sb.append(" audienceSchedule: ").append(toIndentedString(audienceSchedule)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("audienceSchedule"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("audienceSchedule"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetAudienceScheduleFromSpaceAndAudienceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetAudienceScheduleFromSpaceAndAudienceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetAudienceScheduleFromSpaceAndAudienceAlphaOutput is not" + + " found in the empty JSON string", + GetAudienceScheduleFromSpaceAndAudienceAlphaOutput + .openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetAudienceScheduleFromSpaceAndAudienceAlphaOutput.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetAudienceScheduleFromSpaceAndAudienceAlphaOutput`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + GetAudienceScheduleFromSpaceAndAudienceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `audienceSchedule` + AudienceSchedule.validateJsonElement(jsonObj.get("audienceSchedule")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetAudienceScheduleFromSpaceAndAudienceAlphaOutput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetAudienceScheduleFromSpaceAndAudienceAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetAudienceScheduleFromSpaceAndAudienceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + GetAudienceScheduleFromSpaceAndAudienceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetAudienceScheduleFromSpaceAndAudienceAlphaOutput read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetAudienceScheduleFromSpaceAndAudienceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetAudienceScheduleFromSpaceAndAudienceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * GetAudienceScheduleFromSpaceAndAudienceAlphaOutput + */ + public static GetAudienceScheduleFromSpaceAndAudienceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetAudienceScheduleFromSpaceAndAudienceAlphaOutput.class); + } + + /** + * Convert an instance of GetAudienceScheduleFromSpaceAndAudienceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetComputedTrait200Response.java b/src/main/java/com/segment/publicapi/models/GetComputedTrait200Response.java new file mode 100644 index 00000000..7444d45a --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetComputedTrait200Response.java @@ -0,0 +1,195 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetComputedTrait200Response */ +public class GetComputedTrait200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetComputedTraitAlphaOutput data; + + public GetComputedTrait200Response() {} + + public GetComputedTrait200Response data(GetComputedTraitAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetComputedTraitAlphaOutput getData() { + return data; + } + + public void setData(GetComputedTraitAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetComputedTrait200Response getComputedTrait200Response = (GetComputedTrait200Response) o; + return Objects.equals(this.data, getComputedTrait200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetComputedTrait200Response {\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 + * GetComputedTrait200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetComputedTrait200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetComputedTrait200Response is not" + + " found in the empty JSON string", + GetComputedTrait200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetComputedTrait200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetComputedTrait200Response` 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()) { + GetComputedTraitAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetComputedTrait200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetComputedTrait200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetComputedTrait200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetComputedTrait200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetComputedTrait200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetComputedTrait200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetComputedTrait200Response + * @throws IOException if the JSON string is invalid with respect to GetComputedTrait200Response + */ + public static GetComputedTrait200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetComputedTrait200Response.class); + } + + /** + * Convert an instance of GetComputedTrait200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetComputedTraitAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GetComputedTraitAlphaOutput.java new file mode 100644 index 00000000..78d2e5ae --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetComputedTraitAlphaOutput.java @@ -0,0 +1,204 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Computed Trait output for get and update. */ +public class GetComputedTraitAlphaOutput { + public static final String SERIALIZED_NAME_COMPUTED_TRAIT = "computedTrait"; + + @SerializedName(SERIALIZED_NAME_COMPUTED_TRAIT) + private ComputedTraitSummary computedTrait; + + public GetComputedTraitAlphaOutput() {} + + public GetComputedTraitAlphaOutput computedTrait(ComputedTraitSummary computedTrait) { + + this.computedTrait = computedTrait; + return this; + } + + /** + * Get computedTrait + * + * @return computedTrait + */ + @javax.annotation.Nonnull + public ComputedTraitSummary getComputedTrait() { + return computedTrait; + } + + public void setComputedTrait(ComputedTraitSummary computedTrait) { + this.computedTrait = computedTrait; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetComputedTraitAlphaOutput getComputedTraitAlphaOutput = (GetComputedTraitAlphaOutput) o; + return Objects.equals(this.computedTrait, getComputedTraitAlphaOutput.computedTrait); + } + + @Override + public int hashCode() { + return Objects.hash(computedTrait); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetComputedTraitAlphaOutput {\n"); + sb.append(" computedTrait: ").append(toIndentedString(computedTrait)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("computedTrait"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("computedTrait"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetComputedTraitAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetComputedTraitAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetComputedTraitAlphaOutput is not" + + " found in the empty JSON string", + GetComputedTraitAlphaOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetComputedTraitAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetComputedTraitAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetComputedTraitAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `computedTrait` + ComputedTraitSummary.validateJsonElement(jsonObj.get("computedTrait")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetComputedTraitAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetComputedTraitAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetComputedTraitAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetComputedTraitAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetComputedTraitAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetComputedTraitAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetComputedTraitAlphaOutput + * @throws IOException if the JSON string is invalid with respect to GetComputedTraitAlphaOutput + */ + public static GetComputedTraitAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetComputedTraitAlphaOutput.class); + } + + /** + * Convert an instance of GetComputedTraitAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetConnectionStateFromWarehouse200Response.java b/src/main/java/com/segment/publicapi/models/GetConnectionStateFromWarehouse200Response.java index 8a3f2773..7e3e1625 100644 --- a/src/main/java/com/segment/publicapi/models/GetConnectionStateFromWarehouse200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetConnectionStateFromWarehouse200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,200 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetConnectionStateFromWarehouseV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetConnectionStateFromWarehouse200Response - */ - +/** GetConnectionStateFromWarehouse200Response */ public class GetConnectionStateFromWarehouse200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetConnectionStateFromWarehouseV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetConnectionStateFromWarehouse200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetConnectionStateFromWarehouseV1Output data; - public GetConnectionStateFromWarehouse200Response data(GetConnectionStateFromWarehouseV1Output data) { - - this.data = data; - return this; - } + public GetConnectionStateFromWarehouse200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetConnectionStateFromWarehouse200Response data( + GetConnectionStateFromWarehouseV1Output data) { - public GetConnectionStateFromWarehouseV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetConnectionStateFromWarehouseV1Output getData() { + return data; + } - public void setData(GetConnectionStateFromWarehouseV1Output data) { - this.data = data; - } + public void setData(GetConnectionStateFromWarehouseV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetConnectionStateFromWarehouse200Response getConnectionStateFromWarehouse200Response = + (GetConnectionStateFromWarehouse200Response) o; + return Objects.equals(this.data, getConnectionStateFromWarehouse200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetConnectionStateFromWarehouse200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetConnectionStateFromWarehouse200Response getConnectionStateFromWarehouse200Response = (GetConnectionStateFromWarehouse200Response) o; - return Objects.equals(this.data, getConnectionStateFromWarehouse200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetConnectionStateFromWarehouse200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetConnectionStateFromWarehouse200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetConnectionStateFromWarehouse200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetConnectionStateFromWarehouse200Response is not found in the empty JSON string", GetConnectionStateFromWarehouse200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetConnectionStateFromWarehouse200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetConnectionStateFromWarehouse200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetConnectionStateFromWarehouse200Response is not found in" + + " the empty JSON string", + GetConnectionStateFromWarehouse200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetConnectionStateFromWarehouse200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetConnectionStateFromWarehouse200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetConnectionStateFromWarehouse200Response.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetConnectionStateFromWarehouse200Response` 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()) { + GetConnectionStateFromWarehouseV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetConnectionStateFromWarehouse200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetConnectionStateFromWarehouse200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetConnectionStateFromWarehouse200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetConnectionStateFromWarehouse200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetConnectionStateFromWarehouse200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetConnectionStateFromWarehouse200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetConnectionStateFromWarehouse200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetConnectionStateFromWarehouse200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetConnectionStateFromWarehouse200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetConnectionStateFromWarehouse200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetConnectionStateFromWarehouse200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetConnectionStateFromWarehouse200Response + * @throws IOException if the JSON string is invalid with respect to + * GetConnectionStateFromWarehouse200Response + */ + public static GetConnectionStateFromWarehouse200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetConnectionStateFromWarehouse200Response.class); } - } - - /** - * Create an instance of GetConnectionStateFromWarehouse200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetConnectionStateFromWarehouse200Response - * @throws IOException if the JSON string is invalid with respect to GetConnectionStateFromWarehouse200Response - */ - public static GetConnectionStateFromWarehouse200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetConnectionStateFromWarehouse200Response.class); - } - - /** - * Convert an instance of GetConnectionStateFromWarehouse200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetConnectionStateFromWarehouse200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetConnectionStateFromWarehouseV1Output.java b/src/main/java/com/segment/publicapi/models/GetConnectionStateFromWarehouseV1Output.java index c618c3f9..d75679e6 100644 --- a/src/main/java/com/segment/publicapi/models/GetConnectionStateFromWarehouseV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetConnectionStateFromWarehouseV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,255 +9,260 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Returns the status of a Warehouse connection settings after an attempt to connect to it. */ +public class GetConnectionStateFromWarehouseV1Output { + /** Represents the status for the current connection settings. */ + @JsonAdapter(ConnectionStateEnum.Adapter.class) + public enum ConnectionStateEnum { + CONNECTED("CONNECTED"), -/** - * Returns the status of a Warehouse connection settings after an attempt to connect to it. - */ -@ApiModel(description = "Returns the status of a Warehouse connection settings after an attempt to connect to it.") + FAILED("FAILED"); -public class GetConnectionStateFromWarehouseV1Output { - /** - * Represents the status for the current connection settings. - */ - @JsonAdapter(ConnectionStateEnum.Adapter.class) - public enum ConnectionStateEnum { - CONNECTED("CONNECTED"), - - FAILED("FAILED"); - - private String value; - - ConnectionStateEnum(String value) { - this.value = value; - } + private String value; - public String getValue() { - return value; - } + ConnectionStateEnum(String value) { + this.value = value; + } - @Override - public String toString() { - return String.valueOf(value); - } + public String getValue() { + return value; + } - public static ConnectionStateEnum fromValue(String value) { - for (ConnectionStateEnum b : ConnectionStateEnum.values()) { - if (b.value.equals(value)) { - return b; + @Override + public String toString() { + return String.valueOf(value); + } + + public static ConnectionStateEnum fromValue(String value) { + for (ConnectionStateEnum b : ConnectionStateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final ConnectionStateEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ConnectionStateEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return ConnectionStateEnum.fromValue(value); - } + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ConnectionStateEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ConnectionStateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ConnectionStateEnum.fromValue(value); + } + } } - } - public static final String SERIALIZED_NAME_CONNECTION_STATE = "connectionState"; - @SerializedName(SERIALIZED_NAME_CONNECTION_STATE) - private ConnectionStateEnum connectionState; + public static final String SERIALIZED_NAME_CONNECTION_STATE = "connectionState"; - public GetConnectionStateFromWarehouseV1Output() { - } + @SerializedName(SERIALIZED_NAME_CONNECTION_STATE) + private ConnectionStateEnum connectionState; - public GetConnectionStateFromWarehouseV1Output connectionState(ConnectionStateEnum connectionState) { - - this.connectionState = connectionState; - return this; - } + public GetConnectionStateFromWarehouseV1Output() {} - /** - * Represents the status for the current connection settings. - * @return connectionState - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Represents the status for the current connection settings.") + public GetConnectionStateFromWarehouseV1Output connectionState( + ConnectionStateEnum connectionState) { - public ConnectionStateEnum getConnectionState() { - return connectionState; - } + this.connectionState = connectionState; + return this; + } + /** + * Represents the status for the current connection settings. + * + * @return connectionState + */ + @javax.annotation.Nonnull + public ConnectionStateEnum getConnectionState() { + return connectionState; + } - public void setConnectionState(ConnectionStateEnum connectionState) { - this.connectionState = connectionState; - } + public void setConnectionState(ConnectionStateEnum connectionState) { + this.connectionState = connectionState; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetConnectionStateFromWarehouseV1Output getConnectionStateFromWarehouseV1Output = + (GetConnectionStateFromWarehouseV1Output) o; + return Objects.equals( + this.connectionState, getConnectionStateFromWarehouseV1Output.connectionState); + } + @Override + public int hashCode() { + return Objects.hash(connectionState); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetConnectionStateFromWarehouseV1Output {\n"); + sb.append(" connectionState: ").append(toIndentedString(connectionState)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetConnectionStateFromWarehouseV1Output getConnectionStateFromWarehouseV1Output = (GetConnectionStateFromWarehouseV1Output) o; - return Objects.equals(this.connectionState, getConnectionStateFromWarehouseV1Output.connectionState); - } - - @Override - public int hashCode() { - return Objects.hash(connectionState); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetConnectionStateFromWarehouseV1Output {\n"); - sb.append(" connectionState: ").append(toIndentedString(connectionState)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("connectionState"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("connectionState"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("connectionState"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("connectionState"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetConnectionStateFromWarehouseV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetConnectionStateFromWarehouseV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetConnectionStateFromWarehouseV1Output is not found in the empty JSON string", GetConnectionStateFromWarehouseV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetConnectionStateFromWarehouseV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetConnectionStateFromWarehouseV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetConnectionStateFromWarehouseV1Output is not found in the" + + " empty JSON string", + GetConnectionStateFromWarehouseV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetConnectionStateFromWarehouseV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetConnectionStateFromWarehouseV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetConnectionStateFromWarehouseV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetConnectionStateFromWarehouseV1Output` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetConnectionStateFromWarehouseV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetConnectionStateFromWarehouseV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("connectionState").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `connectionState` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("connectionState").toString())); } - } - if (!jsonObj.get("connectionState").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `connectionState` to be a primitive type in the JSON string but got `%s`", jsonObj.get("connectionState").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetConnectionStateFromWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetConnectionStateFromWarehouseV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetConnectionStateFromWarehouseV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetConnectionStateFromWarehouseV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetConnectionStateFromWarehouseV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of GetConnectionStateFromWarehouseV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetConnectionStateFromWarehouseV1Output - * @throws IOException if the JSON string is invalid with respect to GetConnectionStateFromWarehouseV1Output - */ - public static GetConnectionStateFromWarehouseV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetConnectionStateFromWarehouseV1Output.class); - } - - /** - * Convert an instance of GetConnectionStateFromWarehouseV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetConnectionStateFromWarehouseV1Output.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'GetConnectionStateFromWarehouseV1Output' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetConnectionStateFromWarehouseV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetConnectionStateFromWarehouseV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetConnectionStateFromWarehouseV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetConnectionStateFromWarehouseV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetConnectionStateFromWarehouseV1Output + * @throws IOException if the JSON string is invalid with respect to + * GetConnectionStateFromWarehouseV1Output + */ + public static GetConnectionStateFromWarehouseV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetConnectionStateFromWarehouseV1Output.class); + } + + /** + * Convert an instance of GetConnectionStateFromWarehouseV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDailyPerSourceAPICallsUsage200Response.java b/src/main/java/com/segment/publicapi/models/GetDailyPerSourceAPICallsUsage200Response.java index 88b44ff0..862ea102 100644 --- a/src/main/java/com/segment/publicapi/models/GetDailyPerSourceAPICallsUsage200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetDailyPerSourceAPICallsUsage200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,198 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetDailyPerSourceAPICallsUsageV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetDailyPerSourceAPICallsUsage200Response - */ - +/** GetDailyPerSourceAPICallsUsage200Response */ public class GetDailyPerSourceAPICallsUsage200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetDailyPerSourceAPICallsUsageV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetDailyPerSourceAPICallsUsage200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetDailyPerSourceAPICallsUsageV1Output data; - public GetDailyPerSourceAPICallsUsage200Response data(GetDailyPerSourceAPICallsUsageV1Output data) { - - this.data = data; - return this; - } + public GetDailyPerSourceAPICallsUsage200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetDailyPerSourceAPICallsUsage200Response data( + GetDailyPerSourceAPICallsUsageV1Output data) { - public GetDailyPerSourceAPICallsUsageV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetDailyPerSourceAPICallsUsageV1Output getData() { + return data; + } - public void setData(GetDailyPerSourceAPICallsUsageV1Output data) { - this.data = data; - } + public void setData(GetDailyPerSourceAPICallsUsageV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDailyPerSourceAPICallsUsage200Response getDailyPerSourceAPICallsUsage200Response = + (GetDailyPerSourceAPICallsUsage200Response) o; + return Objects.equals(this.data, getDailyPerSourceAPICallsUsage200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDailyPerSourceAPICallsUsage200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDailyPerSourceAPICallsUsage200Response getDailyPerSourceAPICallsUsage200Response = (GetDailyPerSourceAPICallsUsage200Response) o; - return Objects.equals(this.data, getDailyPerSourceAPICallsUsage200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDailyPerSourceAPICallsUsage200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDailyPerSourceAPICallsUsage200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDailyPerSourceAPICallsUsage200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDailyPerSourceAPICallsUsage200Response is not found in the empty JSON string", GetDailyPerSourceAPICallsUsage200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDailyPerSourceAPICallsUsage200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDailyPerSourceAPICallsUsage200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetDailyPerSourceAPICallsUsage200Response is not found in" + + " the empty JSON string", + GetDailyPerSourceAPICallsUsage200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDailyPerSourceAPICallsUsage200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDailyPerSourceAPICallsUsage200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDailyPerSourceAPICallsUsage200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDailyPerSourceAPICallsUsage200Response` 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()) { + GetDailyPerSourceAPICallsUsageV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDailyPerSourceAPICallsUsage200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDailyPerSourceAPICallsUsage200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDailyPerSourceAPICallsUsage200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDailyPerSourceAPICallsUsage200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDailyPerSourceAPICallsUsage200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDailyPerSourceAPICallsUsage200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetDailyPerSourceAPICallsUsage200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDailyPerSourceAPICallsUsage200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetDailyPerSourceAPICallsUsage200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDailyPerSourceAPICallsUsage200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDailyPerSourceAPICallsUsage200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDailyPerSourceAPICallsUsage200Response + * @throws IOException if the JSON string is invalid with respect to + * GetDailyPerSourceAPICallsUsage200Response + */ + public static GetDailyPerSourceAPICallsUsage200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetDailyPerSourceAPICallsUsage200Response.class); } - } - - /** - * Create an instance of GetDailyPerSourceAPICallsUsage200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDailyPerSourceAPICallsUsage200Response - * @throws IOException if the JSON string is invalid with respect to GetDailyPerSourceAPICallsUsage200Response - */ - public static GetDailyPerSourceAPICallsUsage200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDailyPerSourceAPICallsUsage200Response.class); - } - - /** - * Convert an instance of GetDailyPerSourceAPICallsUsage200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDailyPerSourceAPICallsUsage200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDailyPerSourceAPICallsUsageV1Output.java b/src/main/java/com/segment/publicapi/models/GetDailyPerSourceAPICallsUsageV1Output.java index 9b5867f0..c2646498 100644 --- a/src/main/java/com/segment/publicapi/models/GetDailyPerSourceAPICallsUsageV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetDailyPerSourceAPICallsUsageV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,251 +9,270 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Pagination; -import com.segment.publicapi.models.SourceAPICallSnapshotV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a list of daily aggregations of Source level API calls counts. - */ -@ApiModel(description = "Returns a list of daily aggregations of Source level API calls counts.") - +/** Returns a list of daily aggregations of Source level API calls counts. */ public class GetDailyPerSourceAPICallsUsageV1Output { - public static final String SERIALIZED_NAME_DAILY_PER_SOURCE_A_P_I_CALLS_USAGE = "dailyPerSourceAPICallsUsage"; - @SerializedName(SERIALIZED_NAME_DAILY_PER_SOURCE_A_P_I_CALLS_USAGE) - private List dailyPerSourceAPICallsUsage = new ArrayList<>(); + public static final String SERIALIZED_NAME_DAILY_PER_SOURCE_A_P_I_CALLS_USAGE = + "dailyPerSourceAPICallsUsage"; - public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - @SerializedName(SERIALIZED_NAME_PAGINATION) - private Pagination pagination; + @SerializedName(SERIALIZED_NAME_DAILY_PER_SOURCE_A_P_I_CALLS_USAGE) + private List dailyPerSourceAPICallsUsage = new ArrayList<>(); - public GetDailyPerSourceAPICallsUsageV1Output() { - } + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - public GetDailyPerSourceAPICallsUsageV1Output dailyPerSourceAPICallsUsage(List dailyPerSourceAPICallsUsage) { - - this.dailyPerSourceAPICallsUsage = dailyPerSourceAPICallsUsage; - return this; - } + @SerializedName(SERIALIZED_NAME_PAGINATION) + private PaginationOutput pagination; - public GetDailyPerSourceAPICallsUsageV1Output addDailyPerSourceAPICallsUsageItem(SourceAPICallSnapshotV1 dailyPerSourceAPICallsUsageItem) { - this.dailyPerSourceAPICallsUsage.add(dailyPerSourceAPICallsUsageItem); - return this; - } + public GetDailyPerSourceAPICallsUsageV1Output() {} - /** - * The list of daily per Source API calls count aggregates. - * @return dailyPerSourceAPICallsUsage - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The list of daily per Source API calls count aggregates.") - - public List getDailyPerSourceAPICallsUsage() { - return dailyPerSourceAPICallsUsage; - } + public GetDailyPerSourceAPICallsUsageV1Output dailyPerSourceAPICallsUsage( + List dailyPerSourceAPICallsUsage) { + this.dailyPerSourceAPICallsUsage = dailyPerSourceAPICallsUsage; + return this; + } - public void setDailyPerSourceAPICallsUsage(List dailyPerSourceAPICallsUsage) { - this.dailyPerSourceAPICallsUsage = dailyPerSourceAPICallsUsage; - } + public GetDailyPerSourceAPICallsUsageV1Output addDailyPerSourceAPICallsUsageItem( + SourceAPICallSnapshotV1 dailyPerSourceAPICallsUsageItem) { + if (this.dailyPerSourceAPICallsUsage == null) { + this.dailyPerSourceAPICallsUsage = new ArrayList<>(); + } + this.dailyPerSourceAPICallsUsage.add(dailyPerSourceAPICallsUsageItem); + return this; + } + /** + * The list of daily per Source API calls count aggregates. + * + * @return dailyPerSourceAPICallsUsage + */ + @javax.annotation.Nonnull + public List getDailyPerSourceAPICallsUsage() { + return dailyPerSourceAPICallsUsage; + } - public GetDailyPerSourceAPICallsUsageV1Output pagination(Pagination pagination) { - - this.pagination = pagination; - return this; - } + public void setDailyPerSourceAPICallsUsage( + List dailyPerSourceAPICallsUsage) { + this.dailyPerSourceAPICallsUsage = dailyPerSourceAPICallsUsage; + } - /** - * Get pagination - * @return pagination - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetDailyPerSourceAPICallsUsageV1Output pagination(PaginationOutput pagination) { - public Pagination getPagination() { - return pagination; - } + this.pagination = pagination; + return this; + } + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nonnull + public PaginationOutput getPagination() { + return pagination; + } - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } + public void setPagination(PaginationOutput pagination) { + this.pagination = pagination; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDailyPerSourceAPICallsUsageV1Output getDailyPerSourceAPICallsUsageV1Output = + (GetDailyPerSourceAPICallsUsageV1Output) o; + return Objects.equals( + this.dailyPerSourceAPICallsUsage, + getDailyPerSourceAPICallsUsageV1Output.dailyPerSourceAPICallsUsage) + && Objects.equals( + this.pagination, getDailyPerSourceAPICallsUsageV1Output.pagination); + } + @Override + public int hashCode() { + return Objects.hash(dailyPerSourceAPICallsUsage, pagination); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDailyPerSourceAPICallsUsageV1Output {\n"); + sb.append(" dailyPerSourceAPICallsUsage: ") + .append(toIndentedString(dailyPerSourceAPICallsUsage)) + .append("\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDailyPerSourceAPICallsUsageV1Output getDailyPerSourceAPICallsUsageV1Output = (GetDailyPerSourceAPICallsUsageV1Output) o; - return Objects.equals(this.dailyPerSourceAPICallsUsage, getDailyPerSourceAPICallsUsageV1Output.dailyPerSourceAPICallsUsage) && - Objects.equals(this.pagination, getDailyPerSourceAPICallsUsageV1Output.pagination); - } - - @Override - public int hashCode() { - return Objects.hash(dailyPerSourceAPICallsUsage, pagination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDailyPerSourceAPICallsUsageV1Output {\n"); - sb.append(" dailyPerSourceAPICallsUsage: ").append(toIndentedString(dailyPerSourceAPICallsUsage)).append("\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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dailyPerSourceAPICallsUsage"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("dailyPerSourceAPICallsUsage"); + openapiRequiredFields.add("pagination"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("dailyPerSourceAPICallsUsage"); - openapiFields.add("pagination"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("dailyPerSourceAPICallsUsage"); - openapiRequiredFields.add("pagination"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDailyPerSourceAPICallsUsageV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDailyPerSourceAPICallsUsageV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDailyPerSourceAPICallsUsageV1Output is not found in the empty JSON string", GetDailyPerSourceAPICallsUsageV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDailyPerSourceAPICallsUsageV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDailyPerSourceAPICallsUsageV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDailyPerSourceAPICallsUsageV1Output" + + " is not found in the empty JSON string", + GetDailyPerSourceAPICallsUsageV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDailyPerSourceAPICallsUsageV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDailyPerSourceAPICallsUsageV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDailyPerSourceAPICallsUsageV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDailyPerSourceAPICallsUsageV1Output` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetDailyPerSourceAPICallsUsageV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetDailyPerSourceAPICallsUsageV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("dailyPerSourceAPICallsUsage").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `dailyPerSourceAPICallsUsage` to be an array in the" + + " JSON string but got `%s`", + jsonObj.get("dailyPerSourceAPICallsUsage").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("dailyPerSourceAPICallsUsage").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `dailyPerSourceAPICallsUsage` to be an array in the JSON string but got `%s`", jsonObj.get("dailyPerSourceAPICallsUsage").toString())); - } - JsonArray jsonArraydailyPerSourceAPICallsUsage = jsonObj.getAsJsonArray("dailyPerSourceAPICallsUsage"); - } + JsonArray jsonArraydailyPerSourceAPICallsUsage = + jsonObj.getAsJsonArray("dailyPerSourceAPICallsUsage"); + // validate the required field `dailyPerSourceAPICallsUsage` (array) + for (int i = 0; i < jsonArraydailyPerSourceAPICallsUsage.size(); i++) { + SourceAPICallSnapshotV1.validateJsonElement( + jsonArraydailyPerSourceAPICallsUsage.get(i)); + } + ; + // validate the required field `pagination` + PaginationOutput.validateJsonElement(jsonObj.get("pagination")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDailyPerSourceAPICallsUsageV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDailyPerSourceAPICallsUsageV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDailyPerSourceAPICallsUsageV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDailyPerSourceAPICallsUsageV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDailyPerSourceAPICallsUsageV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDailyPerSourceAPICallsUsageV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDailyPerSourceAPICallsUsageV1Output' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDailyPerSourceAPICallsUsageV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetDailyPerSourceAPICallsUsageV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDailyPerSourceAPICallsUsageV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDailyPerSourceAPICallsUsageV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDailyPerSourceAPICallsUsageV1Output + * @throws IOException if the JSON string is invalid with respect to + * GetDailyPerSourceAPICallsUsageV1Output + */ + public static GetDailyPerSourceAPICallsUsageV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetDailyPerSourceAPICallsUsageV1Output.class); } - } - - /** - * Create an instance of GetDailyPerSourceAPICallsUsageV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDailyPerSourceAPICallsUsageV1Output - * @throws IOException if the JSON string is invalid with respect to GetDailyPerSourceAPICallsUsageV1Output - */ - public static GetDailyPerSourceAPICallsUsageV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDailyPerSourceAPICallsUsageV1Output.class); - } - - /** - * Convert an instance of GetDailyPerSourceAPICallsUsageV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDailyPerSourceAPICallsUsageV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDailyPerSourceMTUUsage200Response.java b/src/main/java/com/segment/publicapi/models/GetDailyPerSourceMTUUsage200Response.java index 670e1e12..8ed93685 100644 --- a/src/main/java/com/segment/publicapi/models/GetDailyPerSourceMTUUsage200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetDailyPerSourceMTUUsage200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetDailyPerSourceMTUUsageV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetDailyPerSourceMTUUsage200Response - */ - +/** GetDailyPerSourceMTUUsage200Response */ public class GetDailyPerSourceMTUUsage200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetDailyPerSourceMTUUsageV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetDailyPerSourceMTUUsage200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetDailyPerSourceMTUUsageV1Output data; - public GetDailyPerSourceMTUUsage200Response data(GetDailyPerSourceMTUUsageV1Output data) { - - this.data = data; - return this; - } + public GetDailyPerSourceMTUUsage200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetDailyPerSourceMTUUsage200Response data(GetDailyPerSourceMTUUsageV1Output data) { - public GetDailyPerSourceMTUUsageV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetDailyPerSourceMTUUsageV1Output getData() { + return data; + } - public void setData(GetDailyPerSourceMTUUsageV1Output data) { - this.data = data; - } + public void setData(GetDailyPerSourceMTUUsageV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDailyPerSourceMTUUsage200Response getDailyPerSourceMTUUsage200Response = + (GetDailyPerSourceMTUUsage200Response) o; + return Objects.equals(this.data, getDailyPerSourceMTUUsage200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDailyPerSourceMTUUsage200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDailyPerSourceMTUUsage200Response getDailyPerSourceMTUUsage200Response = (GetDailyPerSourceMTUUsage200Response) o; - return Objects.equals(this.data, getDailyPerSourceMTUUsage200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDailyPerSourceMTUUsage200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDailyPerSourceMTUUsage200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDailyPerSourceMTUUsage200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDailyPerSourceMTUUsage200Response is not found in the empty JSON string", GetDailyPerSourceMTUUsage200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDailyPerSourceMTUUsage200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDailyPerSourceMTUUsage200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDailyPerSourceMTUUsage200Response" + + " is not found in the empty JSON string", + GetDailyPerSourceMTUUsage200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDailyPerSourceMTUUsage200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDailyPerSourceMTUUsage200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDailyPerSourceMTUUsage200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDailyPerSourceMTUUsage200Response` 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()) { + GetDailyPerSourceMTUUsageV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDailyPerSourceMTUUsage200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDailyPerSourceMTUUsage200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDailyPerSourceMTUUsage200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDailyPerSourceMTUUsage200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDailyPerSourceMTUUsage200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDailyPerSourceMTUUsage200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDailyPerSourceMTUUsage200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDailyPerSourceMTUUsage200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetDailyPerSourceMTUUsage200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDailyPerSourceMTUUsage200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDailyPerSourceMTUUsage200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDailyPerSourceMTUUsage200Response + * @throws IOException if the JSON string is invalid with respect to + * GetDailyPerSourceMTUUsage200Response + */ + public static GetDailyPerSourceMTUUsage200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetDailyPerSourceMTUUsage200Response.class); } - } - - /** - * Create an instance of GetDailyPerSourceMTUUsage200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDailyPerSourceMTUUsage200Response - * @throws IOException if the JSON string is invalid with respect to GetDailyPerSourceMTUUsage200Response - */ - public static GetDailyPerSourceMTUUsage200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDailyPerSourceMTUUsage200Response.class); - } - - /** - * Convert an instance of GetDailyPerSourceMTUUsage200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDailyPerSourceMTUUsage200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDailyPerSourceMTUUsageV1Output.java b/src/main/java/com/segment/publicapi/models/GetDailyPerSourceMTUUsageV1Output.java index dd25f3a6..9cd02320 100644 --- a/src/main/java/com/segment/publicapi/models/GetDailyPerSourceMTUUsageV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetDailyPerSourceMTUUsageV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,251 +9,264 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Pagination; -import com.segment.publicapi.models.UsersPerSourceSnapshotV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a list of daily aggregations of Source level MTU counts. - */ -@ApiModel(description = "Returns a list of daily aggregations of Source level MTU counts.") - +/** Returns a list of daily aggregations of Source level MTU counts. */ public class GetDailyPerSourceMTUUsageV1Output { - public static final String SERIALIZED_NAME_DAILY_PER_SOURCE_M_T_U_USAGE = "dailyPerSourceMTUUsage"; - @SerializedName(SERIALIZED_NAME_DAILY_PER_SOURCE_M_T_U_USAGE) - private List dailyPerSourceMTUUsage = new ArrayList<>(); + public static final String SERIALIZED_NAME_DAILY_PER_SOURCE_M_T_U_USAGE = + "dailyPerSourceMTUUsage"; - public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - @SerializedName(SERIALIZED_NAME_PAGINATION) - private Pagination pagination; + @SerializedName(SERIALIZED_NAME_DAILY_PER_SOURCE_M_T_U_USAGE) + private List dailyPerSourceMTUUsage = new ArrayList<>(); - public GetDailyPerSourceMTUUsageV1Output() { - } + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - public GetDailyPerSourceMTUUsageV1Output dailyPerSourceMTUUsage(List dailyPerSourceMTUUsage) { - - this.dailyPerSourceMTUUsage = dailyPerSourceMTUUsage; - return this; - } + @SerializedName(SERIALIZED_NAME_PAGINATION) + private PaginationOutput pagination; - public GetDailyPerSourceMTUUsageV1Output addDailyPerSourceMTUUsageItem(UsersPerSourceSnapshotV1 dailyPerSourceMTUUsageItem) { - this.dailyPerSourceMTUUsage.add(dailyPerSourceMTUUsageItem); - return this; - } + public GetDailyPerSourceMTUUsageV1Output() {} - /** - * The list of daily per Source MTU count aggregates. - * @return dailyPerSourceMTUUsage - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The list of daily per Source MTU count aggregates.") - - public List getDailyPerSourceMTUUsage() { - return dailyPerSourceMTUUsage; - } + public GetDailyPerSourceMTUUsageV1Output dailyPerSourceMTUUsage( + List dailyPerSourceMTUUsage) { + this.dailyPerSourceMTUUsage = dailyPerSourceMTUUsage; + return this; + } - public void setDailyPerSourceMTUUsage(List dailyPerSourceMTUUsage) { - this.dailyPerSourceMTUUsage = dailyPerSourceMTUUsage; - } + public GetDailyPerSourceMTUUsageV1Output addDailyPerSourceMTUUsageItem( + UsersPerSourceSnapshotV1 dailyPerSourceMTUUsageItem) { + if (this.dailyPerSourceMTUUsage == null) { + this.dailyPerSourceMTUUsage = new ArrayList<>(); + } + this.dailyPerSourceMTUUsage.add(dailyPerSourceMTUUsageItem); + return this; + } + /** + * The list of daily per Source MTU count aggregates. + * + * @return dailyPerSourceMTUUsage + */ + @javax.annotation.Nonnull + public List getDailyPerSourceMTUUsage() { + return dailyPerSourceMTUUsage; + } - public GetDailyPerSourceMTUUsageV1Output pagination(Pagination pagination) { - - this.pagination = pagination; - return this; - } + public void setDailyPerSourceMTUUsage(List dailyPerSourceMTUUsage) { + this.dailyPerSourceMTUUsage = dailyPerSourceMTUUsage; + } - /** - * Get pagination - * @return pagination - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetDailyPerSourceMTUUsageV1Output pagination(PaginationOutput pagination) { - public Pagination getPagination() { - return pagination; - } + this.pagination = pagination; + return this; + } + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nonnull + public PaginationOutput getPagination() { + return pagination; + } - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } + public void setPagination(PaginationOutput pagination) { + this.pagination = pagination; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDailyPerSourceMTUUsageV1Output getDailyPerSourceMTUUsageV1Output = + (GetDailyPerSourceMTUUsageV1Output) o; + return Objects.equals( + this.dailyPerSourceMTUUsage, + getDailyPerSourceMTUUsageV1Output.dailyPerSourceMTUUsage) + && Objects.equals(this.pagination, getDailyPerSourceMTUUsageV1Output.pagination); + } + @Override + public int hashCode() { + return Objects.hash(dailyPerSourceMTUUsage, pagination); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDailyPerSourceMTUUsageV1Output {\n"); + sb.append(" dailyPerSourceMTUUsage: ") + .append(toIndentedString(dailyPerSourceMTUUsage)) + .append("\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDailyPerSourceMTUUsageV1Output getDailyPerSourceMTUUsageV1Output = (GetDailyPerSourceMTUUsageV1Output) o; - return Objects.equals(this.dailyPerSourceMTUUsage, getDailyPerSourceMTUUsageV1Output.dailyPerSourceMTUUsage) && - Objects.equals(this.pagination, getDailyPerSourceMTUUsageV1Output.pagination); - } - - @Override - public int hashCode() { - return Objects.hash(dailyPerSourceMTUUsage, pagination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDailyPerSourceMTUUsageV1Output {\n"); - sb.append(" dailyPerSourceMTUUsage: ").append(toIndentedString(dailyPerSourceMTUUsage)).append("\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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dailyPerSourceMTUUsage"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("dailyPerSourceMTUUsage"); + openapiRequiredFields.add("pagination"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("dailyPerSourceMTUUsage"); - openapiFields.add("pagination"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("dailyPerSourceMTUUsage"); - openapiRequiredFields.add("pagination"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDailyPerSourceMTUUsageV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDailyPerSourceMTUUsageV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDailyPerSourceMTUUsageV1Output is not found in the empty JSON string", GetDailyPerSourceMTUUsageV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDailyPerSourceMTUUsageV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDailyPerSourceMTUUsageV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDailyPerSourceMTUUsageV1Output is" + + " not found in the empty JSON string", + GetDailyPerSourceMTUUsageV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDailyPerSourceMTUUsageV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDailyPerSourceMTUUsageV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDailyPerSourceMTUUsageV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDailyPerSourceMTUUsageV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetDailyPerSourceMTUUsageV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetDailyPerSourceMTUUsageV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("dailyPerSourceMTUUsage").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `dailyPerSourceMTUUsage` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("dailyPerSourceMTUUsage").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("dailyPerSourceMTUUsage").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `dailyPerSourceMTUUsage` to be an array in the JSON string but got `%s`", jsonObj.get("dailyPerSourceMTUUsage").toString())); - } - JsonArray jsonArraydailyPerSourceMTUUsage = jsonObj.getAsJsonArray("dailyPerSourceMTUUsage"); - } + JsonArray jsonArraydailyPerSourceMTUUsage = + jsonObj.getAsJsonArray("dailyPerSourceMTUUsage"); + // validate the required field `dailyPerSourceMTUUsage` (array) + for (int i = 0; i < jsonArraydailyPerSourceMTUUsage.size(); i++) { + UsersPerSourceSnapshotV1.validateJsonElement(jsonArraydailyPerSourceMTUUsage.get(i)); + } + ; + // validate the required field `pagination` + PaginationOutput.validateJsonElement(jsonObj.get("pagination")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDailyPerSourceMTUUsageV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDailyPerSourceMTUUsageV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDailyPerSourceMTUUsageV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDailyPerSourceMTUUsageV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDailyPerSourceMTUUsageV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDailyPerSourceMTUUsageV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDailyPerSourceMTUUsageV1Output' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDailyPerSourceMTUUsageV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDailyPerSourceMTUUsageV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDailyPerSourceMTUUsageV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDailyPerSourceMTUUsageV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDailyPerSourceMTUUsageV1Output + * @throws IOException if the JSON string is invalid with respect to + * GetDailyPerSourceMTUUsageV1Output + */ + public static GetDailyPerSourceMTUUsageV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDailyPerSourceMTUUsageV1Output.class); } - } - - /** - * Create an instance of GetDailyPerSourceMTUUsageV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDailyPerSourceMTUUsageV1Output - * @throws IOException if the JSON string is invalid with respect to GetDailyPerSourceMTUUsageV1Output - */ - public static GetDailyPerSourceMTUUsageV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDailyPerSourceMTUUsageV1Output.class); - } - - /** - * Convert an instance of GetDailyPerSourceMTUUsageV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDailyPerSourceMTUUsageV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceAPICallsUsage200Response.java b/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceAPICallsUsage200Response.java index 22708445..6ef5d080 100644 --- a/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceAPICallsUsage200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceAPICallsUsage200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,198 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetDailyWorkspaceAPICallsUsageV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetDailyWorkspaceAPICallsUsage200Response - */ - +/** GetDailyWorkspaceAPICallsUsage200Response */ public class GetDailyWorkspaceAPICallsUsage200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetDailyWorkspaceAPICallsUsageV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetDailyWorkspaceAPICallsUsage200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetDailyWorkspaceAPICallsUsageV1Output data; - public GetDailyWorkspaceAPICallsUsage200Response data(GetDailyWorkspaceAPICallsUsageV1Output data) { - - this.data = data; - return this; - } + public GetDailyWorkspaceAPICallsUsage200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetDailyWorkspaceAPICallsUsage200Response data( + GetDailyWorkspaceAPICallsUsageV1Output data) { - public GetDailyWorkspaceAPICallsUsageV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetDailyWorkspaceAPICallsUsageV1Output getData() { + return data; + } - public void setData(GetDailyWorkspaceAPICallsUsageV1Output data) { - this.data = data; - } + public void setData(GetDailyWorkspaceAPICallsUsageV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDailyWorkspaceAPICallsUsage200Response getDailyWorkspaceAPICallsUsage200Response = + (GetDailyWorkspaceAPICallsUsage200Response) o; + return Objects.equals(this.data, getDailyWorkspaceAPICallsUsage200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDailyWorkspaceAPICallsUsage200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDailyWorkspaceAPICallsUsage200Response getDailyWorkspaceAPICallsUsage200Response = (GetDailyWorkspaceAPICallsUsage200Response) o; - return Objects.equals(this.data, getDailyWorkspaceAPICallsUsage200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDailyWorkspaceAPICallsUsage200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDailyWorkspaceAPICallsUsage200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDailyWorkspaceAPICallsUsage200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDailyWorkspaceAPICallsUsage200Response is not found in the empty JSON string", GetDailyWorkspaceAPICallsUsage200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDailyWorkspaceAPICallsUsage200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDailyWorkspaceAPICallsUsage200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetDailyWorkspaceAPICallsUsage200Response is not found in" + + " the empty JSON string", + GetDailyWorkspaceAPICallsUsage200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDailyWorkspaceAPICallsUsage200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDailyWorkspaceAPICallsUsage200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDailyWorkspaceAPICallsUsage200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDailyWorkspaceAPICallsUsage200Response` 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()) { + GetDailyWorkspaceAPICallsUsageV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDailyWorkspaceAPICallsUsage200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDailyWorkspaceAPICallsUsage200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDailyWorkspaceAPICallsUsage200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDailyWorkspaceAPICallsUsage200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDailyWorkspaceAPICallsUsage200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDailyWorkspaceAPICallsUsage200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetDailyWorkspaceAPICallsUsage200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDailyWorkspaceAPICallsUsage200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetDailyWorkspaceAPICallsUsage200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDailyWorkspaceAPICallsUsage200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDailyWorkspaceAPICallsUsage200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDailyWorkspaceAPICallsUsage200Response + * @throws IOException if the JSON string is invalid with respect to + * GetDailyWorkspaceAPICallsUsage200Response + */ + public static GetDailyWorkspaceAPICallsUsage200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetDailyWorkspaceAPICallsUsage200Response.class); } - } - - /** - * Create an instance of GetDailyWorkspaceAPICallsUsage200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDailyWorkspaceAPICallsUsage200Response - * @throws IOException if the JSON string is invalid with respect to GetDailyWorkspaceAPICallsUsage200Response - */ - public static GetDailyWorkspaceAPICallsUsage200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDailyWorkspaceAPICallsUsage200Response.class); - } - - /** - * Convert an instance of GetDailyWorkspaceAPICallsUsage200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDailyWorkspaceAPICallsUsage200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceAPICallsUsageV1Output.java b/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceAPICallsUsageV1Output.java index bbb809a3..015a403b 100644 --- a/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceAPICallsUsageV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceAPICallsUsageV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,251 +9,269 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.APICallSnapshotV1; -import com.segment.publicapi.models.Pagination; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a list of daily aggregations of Workspace MTU counts. - */ -@ApiModel(description = "Returns a list of daily aggregations of Workspace MTU counts.") - +/** Returns a list of daily aggregations of Workspace MTU counts. */ public class GetDailyWorkspaceAPICallsUsageV1Output { - public static final String SERIALIZED_NAME_DAILY_WORKSPACE_A_P_I_CALLS_USAGE = "dailyWorkspaceAPICallsUsage"; - @SerializedName(SERIALIZED_NAME_DAILY_WORKSPACE_A_P_I_CALLS_USAGE) - private List dailyWorkspaceAPICallsUsage = new ArrayList<>(); + public static final String SERIALIZED_NAME_DAILY_WORKSPACE_A_P_I_CALLS_USAGE = + "dailyWorkspaceAPICallsUsage"; - public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - @SerializedName(SERIALIZED_NAME_PAGINATION) - private Pagination pagination; + @SerializedName(SERIALIZED_NAME_DAILY_WORKSPACE_A_P_I_CALLS_USAGE) + private List dailyWorkspaceAPICallsUsage = new ArrayList<>(); - public GetDailyWorkspaceAPICallsUsageV1Output() { - } + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - public GetDailyWorkspaceAPICallsUsageV1Output dailyWorkspaceAPICallsUsage(List dailyWorkspaceAPICallsUsage) { - - this.dailyWorkspaceAPICallsUsage = dailyWorkspaceAPICallsUsage; - return this; - } + @SerializedName(SERIALIZED_NAME_PAGINATION) + private PaginationOutput pagination; - public GetDailyWorkspaceAPICallsUsageV1Output addDailyWorkspaceAPICallsUsageItem(APICallSnapshotV1 dailyWorkspaceAPICallsUsageItem) { - this.dailyWorkspaceAPICallsUsage.add(dailyWorkspaceAPICallsUsageItem); - return this; - } + public GetDailyWorkspaceAPICallsUsageV1Output() {} - /** - * The list of daily Workspace API calls count aggregates. - * @return dailyWorkspaceAPICallsUsage - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The list of daily Workspace API calls count aggregates.") - - public List getDailyWorkspaceAPICallsUsage() { - return dailyWorkspaceAPICallsUsage; - } + public GetDailyWorkspaceAPICallsUsageV1Output dailyWorkspaceAPICallsUsage( + List dailyWorkspaceAPICallsUsage) { + this.dailyWorkspaceAPICallsUsage = dailyWorkspaceAPICallsUsage; + return this; + } - public void setDailyWorkspaceAPICallsUsage(List dailyWorkspaceAPICallsUsage) { - this.dailyWorkspaceAPICallsUsage = dailyWorkspaceAPICallsUsage; - } + public GetDailyWorkspaceAPICallsUsageV1Output addDailyWorkspaceAPICallsUsageItem( + APICallSnapshotV1 dailyWorkspaceAPICallsUsageItem) { + if (this.dailyWorkspaceAPICallsUsage == null) { + this.dailyWorkspaceAPICallsUsage = new ArrayList<>(); + } + this.dailyWorkspaceAPICallsUsage.add(dailyWorkspaceAPICallsUsageItem); + return this; + } + /** + * The list of daily Workspace API calls count aggregates. + * + * @return dailyWorkspaceAPICallsUsage + */ + @javax.annotation.Nonnull + public List getDailyWorkspaceAPICallsUsage() { + return dailyWorkspaceAPICallsUsage; + } - public GetDailyWorkspaceAPICallsUsageV1Output pagination(Pagination pagination) { - - this.pagination = pagination; - return this; - } + public void setDailyWorkspaceAPICallsUsage( + List dailyWorkspaceAPICallsUsage) { + this.dailyWorkspaceAPICallsUsage = dailyWorkspaceAPICallsUsage; + } - /** - * Get pagination - * @return pagination - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetDailyWorkspaceAPICallsUsageV1Output pagination(PaginationOutput pagination) { - public Pagination getPagination() { - return pagination; - } + this.pagination = pagination; + return this; + } + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nonnull + public PaginationOutput getPagination() { + return pagination; + } - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } + public void setPagination(PaginationOutput pagination) { + this.pagination = pagination; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDailyWorkspaceAPICallsUsageV1Output getDailyWorkspaceAPICallsUsageV1Output = + (GetDailyWorkspaceAPICallsUsageV1Output) o; + return Objects.equals( + this.dailyWorkspaceAPICallsUsage, + getDailyWorkspaceAPICallsUsageV1Output.dailyWorkspaceAPICallsUsage) + && Objects.equals( + this.pagination, getDailyWorkspaceAPICallsUsageV1Output.pagination); + } + @Override + public int hashCode() { + return Objects.hash(dailyWorkspaceAPICallsUsage, pagination); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDailyWorkspaceAPICallsUsageV1Output {\n"); + sb.append(" dailyWorkspaceAPICallsUsage: ") + .append(toIndentedString(dailyWorkspaceAPICallsUsage)) + .append("\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDailyWorkspaceAPICallsUsageV1Output getDailyWorkspaceAPICallsUsageV1Output = (GetDailyWorkspaceAPICallsUsageV1Output) o; - return Objects.equals(this.dailyWorkspaceAPICallsUsage, getDailyWorkspaceAPICallsUsageV1Output.dailyWorkspaceAPICallsUsage) && - Objects.equals(this.pagination, getDailyWorkspaceAPICallsUsageV1Output.pagination); - } - - @Override - public int hashCode() { - return Objects.hash(dailyWorkspaceAPICallsUsage, pagination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDailyWorkspaceAPICallsUsageV1Output {\n"); - sb.append(" dailyWorkspaceAPICallsUsage: ").append(toIndentedString(dailyWorkspaceAPICallsUsage)).append("\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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dailyWorkspaceAPICallsUsage"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("dailyWorkspaceAPICallsUsage"); + openapiRequiredFields.add("pagination"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("dailyWorkspaceAPICallsUsage"); - openapiFields.add("pagination"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("dailyWorkspaceAPICallsUsage"); - openapiRequiredFields.add("pagination"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDailyWorkspaceAPICallsUsageV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDailyWorkspaceAPICallsUsageV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDailyWorkspaceAPICallsUsageV1Output is not found in the empty JSON string", GetDailyWorkspaceAPICallsUsageV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDailyWorkspaceAPICallsUsageV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDailyWorkspaceAPICallsUsageV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDailyWorkspaceAPICallsUsageV1Output" + + " is not found in the empty JSON string", + GetDailyWorkspaceAPICallsUsageV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDailyWorkspaceAPICallsUsageV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDailyWorkspaceAPICallsUsageV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDailyWorkspaceAPICallsUsageV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDailyWorkspaceAPICallsUsageV1Output` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetDailyWorkspaceAPICallsUsageV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetDailyWorkspaceAPICallsUsageV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("dailyWorkspaceAPICallsUsage").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `dailyWorkspaceAPICallsUsage` to be an array in the" + + " JSON string but got `%s`", + jsonObj.get("dailyWorkspaceAPICallsUsage").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("dailyWorkspaceAPICallsUsage").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `dailyWorkspaceAPICallsUsage` to be an array in the JSON string but got `%s`", jsonObj.get("dailyWorkspaceAPICallsUsage").toString())); - } - JsonArray jsonArraydailyWorkspaceAPICallsUsage = jsonObj.getAsJsonArray("dailyWorkspaceAPICallsUsage"); - } + JsonArray jsonArraydailyWorkspaceAPICallsUsage = + jsonObj.getAsJsonArray("dailyWorkspaceAPICallsUsage"); + // validate the required field `dailyWorkspaceAPICallsUsage` (array) + for (int i = 0; i < jsonArraydailyWorkspaceAPICallsUsage.size(); i++) { + APICallSnapshotV1.validateJsonElement(jsonArraydailyWorkspaceAPICallsUsage.get(i)); + } + ; + // validate the required field `pagination` + PaginationOutput.validateJsonElement(jsonObj.get("pagination")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDailyWorkspaceAPICallsUsageV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDailyWorkspaceAPICallsUsageV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDailyWorkspaceAPICallsUsageV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDailyWorkspaceAPICallsUsageV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDailyWorkspaceAPICallsUsageV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDailyWorkspaceAPICallsUsageV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDailyWorkspaceAPICallsUsageV1Output' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDailyWorkspaceAPICallsUsageV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetDailyWorkspaceAPICallsUsageV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDailyWorkspaceAPICallsUsageV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDailyWorkspaceAPICallsUsageV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDailyWorkspaceAPICallsUsageV1Output + * @throws IOException if the JSON string is invalid with respect to + * GetDailyWorkspaceAPICallsUsageV1Output + */ + public static GetDailyWorkspaceAPICallsUsageV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetDailyWorkspaceAPICallsUsageV1Output.class); } - } - - /** - * Create an instance of GetDailyWorkspaceAPICallsUsageV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDailyWorkspaceAPICallsUsageV1Output - * @throws IOException if the JSON string is invalid with respect to GetDailyWorkspaceAPICallsUsageV1Output - */ - public static GetDailyWorkspaceAPICallsUsageV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDailyWorkspaceAPICallsUsageV1Output.class); - } - - /** - * Convert an instance of GetDailyWorkspaceAPICallsUsageV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDailyWorkspaceAPICallsUsageV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceMTUUsage200Response.java b/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceMTUUsage200Response.java index 57128990..6516f5de 100644 --- a/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceMTUUsage200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceMTUUsage200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetDailyWorkspaceMTUUsageV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetDailyWorkspaceMTUUsage200Response - */ - +/** GetDailyWorkspaceMTUUsage200Response */ public class GetDailyWorkspaceMTUUsage200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetDailyWorkspaceMTUUsageV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetDailyWorkspaceMTUUsage200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetDailyWorkspaceMTUUsageV1Output data; - public GetDailyWorkspaceMTUUsage200Response data(GetDailyWorkspaceMTUUsageV1Output data) { - - this.data = data; - return this; - } + public GetDailyWorkspaceMTUUsage200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetDailyWorkspaceMTUUsage200Response data(GetDailyWorkspaceMTUUsageV1Output data) { - public GetDailyWorkspaceMTUUsageV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetDailyWorkspaceMTUUsageV1Output getData() { + return data; + } - public void setData(GetDailyWorkspaceMTUUsageV1Output data) { - this.data = data; - } + public void setData(GetDailyWorkspaceMTUUsageV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDailyWorkspaceMTUUsage200Response getDailyWorkspaceMTUUsage200Response = + (GetDailyWorkspaceMTUUsage200Response) o; + return Objects.equals(this.data, getDailyWorkspaceMTUUsage200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDailyWorkspaceMTUUsage200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDailyWorkspaceMTUUsage200Response getDailyWorkspaceMTUUsage200Response = (GetDailyWorkspaceMTUUsage200Response) o; - return Objects.equals(this.data, getDailyWorkspaceMTUUsage200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDailyWorkspaceMTUUsage200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDailyWorkspaceMTUUsage200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDailyWorkspaceMTUUsage200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDailyWorkspaceMTUUsage200Response is not found in the empty JSON string", GetDailyWorkspaceMTUUsage200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDailyWorkspaceMTUUsage200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDailyWorkspaceMTUUsage200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDailyWorkspaceMTUUsage200Response" + + " is not found in the empty JSON string", + GetDailyWorkspaceMTUUsage200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDailyWorkspaceMTUUsage200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDailyWorkspaceMTUUsage200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDailyWorkspaceMTUUsage200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDailyWorkspaceMTUUsage200Response` 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()) { + GetDailyWorkspaceMTUUsageV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDailyWorkspaceMTUUsage200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDailyWorkspaceMTUUsage200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDailyWorkspaceMTUUsage200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDailyWorkspaceMTUUsage200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDailyWorkspaceMTUUsage200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDailyWorkspaceMTUUsage200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDailyWorkspaceMTUUsage200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDailyWorkspaceMTUUsage200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetDailyWorkspaceMTUUsage200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDailyWorkspaceMTUUsage200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDailyWorkspaceMTUUsage200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDailyWorkspaceMTUUsage200Response + * @throws IOException if the JSON string is invalid with respect to + * GetDailyWorkspaceMTUUsage200Response + */ + public static GetDailyWorkspaceMTUUsage200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetDailyWorkspaceMTUUsage200Response.class); } - } - - /** - * Create an instance of GetDailyWorkspaceMTUUsage200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDailyWorkspaceMTUUsage200Response - * @throws IOException if the JSON string is invalid with respect to GetDailyWorkspaceMTUUsage200Response - */ - public static GetDailyWorkspaceMTUUsage200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDailyWorkspaceMTUUsage200Response.class); - } - - /** - * Convert an instance of GetDailyWorkspaceMTUUsage200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDailyWorkspaceMTUUsage200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceMTUUsageV1Output.java b/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceMTUUsageV1Output.java index c3d31627..3aa8620c 100644 --- a/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceMTUUsageV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetDailyWorkspaceMTUUsageV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,251 +9,264 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.MtuSnapshotV1; -import com.segment.publicapi.models.Pagination; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a list of daily aggregations of Workspace MTU counts. - */ -@ApiModel(description = "Returns a list of daily aggregations of Workspace MTU counts.") - +/** Returns a list of daily aggregations of Workspace MTU counts. */ public class GetDailyWorkspaceMTUUsageV1Output { - public static final String SERIALIZED_NAME_DAILY_WORKSPACE_M_T_U_USAGE = "dailyWorkspaceMTUUsage"; - @SerializedName(SERIALIZED_NAME_DAILY_WORKSPACE_M_T_U_USAGE) - private List dailyWorkspaceMTUUsage = new ArrayList<>(); + public static final String SERIALIZED_NAME_DAILY_WORKSPACE_M_T_U_USAGE = + "dailyWorkspaceMTUUsage"; - public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - @SerializedName(SERIALIZED_NAME_PAGINATION) - private Pagination pagination; + @SerializedName(SERIALIZED_NAME_DAILY_WORKSPACE_M_T_U_USAGE) + private List dailyWorkspaceMTUUsage = new ArrayList<>(); - public GetDailyWorkspaceMTUUsageV1Output() { - } + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - public GetDailyWorkspaceMTUUsageV1Output dailyWorkspaceMTUUsage(List dailyWorkspaceMTUUsage) { - - this.dailyWorkspaceMTUUsage = dailyWorkspaceMTUUsage; - return this; - } + @SerializedName(SERIALIZED_NAME_PAGINATION) + private PaginationOutput pagination; - public GetDailyWorkspaceMTUUsageV1Output addDailyWorkspaceMTUUsageItem(MtuSnapshotV1 dailyWorkspaceMTUUsageItem) { - this.dailyWorkspaceMTUUsage.add(dailyWorkspaceMTUUsageItem); - return this; - } + public GetDailyWorkspaceMTUUsageV1Output() {} - /** - * The list of daily Workspace MTU count aggregates. - * @return dailyWorkspaceMTUUsage - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The list of daily Workspace MTU count aggregates.") - - public List getDailyWorkspaceMTUUsage() { - return dailyWorkspaceMTUUsage; - } + public GetDailyWorkspaceMTUUsageV1Output dailyWorkspaceMTUUsage( + List dailyWorkspaceMTUUsage) { + this.dailyWorkspaceMTUUsage = dailyWorkspaceMTUUsage; + return this; + } - public void setDailyWorkspaceMTUUsage(List dailyWorkspaceMTUUsage) { - this.dailyWorkspaceMTUUsage = dailyWorkspaceMTUUsage; - } + public GetDailyWorkspaceMTUUsageV1Output addDailyWorkspaceMTUUsageItem( + MtuSnapshotV1 dailyWorkspaceMTUUsageItem) { + if (this.dailyWorkspaceMTUUsage == null) { + this.dailyWorkspaceMTUUsage = new ArrayList<>(); + } + this.dailyWorkspaceMTUUsage.add(dailyWorkspaceMTUUsageItem); + return this; + } + /** + * The list of daily Workspace MTU count aggregates. + * + * @return dailyWorkspaceMTUUsage + */ + @javax.annotation.Nonnull + public List getDailyWorkspaceMTUUsage() { + return dailyWorkspaceMTUUsage; + } - public GetDailyWorkspaceMTUUsageV1Output pagination(Pagination pagination) { - - this.pagination = pagination; - return this; - } + public void setDailyWorkspaceMTUUsage(List dailyWorkspaceMTUUsage) { + this.dailyWorkspaceMTUUsage = dailyWorkspaceMTUUsage; + } - /** - * Get pagination - * @return pagination - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetDailyWorkspaceMTUUsageV1Output pagination(PaginationOutput pagination) { - public Pagination getPagination() { - return pagination; - } + this.pagination = pagination; + return this; + } + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nonnull + public PaginationOutput getPagination() { + return pagination; + } - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } + public void setPagination(PaginationOutput pagination) { + this.pagination = pagination; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDailyWorkspaceMTUUsageV1Output getDailyWorkspaceMTUUsageV1Output = + (GetDailyWorkspaceMTUUsageV1Output) o; + return Objects.equals( + this.dailyWorkspaceMTUUsage, + getDailyWorkspaceMTUUsageV1Output.dailyWorkspaceMTUUsage) + && Objects.equals(this.pagination, getDailyWorkspaceMTUUsageV1Output.pagination); + } + @Override + public int hashCode() { + return Objects.hash(dailyWorkspaceMTUUsage, pagination); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDailyWorkspaceMTUUsageV1Output {\n"); + sb.append(" dailyWorkspaceMTUUsage: ") + .append(toIndentedString(dailyWorkspaceMTUUsage)) + .append("\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDailyWorkspaceMTUUsageV1Output getDailyWorkspaceMTUUsageV1Output = (GetDailyWorkspaceMTUUsageV1Output) o; - return Objects.equals(this.dailyWorkspaceMTUUsage, getDailyWorkspaceMTUUsageV1Output.dailyWorkspaceMTUUsage) && - Objects.equals(this.pagination, getDailyWorkspaceMTUUsageV1Output.pagination); - } - - @Override - public int hashCode() { - return Objects.hash(dailyWorkspaceMTUUsage, pagination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDailyWorkspaceMTUUsageV1Output {\n"); - sb.append(" dailyWorkspaceMTUUsage: ").append(toIndentedString(dailyWorkspaceMTUUsage)).append("\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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dailyWorkspaceMTUUsage"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("dailyWorkspaceMTUUsage"); + openapiRequiredFields.add("pagination"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("dailyWorkspaceMTUUsage"); - openapiFields.add("pagination"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("dailyWorkspaceMTUUsage"); - openapiRequiredFields.add("pagination"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDailyWorkspaceMTUUsageV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDailyWorkspaceMTUUsageV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDailyWorkspaceMTUUsageV1Output is not found in the empty JSON string", GetDailyWorkspaceMTUUsageV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDailyWorkspaceMTUUsageV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDailyWorkspaceMTUUsageV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDailyWorkspaceMTUUsageV1Output is" + + " not found in the empty JSON string", + GetDailyWorkspaceMTUUsageV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDailyWorkspaceMTUUsageV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDailyWorkspaceMTUUsageV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDailyWorkspaceMTUUsageV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDailyWorkspaceMTUUsageV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetDailyWorkspaceMTUUsageV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetDailyWorkspaceMTUUsageV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("dailyWorkspaceMTUUsage").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `dailyWorkspaceMTUUsage` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("dailyWorkspaceMTUUsage").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("dailyWorkspaceMTUUsage").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `dailyWorkspaceMTUUsage` to be an array in the JSON string but got `%s`", jsonObj.get("dailyWorkspaceMTUUsage").toString())); - } - JsonArray jsonArraydailyWorkspaceMTUUsage = jsonObj.getAsJsonArray("dailyWorkspaceMTUUsage"); - } + JsonArray jsonArraydailyWorkspaceMTUUsage = + jsonObj.getAsJsonArray("dailyWorkspaceMTUUsage"); + // validate the required field `dailyWorkspaceMTUUsage` (array) + for (int i = 0; i < jsonArraydailyWorkspaceMTUUsage.size(); i++) { + MtuSnapshotV1.validateJsonElement(jsonArraydailyWorkspaceMTUUsage.get(i)); + } + ; + // validate the required field `pagination` + PaginationOutput.validateJsonElement(jsonObj.get("pagination")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDailyWorkspaceMTUUsageV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDailyWorkspaceMTUUsageV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDailyWorkspaceMTUUsageV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDailyWorkspaceMTUUsageV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDailyWorkspaceMTUUsageV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDailyWorkspaceMTUUsageV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDailyWorkspaceMTUUsageV1Output' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDailyWorkspaceMTUUsageV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDailyWorkspaceMTUUsageV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDailyWorkspaceMTUUsageV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDailyWorkspaceMTUUsageV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDailyWorkspaceMTUUsageV1Output + * @throws IOException if the JSON string is invalid with respect to + * GetDailyWorkspaceMTUUsageV1Output + */ + public static GetDailyWorkspaceMTUUsageV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDailyWorkspaceMTUUsageV1Output.class); } - } - - /** - * Create an instance of GetDailyWorkspaceMTUUsageV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDailyWorkspaceMTUUsageV1Output - * @throws IOException if the JSON string is invalid with respect to GetDailyWorkspaceMTUUsageV1Output - */ - public static GetDailyWorkspaceMTUUsageV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDailyWorkspaceMTUUsageV1Output.class); - } - - /** - * Convert an instance of GetDailyWorkspaceMTUUsageV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDailyWorkspaceMTUUsageV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDeliveryOverviewMetricsBetaOutput.java b/src/main/java/com/segment/publicapi/models/GetDeliveryOverviewMetricsBetaOutput.java new file mode 100644 index 00000000..129523c4 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetDeliveryOverviewMetricsBetaOutput.java @@ -0,0 +1,299 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output of the Delivery Overview public API endpoints. */ +public class GetDeliveryOverviewMetricsBetaOutput { + public static final String SERIALIZED_NAME_TOTAL = "total"; + + @SerializedName(SERIALIZED_NAME_TOTAL) + private BigDecimal total; + + public static final String SERIALIZED_NAME_DATASET = "dataset"; + + @SerializedName(SERIALIZED_NAME_DATASET) + private List dataset = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; + + @SerializedName(SERIALIZED_NAME_PAGINATION) + private PaginationOutput pagination; + + public GetDeliveryOverviewMetricsBetaOutput() {} + + public GetDeliveryOverviewMetricsBetaOutput total(BigDecimal total) { + + this.total = total; + return this; + } + + /** + * The total number of events for the returned dataset. + * + * @return total + */ + @javax.annotation.Nonnull + public BigDecimal getTotal() { + return total; + } + + public void setTotal(BigDecimal total) { + this.total = total; + } + + public GetDeliveryOverviewMetricsBetaOutput dataset( + List dataset) { + + this.dataset = dataset; + return this; + } + + public GetDeliveryOverviewMetricsBetaOutput addDatasetItem( + DeliveryOverviewMetricsDataset datasetItem) { + if (this.dataset == null) { + this.dataset = new ArrayList<>(); + } + this.dataset.add(datasetItem); + return this; + } + + /** + * Represents the list of series broken down by the dimensions and time frame requested. + * + * @return dataset + */ + @javax.annotation.Nonnull + public List getDataset() { + return dataset; + } + + public void setDataset(List dataset) { + this.dataset = dataset; + } + + public GetDeliveryOverviewMetricsBetaOutput pagination(PaginationOutput pagination) { + + this.pagination = pagination; + return this; + } + + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nonnull + public PaginationOutput getPagination() { + return pagination; + } + + public void setPagination(PaginationOutput pagination) { + this.pagination = pagination; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeliveryOverviewMetricsBetaOutput getDeliveryOverviewMetricsBetaOutput = + (GetDeliveryOverviewMetricsBetaOutput) o; + return Objects.equals(this.total, getDeliveryOverviewMetricsBetaOutput.total) + && Objects.equals(this.dataset, getDeliveryOverviewMetricsBetaOutput.dataset) + && Objects.equals(this.pagination, getDeliveryOverviewMetricsBetaOutput.pagination); + } + + @Override + public int hashCode() { + return Objects.hash(total, dataset, pagination); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDeliveryOverviewMetricsBetaOutput {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" dataset: ").append(toIndentedString(dataset)).append("\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("total"); + openapiFields.add("dataset"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("dataset"); + openapiRequiredFields.add("pagination"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDeliveryOverviewMetricsBetaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeliveryOverviewMetricsBetaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDeliveryOverviewMetricsBetaOutput" + + " is not found in the empty JSON string", + GetDeliveryOverviewMetricsBetaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDeliveryOverviewMetricsBetaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDeliveryOverviewMetricsBetaOutput` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetDeliveryOverviewMetricsBetaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("dataset").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `dataset` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("dataset").toString())); + } + + JsonArray jsonArraydataset = jsonObj.getAsJsonArray("dataset"); + // validate the required field `dataset` (array) + for (int i = 0; i < jsonArraydataset.size(); i++) { + DeliveryOverviewMetricsDataset.validateJsonElement(jsonArraydataset.get(i)); + } + ; + // validate the required field `pagination` + PaginationOutput.validateJsonElement(jsonObj.get("pagination")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeliveryOverviewMetricsBetaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDeliveryOverviewMetricsBetaOutput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDeliveryOverviewMetricsBetaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetDeliveryOverviewMetricsBetaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDeliveryOverviewMetricsBetaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDeliveryOverviewMetricsBetaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDeliveryOverviewMetricsBetaOutput + * @throws IOException if the JSON string is invalid with respect to + * GetDeliveryOverviewMetricsBetaOutput + */ + public static GetDeliveryOverviewMetricsBetaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetDeliveryOverviewMetricsBetaOutput.class); + } + + /** + * Convert an instance of GetDeliveryOverviewMetricsBetaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDestination200Response.java b/src/main/java/com/segment/publicapi/models/GetDestination200Response.java index 81cda05d..ef280676 100644 --- a/src/main/java/com/segment/publicapi/models/GetDestination200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetDestination200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetDestinationV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetDestination200Response - */ - +/** GetDestination200Response */ public class GetDestination200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetDestinationV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetDestination200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetDestinationV1Output data; - public GetDestination200Response data(GetDestinationV1Output data) { - - this.data = data; - return this; - } + public GetDestination200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetDestination200Response data(GetDestinationV1Output data) { - public GetDestinationV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetDestinationV1Output getData() { + return data; + } - public void setData(GetDestinationV1Output data) { - this.data = data; - } + public void setData(GetDestinationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDestination200Response getDestination200Response = (GetDestination200Response) o; + return Objects.equals(this.data, getDestination200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDestination200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDestination200Response getDestination200Response = (GetDestination200Response) o; - return Objects.equals(this.data, getDestination200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDestination200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDestination200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDestination200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDestination200Response is not found in the empty JSON string", GetDestination200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetDestination200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDestination200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDestination200Response is not found" + + " in the empty JSON string", + GetDestination200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDestination200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDestination200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDestination200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDestination200Response` 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()) { + GetDestinationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDestination200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDestination200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDestination200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDestination200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDestination200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDestination200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDestination200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetDestination200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDestination200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDestination200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDestination200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDestination200Response + * @throws IOException if the JSON string is invalid with respect to GetDestination200Response + */ + public static GetDestination200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDestination200Response.class); } - } - - /** - * Create an instance of GetDestination200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDestination200Response - * @throws IOException if the JSON string is invalid with respect to GetDestination200Response - */ - public static GetDestination200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDestination200Response.class); - } - - /** - * Convert an instance of GetDestination200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDestination200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDestinationMetadata200Response.java b/src/main/java/com/segment/publicapi/models/GetDestinationMetadata200Response.java index fff6bf73..4a969ff9 100644 --- a/src/main/java/com/segment/publicapi/models/GetDestinationMetadata200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetDestinationMetadata200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,192 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetDestinationMetadataV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetDestinationMetadata200Response - */ - +/** GetDestinationMetadata200Response */ public class GetDestinationMetadata200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetDestinationMetadataV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetDestinationMetadata200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetDestinationMetadataV1Output data; - public GetDestinationMetadata200Response data(GetDestinationMetadataV1Output data) { - - this.data = data; - return this; - } + public GetDestinationMetadata200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetDestinationMetadata200Response data(GetDestinationMetadataV1Output data) { - public GetDestinationMetadataV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetDestinationMetadataV1Output getData() { + return data; + } - public void setData(GetDestinationMetadataV1Output data) { - this.data = data; - } + public void setData(GetDestinationMetadataV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDestinationMetadata200Response getDestinationMetadata200Response = + (GetDestinationMetadata200Response) o; + return Objects.equals(this.data, getDestinationMetadata200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDestinationMetadata200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDestinationMetadata200Response getDestinationMetadata200Response = (GetDestinationMetadata200Response) o; - return Objects.equals(this.data, getDestinationMetadata200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDestinationMetadata200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDestinationMetadata200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDestinationMetadata200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDestinationMetadata200Response is not found in the empty JSON string", GetDestinationMetadata200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDestinationMetadata200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDestinationMetadata200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDestinationMetadata200Response is" + + " not found in the empty JSON string", + GetDestinationMetadata200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDestinationMetadata200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDestinationMetadata200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDestinationMetadata200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDestinationMetadata200Response` 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()) { + GetDestinationMetadataV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDestinationMetadata200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDestinationMetadata200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDestinationMetadata200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDestinationMetadata200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDestinationMetadata200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDestinationMetadata200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDestinationMetadata200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDestinationMetadata200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDestinationMetadata200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDestinationMetadata200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDestinationMetadata200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDestinationMetadata200Response + * @throws IOException if the JSON string is invalid with respect to + * GetDestinationMetadata200Response + */ + public static GetDestinationMetadata200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDestinationMetadata200Response.class); } - } - - /** - * Create an instance of GetDestinationMetadata200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDestinationMetadata200Response - * @throws IOException if the JSON string is invalid with respect to GetDestinationMetadata200Response - */ - public static GetDestinationMetadata200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDestinationMetadata200Response.class); - } - - /** - * Convert an instance of GetDestinationMetadata200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDestinationMetadata200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDestinationMetadataV1Output.java b/src/main/java/com/segment/publicapi/models/GetDestinationMetadataV1Output.java index d68a1f2a..6bc88da2 100644 --- a/src/main/java/com/segment/publicapi/models/GetDestinationMetadataV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetDestinationMetadataV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,204 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DestinationMetadata; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a Destination catalog item. - */ -@ApiModel(description = "Returns a Destination catalog item.") - +/** Returns a Destination catalog item. */ public class GetDestinationMetadataV1Output { - public static final String SERIALIZED_NAME_DESTINATION_METADATA = "destinationMetadata"; - @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA) - private DestinationMetadata destinationMetadata; + public static final String SERIALIZED_NAME_DESTINATION_METADATA = "destinationMetadata"; - public GetDestinationMetadataV1Output() { - } + @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA) + private DestinationMetadataV1 destinationMetadata; - public GetDestinationMetadataV1Output destinationMetadata(DestinationMetadata destinationMetadata) { - - this.destinationMetadata = destinationMetadata; - return this; - } + public GetDestinationMetadataV1Output() {} - /** - * Get destinationMetadata - * @return destinationMetadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetDestinationMetadataV1Output destinationMetadata( + DestinationMetadataV1 destinationMetadata) { - public DestinationMetadata getDestinationMetadata() { - return destinationMetadata; - } + this.destinationMetadata = destinationMetadata; + return this; + } + /** + * Get destinationMetadata + * + * @return destinationMetadata + */ + @javax.annotation.Nonnull + public DestinationMetadataV1 getDestinationMetadata() { + return destinationMetadata; + } - public void setDestinationMetadata(DestinationMetadata destinationMetadata) { - this.destinationMetadata = destinationMetadata; - } + public void setDestinationMetadata(DestinationMetadataV1 destinationMetadata) { + this.destinationMetadata = destinationMetadata; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDestinationMetadataV1Output getDestinationMetadataV1Output = + (GetDestinationMetadataV1Output) o; + return Objects.equals( + this.destinationMetadata, getDestinationMetadataV1Output.destinationMetadata); + } + @Override + public int hashCode() { + return Objects.hash(destinationMetadata); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDestinationMetadataV1Output {\n"); + sb.append(" destinationMetadata: ") + .append(toIndentedString(destinationMetadata)) + .append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDestinationMetadataV1Output getDestinationMetadataV1Output = (GetDestinationMetadataV1Output) o; - return Objects.equals(this.destinationMetadata, getDestinationMetadataV1Output.destinationMetadata); - } - - @Override - public int hashCode() { - return Objects.hash(destinationMetadata); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDestinationMetadataV1Output {\n"); - sb.append(" destinationMetadata: ").append(toIndentedString(destinationMetadata)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("destinationMetadata"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("destinationMetadata"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("destinationMetadata"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("destinationMetadata"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDestinationMetadataV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDestinationMetadataV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDestinationMetadataV1Output is not found in the empty JSON string", GetDestinationMetadataV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDestinationMetadataV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDestinationMetadataV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDestinationMetadataV1Output is not" + + " found in the empty JSON string", + GetDestinationMetadataV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDestinationMetadataV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDestinationMetadataV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDestinationMetadataV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDestinationMetadataV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetDestinationMetadataV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetDestinationMetadataV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `destinationMetadata` + DestinationMetadataV1.validateJsonElement(jsonObj.get("destinationMetadata")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDestinationMetadataV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDestinationMetadataV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDestinationMetadataV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDestinationMetadataV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDestinationMetadataV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDestinationMetadataV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDestinationMetadataV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDestinationMetadataV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDestinationMetadataV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDestinationMetadataV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDestinationMetadataV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDestinationMetadataV1Output + * @throws IOException if the JSON string is invalid with respect to + * GetDestinationMetadataV1Output + */ + public static GetDestinationMetadataV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDestinationMetadataV1Output.class); } - } - - /** - * Create an instance of GetDestinationMetadataV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDestinationMetadataV1Output - * @throws IOException if the JSON string is invalid with respect to GetDestinationMetadataV1Output - */ - public static GetDestinationMetadataV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDestinationMetadataV1Output.class); - } - - /** - * Convert an instance of GetDestinationMetadataV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDestinationMetadataV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDestinationV1Output.java b/src/main/java/com/segment/publicapi/models/GetDestinationV1Output.java index c5820bc8..9f490d43 100644 --- a/src/main/java/com/segment/publicapi/models/GetDestinationV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetDestinationV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Destination; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a single Destination by its id. - */ -@ApiModel(description = "Returns a single Destination by its id.") - +/** Returns a single Destination by its id. */ public class GetDestinationV1Output { - public static final String SERIALIZED_NAME_DESTINATION = "destination"; - @SerializedName(SERIALIZED_NAME_DESTINATION) - private Destination destination; + public static final String SERIALIZED_NAME_DESTINATION = "destination"; - public GetDestinationV1Output() { - } + @SerializedName(SERIALIZED_NAME_DESTINATION) + private DestinationV1 destination; - public GetDestinationV1Output destination(Destination destination) { - - this.destination = destination; - return this; - } + public GetDestinationV1Output() {} - /** - * Get destination - * @return destination - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetDestinationV1Output destination(DestinationV1 destination) { - public Destination getDestination() { - return destination; - } + this.destination = destination; + return this; + } + /** + * Get destination + * + * @return destination + */ + @javax.annotation.Nonnull + public DestinationV1 getDestination() { + return destination; + } - public void setDestination(Destination destination) { - this.destination = destination; - } + public void setDestination(DestinationV1 destination) { + this.destination = destination; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDestinationV1Output getDestinationV1Output = (GetDestinationV1Output) o; + return Objects.equals(this.destination, getDestinationV1Output.destination); + } + @Override + public int hashCode() { + return Objects.hash(destination); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDestinationV1Output {\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDestinationV1Output getDestinationV1Output = (GetDestinationV1Output) o; - return Objects.equals(this.destination, getDestinationV1Output.destination); - } - - @Override - public int hashCode() { - return Objects.hash(destination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDestinationV1Output {\n"); - sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("destination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("destination"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("destination"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("destination"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDestinationV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDestinationV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDestinationV1Output is not found in the empty JSON string", GetDestinationV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetDestinationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDestinationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDestinationV1Output is not found in" + + " the empty JSON string", + GetDestinationV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDestinationV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDestinationV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDestinationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDestinationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetDestinationV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetDestinationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `destination` + DestinationV1.validateJsonElement(jsonObj.get("destination")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDestinationV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDestinationV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDestinationV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDestinationV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDestinationV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDestinationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDestinationV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetDestinationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDestinationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDestinationV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDestinationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDestinationV1Output + * @throws IOException if the JSON string is invalid with respect to GetDestinationV1Output + */ + public static GetDestinationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDestinationV1Output.class); } - } - - /** - * Create an instance of GetDestinationV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDestinationV1Output - * @throws IOException if the JSON string is invalid with respect to GetDestinationV1Output - */ - public static GetDestinationV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDestinationV1Output.class); - } - - /** - * Convert an instance of GetDestinationV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDestinationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDestinationsCatalog200Response.java b/src/main/java/com/segment/publicapi/models/GetDestinationsCatalog200Response.java index edc048f2..df62a2e3 100644 --- a/src/main/java/com/segment/publicapi/models/GetDestinationsCatalog200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetDestinationsCatalog200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,192 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetDestinationsCatalogV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetDestinationsCatalog200Response - */ - +/** GetDestinationsCatalog200Response */ public class GetDestinationsCatalog200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetDestinationsCatalogV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetDestinationsCatalog200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetDestinationsCatalogV1Output data; - public GetDestinationsCatalog200Response data(GetDestinationsCatalogV1Output data) { - - this.data = data; - return this; - } + public GetDestinationsCatalog200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetDestinationsCatalog200Response data(GetDestinationsCatalogV1Output data) { - public GetDestinationsCatalogV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetDestinationsCatalogV1Output getData() { + return data; + } - public void setData(GetDestinationsCatalogV1Output data) { - this.data = data; - } + public void setData(GetDestinationsCatalogV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDestinationsCatalog200Response getDestinationsCatalog200Response = + (GetDestinationsCatalog200Response) o; + return Objects.equals(this.data, getDestinationsCatalog200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDestinationsCatalog200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDestinationsCatalog200Response getDestinationsCatalog200Response = (GetDestinationsCatalog200Response) o; - return Objects.equals(this.data, getDestinationsCatalog200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDestinationsCatalog200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDestinationsCatalog200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDestinationsCatalog200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDestinationsCatalog200Response is not found in the empty JSON string", GetDestinationsCatalog200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDestinationsCatalog200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDestinationsCatalog200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDestinationsCatalog200Response is" + + " not found in the empty JSON string", + GetDestinationsCatalog200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDestinationsCatalog200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDestinationsCatalog200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDestinationsCatalog200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDestinationsCatalog200Response` 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()) { + GetDestinationsCatalogV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDestinationsCatalog200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDestinationsCatalog200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDestinationsCatalog200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDestinationsCatalog200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDestinationsCatalog200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDestinationsCatalog200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDestinationsCatalog200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDestinationsCatalog200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDestinationsCatalog200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDestinationsCatalog200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDestinationsCatalog200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDestinationsCatalog200Response + * @throws IOException if the JSON string is invalid with respect to + * GetDestinationsCatalog200Response + */ + public static GetDestinationsCatalog200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDestinationsCatalog200Response.class); } - } - - /** - * Create an instance of GetDestinationsCatalog200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDestinationsCatalog200Response - * @throws IOException if the JSON string is invalid with respect to GetDestinationsCatalog200Response - */ - public static GetDestinationsCatalog200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDestinationsCatalog200Response.class); - } - - /** - * Convert an instance of GetDestinationsCatalog200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDestinationsCatalog200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetDestinationsCatalogV1Output.java b/src/main/java/com/segment/publicapi/models/GetDestinationsCatalogV1Output.java index af4e3cf2..0a48727d 100644 --- a/src/main/java/com/segment/publicapi/models/GetDestinationsCatalogV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetDestinationsCatalogV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,251 +9,261 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DestinationMetadataV1; -import com.segment.publicapi.models.Pagination; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a list of all Destination catalog items contained within a given page. - */ -@ApiModel(description = "Returns a list of all Destination catalog items contained within a given page.") - +/** Returns a list of all Destination catalog items contained within a given page. */ public class GetDestinationsCatalogV1Output { - public static final String SERIALIZED_NAME_DESTINATIONS_CATALOG = "destinationsCatalog"; - @SerializedName(SERIALIZED_NAME_DESTINATIONS_CATALOG) - private List destinationsCatalog = new ArrayList<>(); + public static final String SERIALIZED_NAME_DESTINATIONS_CATALOG = "destinationsCatalog"; - public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - @SerializedName(SERIALIZED_NAME_PAGINATION) - private Pagination pagination; + @SerializedName(SERIALIZED_NAME_DESTINATIONS_CATALOG) + private List destinationsCatalog = new ArrayList<>(); - public GetDestinationsCatalogV1Output() { - } + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - public GetDestinationsCatalogV1Output destinationsCatalog(List destinationsCatalog) { - - this.destinationsCatalog = destinationsCatalog; - return this; - } + @SerializedName(SERIALIZED_NAME_PAGINATION) + private PaginationOutput pagination; - public GetDestinationsCatalogV1Output addDestinationsCatalogItem(DestinationMetadataV1 destinationsCatalogItem) { - this.destinationsCatalog.add(destinationsCatalogItem); - return this; - } + public GetDestinationsCatalogV1Output() {} - /** - * All Destination catalog items contained within the requested page. - * @return destinationsCatalog - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "All Destination catalog items contained within the requested page.") - - public List getDestinationsCatalog() { - return destinationsCatalog; - } + public GetDestinationsCatalogV1Output destinationsCatalog( + List destinationsCatalog) { + this.destinationsCatalog = destinationsCatalog; + return this; + } - public void setDestinationsCatalog(List destinationsCatalog) { - this.destinationsCatalog = destinationsCatalog; - } + public GetDestinationsCatalogV1Output addDestinationsCatalogItem( + DestinationMetadataV1 destinationsCatalogItem) { + if (this.destinationsCatalog == null) { + this.destinationsCatalog = new ArrayList<>(); + } + this.destinationsCatalog.add(destinationsCatalogItem); + return this; + } + /** + * All Destination catalog items contained within the requested page. + * + * @return destinationsCatalog + */ + @javax.annotation.Nonnull + public List getDestinationsCatalog() { + return destinationsCatalog; + } - public GetDestinationsCatalogV1Output pagination(Pagination pagination) { - - this.pagination = pagination; - return this; - } + public void setDestinationsCatalog(List destinationsCatalog) { + this.destinationsCatalog = destinationsCatalog; + } - /** - * Get pagination - * @return pagination - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetDestinationsCatalogV1Output pagination(PaginationOutput pagination) { - public Pagination getPagination() { - return pagination; - } + this.pagination = pagination; + return this; + } + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nonnull + public PaginationOutput getPagination() { + return pagination; + } - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } + public void setPagination(PaginationOutput pagination) { + this.pagination = pagination; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDestinationsCatalogV1Output getDestinationsCatalogV1Output = + (GetDestinationsCatalogV1Output) o; + return Objects.equals( + this.destinationsCatalog, + getDestinationsCatalogV1Output.destinationsCatalog) + && Objects.equals(this.pagination, getDestinationsCatalogV1Output.pagination); + } + @Override + public int hashCode() { + return Objects.hash(destinationsCatalog, pagination); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDestinationsCatalogV1Output {\n"); + sb.append(" destinationsCatalog: ") + .append(toIndentedString(destinationsCatalog)) + .append("\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetDestinationsCatalogV1Output getDestinationsCatalogV1Output = (GetDestinationsCatalogV1Output) o; - return Objects.equals(this.destinationsCatalog, getDestinationsCatalogV1Output.destinationsCatalog) && - Objects.equals(this.pagination, getDestinationsCatalogV1Output.pagination); - } - - @Override - public int hashCode() { - return Objects.hash(destinationsCatalog, pagination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetDestinationsCatalogV1Output {\n"); - sb.append(" destinationsCatalog: ").append(toIndentedString(destinationsCatalog)).append("\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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("destinationsCatalog"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("destinationsCatalog"); + openapiRequiredFields.add("pagination"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("destinationsCatalog"); - openapiFields.add("pagination"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("destinationsCatalog"); - openapiRequiredFields.add("pagination"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetDestinationsCatalogV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetDestinationsCatalogV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetDestinationsCatalogV1Output is not found in the empty JSON string", GetDestinationsCatalogV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetDestinationsCatalogV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDestinationsCatalogV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetDestinationsCatalogV1Output is not" + + " found in the empty JSON string", + GetDestinationsCatalogV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetDestinationsCatalogV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDestinationsCatalogV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDestinationsCatalogV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetDestinationsCatalogV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetDestinationsCatalogV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetDestinationsCatalogV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("destinationsCatalog").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `destinationsCatalog` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("destinationsCatalog").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("destinationsCatalog").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationsCatalog` to be an array in the JSON string but got `%s`", jsonObj.get("destinationsCatalog").toString())); - } - JsonArray jsonArraydestinationsCatalog = jsonObj.getAsJsonArray("destinationsCatalog"); - } + JsonArray jsonArraydestinationsCatalog = jsonObj.getAsJsonArray("destinationsCatalog"); + // validate the required field `destinationsCatalog` (array) + for (int i = 0; i < jsonArraydestinationsCatalog.size(); i++) { + DestinationMetadataV1.validateJsonElement(jsonArraydestinationsCatalog.get(i)); + } + ; + // validate the required field `pagination` + PaginationOutput.validateJsonElement(jsonObj.get("pagination")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetDestinationsCatalogV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetDestinationsCatalogV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetDestinationsCatalogV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetDestinationsCatalogV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetDestinationsCatalogV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDestinationsCatalogV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDestinationsCatalogV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetDestinationsCatalogV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDestinationsCatalogV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDestinationsCatalogV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetDestinationsCatalogV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDestinationsCatalogV1Output + * @throws IOException if the JSON string is invalid with respect to + * GetDestinationsCatalogV1Output + */ + public static GetDestinationsCatalogV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDestinationsCatalogV1Output.class); } - } - - /** - * Create an instance of GetDestinationsCatalogV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetDestinationsCatalogV1Output - * @throws IOException if the JSON string is invalid with respect to GetDestinationsCatalogV1Output - */ - public static GetDestinationsCatalogV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetDestinationsCatalogV1Output.class); - } - - /** - * Convert an instance of GetDestinationsCatalogV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetDestinationsCatalogV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetEgressFailedMetricsFromDeliveryOverview200Response.java b/src/main/java/com/segment/publicapi/models/GetEgressFailedMetricsFromDeliveryOverview200Response.java new file mode 100644 index 00000000..9d1c0b31 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetEgressFailedMetricsFromDeliveryOverview200Response.java @@ -0,0 +1,217 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetEgressFailedMetricsFromDeliveryOverview200Response */ +public class GetEgressFailedMetricsFromDeliveryOverview200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetDeliveryOverviewMetricsBetaOutput data; + + public GetEgressFailedMetricsFromDeliveryOverview200Response() {} + + public GetEgressFailedMetricsFromDeliveryOverview200Response data( + GetDeliveryOverviewMetricsBetaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetDeliveryOverviewMetricsBetaOutput getData() { + return data; + } + + public void setData(GetDeliveryOverviewMetricsBetaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetEgressFailedMetricsFromDeliveryOverview200Response + getEgressFailedMetricsFromDeliveryOverview200Response = + (GetEgressFailedMetricsFromDeliveryOverview200Response) o; + return Objects.equals( + this.data, getEgressFailedMetricsFromDeliveryOverview200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetEgressFailedMetricsFromDeliveryOverview200Response {\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 + * GetEgressFailedMetricsFromDeliveryOverview200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetEgressFailedMetricsFromDeliveryOverview200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetEgressFailedMetricsFromDeliveryOverview200Response is" + + " not found in the empty JSON string", + GetEgressFailedMetricsFromDeliveryOverview200Response + .openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetEgressFailedMetricsFromDeliveryOverview200Response.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetEgressFailedMetricsFromDeliveryOverview200Response`" + + " 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()) { + GetDeliveryOverviewMetricsBetaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetEgressFailedMetricsFromDeliveryOverview200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetEgressFailedMetricsFromDeliveryOverview200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + GetEgressFailedMetricsFromDeliveryOverview200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + GetEgressFailedMetricsFromDeliveryOverview200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetEgressFailedMetricsFromDeliveryOverview200Response read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetEgressFailedMetricsFromDeliveryOverview200Response given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of GetEgressFailedMetricsFromDeliveryOverview200Response + * @throws IOException if the JSON string is invalid with respect to + * GetEgressFailedMetricsFromDeliveryOverview200Response + */ + public static GetEgressFailedMetricsFromDeliveryOverview200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, GetEgressFailedMetricsFromDeliveryOverview200Response.class); + } + + /** + * Convert an instance of GetEgressFailedMetricsFromDeliveryOverview200Response to an JSON + * string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetEventsVolumeFromWorkspace200Response.java b/src/main/java/com/segment/publicapi/models/GetEventsVolumeFromWorkspace200Response.java index e95d48d7..f346ef8d 100644 --- a/src/main/java/com/segment/publicapi/models/GetEventsVolumeFromWorkspace200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetEventsVolumeFromWorkspace200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,197 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetEventsVolumeFromWorkspaceV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetEventsVolumeFromWorkspace200Response - */ - +/** GetEventsVolumeFromWorkspace200Response */ public class GetEventsVolumeFromWorkspace200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetEventsVolumeFromWorkspaceV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetEventsVolumeFromWorkspace200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetEventsVolumeFromWorkspaceV1Output data; - public GetEventsVolumeFromWorkspace200Response data(GetEventsVolumeFromWorkspaceV1Output data) { - - this.data = data; - return this; - } + public GetEventsVolumeFromWorkspace200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetEventsVolumeFromWorkspace200Response data(GetEventsVolumeFromWorkspaceV1Output data) { - public GetEventsVolumeFromWorkspaceV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetEventsVolumeFromWorkspaceV1Output getData() { + return data; + } - public void setData(GetEventsVolumeFromWorkspaceV1Output data) { - this.data = data; - } + public void setData(GetEventsVolumeFromWorkspaceV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetEventsVolumeFromWorkspace200Response getEventsVolumeFromWorkspace200Response = + (GetEventsVolumeFromWorkspace200Response) o; + return Objects.equals(this.data, getEventsVolumeFromWorkspace200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetEventsVolumeFromWorkspace200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetEventsVolumeFromWorkspace200Response getEventsVolumeFromWorkspace200Response = (GetEventsVolumeFromWorkspace200Response) o; - return Objects.equals(this.data, getEventsVolumeFromWorkspace200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetEventsVolumeFromWorkspace200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetEventsVolumeFromWorkspace200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetEventsVolumeFromWorkspace200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetEventsVolumeFromWorkspace200Response is not found in the empty JSON string", GetEventsVolumeFromWorkspace200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetEventsVolumeFromWorkspace200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetEventsVolumeFromWorkspace200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetEventsVolumeFromWorkspace200Response is not found in the" + + " empty JSON string", + GetEventsVolumeFromWorkspace200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetEventsVolumeFromWorkspace200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetEventsVolumeFromWorkspace200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetEventsVolumeFromWorkspace200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetEventsVolumeFromWorkspace200Response` 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()) { + GetEventsVolumeFromWorkspaceV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetEventsVolumeFromWorkspace200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetEventsVolumeFromWorkspace200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetEventsVolumeFromWorkspace200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetEventsVolumeFromWorkspace200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetEventsVolumeFromWorkspace200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetEventsVolumeFromWorkspace200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'GetEventsVolumeFromWorkspace200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetEventsVolumeFromWorkspace200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetEventsVolumeFromWorkspace200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetEventsVolumeFromWorkspace200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetEventsVolumeFromWorkspace200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetEventsVolumeFromWorkspace200Response + * @throws IOException if the JSON string is invalid with respect to + * GetEventsVolumeFromWorkspace200Response + */ + public static GetEventsVolumeFromWorkspace200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetEventsVolumeFromWorkspace200Response.class); } - } - - /** - * Create an instance of GetEventsVolumeFromWorkspace200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetEventsVolumeFromWorkspace200Response - * @throws IOException if the JSON string is invalid with respect to GetEventsVolumeFromWorkspace200Response - */ - public static GetEventsVolumeFromWorkspace200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetEventsVolumeFromWorkspace200Response.class); - } - - /** - * Convert an instance of GetEventsVolumeFromWorkspace200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetEventsVolumeFromWorkspace200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetEventsVolumeFromWorkspaceV1Output.java b/src/main/java/com/segment/publicapi/models/GetEventsVolumeFromWorkspaceV1Output.java index c1442717..69d5a9f1 100644 --- a/src/main/java/com/segment/publicapi/models/GetEventsVolumeFromWorkspaceV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetEventsVolumeFromWorkspaceV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,250 +9,329 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Pagination; -import com.segment.publicapi.models.SourceEventVolumeV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** GetEventsVolumeFromWorkspaceV1Output represents the results given the input query. */ +public class GetEventsVolumeFromWorkspaceV1Output { + public static final String SERIALIZED_NAME_PATH = "path"; -/** - * GetEventsVolumeFromWorkspaceV1Output represents the results given the input query. - */ -@ApiModel(description = "GetEventsVolumeFromWorkspaceV1Output represents the results given the input query.") + @SerializedName(SERIALIZED_NAME_PATH) + private String path; -public class GetEventsVolumeFromWorkspaceV1Output { - public static final String SERIALIZED_NAME_RESULT = "result"; - @SerializedName(SERIALIZED_NAME_RESULT) - private List result = new ArrayList<>(); + public static final String SERIALIZED_NAME_QUERY = "query"; - public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - @SerializedName(SERIALIZED_NAME_PAGINATION) - private Pagination pagination; + @SerializedName(SERIALIZED_NAME_QUERY) + private GetEventsVolumeFromWorkspaceV1Query query; - public GetEventsVolumeFromWorkspaceV1Output() { - } + public static final String SERIALIZED_NAME_RESULT = "result"; - public GetEventsVolumeFromWorkspaceV1Output result(List result) { - - this.result = result; - return this; - } + @SerializedName(SERIALIZED_NAME_RESULT) + private List result = new ArrayList<>(); - public GetEventsVolumeFromWorkspaceV1Output addResultItem(SourceEventVolumeV1 resultItem) { - this.result.add(resultItem); - return this; - } + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - /** - * The resultant list of series broken down by the dimensions requested over the time frame requested and ordered by the total count of events in all series. Note: The limit of entries returned is 5000. - * @return result - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The resultant list of series broken down by the dimensions requested over the time frame requested and ordered by the total count of events in all series. Note: The limit of entries returned is 5000.") + @SerializedName(SERIALIZED_NAME_PAGINATION) + private PaginationOutput pagination; - public List getResult() { - return result; - } + public GetEventsVolumeFromWorkspaceV1Output() {} + public GetEventsVolumeFromWorkspaceV1Output path(String path) { - public void setResult(List result) { - this.result = result; - } + this.path = path; + return this; + } + /** + * Observability event volume path. + * + * @return path + */ + @javax.annotation.Nonnull + public String getPath() { + return path; + } - public GetEventsVolumeFromWorkspaceV1Output pagination(Pagination pagination) { - - this.pagination = pagination; - return this; - } + public void setPath(String path) { + this.path = path; + } - /** - * Get pagination - * @return pagination - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetEventsVolumeFromWorkspaceV1Output query(GetEventsVolumeFromWorkspaceV1Query query) { - public Pagination getPagination() { - return pagination; - } + this.query = query; + return this; + } + /** + * Get query + * + * @return query + */ + @javax.annotation.Nonnull + public GetEventsVolumeFromWorkspaceV1Query getQuery() { + return query; + } - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } + public void setQuery(GetEventsVolumeFromWorkspaceV1Query query) { + this.query = query; + } + public GetEventsVolumeFromWorkspaceV1Output result(List result) { + this.result = result; + return this; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + public GetEventsVolumeFromWorkspaceV1Output addResultItem(SourceEventVolumeV1 resultItem) { + if (this.result == null) { + this.result = new ArrayList<>(); + } + this.result.add(resultItem); + return this; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * The resultant list of series broken down by the dimensions requested over the time frame + * requested and ordered by the total count of events in all series. Note: The limit of entries + * returned is 5000. + * + * @return result + */ + @javax.annotation.Nonnull + public List getResult() { + return result; } - GetEventsVolumeFromWorkspaceV1Output getEventsVolumeFromWorkspaceV1Output = (GetEventsVolumeFromWorkspaceV1Output) o; - return Objects.equals(this.result, getEventsVolumeFromWorkspaceV1Output.result) && - Objects.equals(this.pagination, getEventsVolumeFromWorkspaceV1Output.pagination); - } - - @Override - public int hashCode() { - return Objects.hash(result, pagination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetEventsVolumeFromWorkspaceV1Output {\n"); - sb.append(" result: ").append(toIndentedString(result)).append("\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"; + + public void setResult(List result) { + this.result = result; } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("result"); - openapiFields.add("pagination"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("result"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetEventsVolumeFromWorkspaceV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetEventsVolumeFromWorkspaceV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetEventsVolumeFromWorkspaceV1Output is not found in the empty JSON string", GetEventsVolumeFromWorkspaceV1Output.openapiRequiredFields.toString())); + + public GetEventsVolumeFromWorkspaceV1Output pagination(PaginationOutput pagination) { + + this.pagination = pagination; + return this; + } + + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nullable + public PaginationOutput getPagination() { + return pagination; + } + + public void setPagination(PaginationOutput pagination) { + this.pagination = pagination; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetEventsVolumeFromWorkspaceV1Output getEventsVolumeFromWorkspaceV1Output = + (GetEventsVolumeFromWorkspaceV1Output) o; + return Objects.equals(this.path, getEventsVolumeFromWorkspaceV1Output.path) + && Objects.equals(this.query, getEventsVolumeFromWorkspaceV1Output.query) + && Objects.equals(this.result, getEventsVolumeFromWorkspaceV1Output.result) + && Objects.equals(this.pagination, getEventsVolumeFromWorkspaceV1Output.pagination); + } + + @Override + public int hashCode() { + return Objects.hash(path, query, result, pagination); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetEventsVolumeFromWorkspaceV1Output {\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\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("path"); + openapiFields.add("query"); + openapiFields.add("result"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("path"); + openapiRequiredFields.add("query"); + openapiRequiredFields.add("result"); + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetEventsVolumeFromWorkspaceV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetEventsVolumeFromWorkspaceV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetEventsVolumeFromWorkspaceV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetEventsVolumeFromWorkspaceV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetEventsVolumeFromWorkspaceV1Output" + + " is not found in the empty JSON string", + GetEventsVolumeFromWorkspaceV1Output.openapiRequiredFields + .toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetEventsVolumeFromWorkspaceV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetEventsVolumeFromWorkspaceV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetEventsVolumeFromWorkspaceV1Output` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - // ensure the json data is an array - if (!jsonObj.get("result").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `result` to be an array in the JSON string but got `%s`", jsonObj.get("result").toString())); - } - JsonArray jsonArrayresult = jsonObj.getAsJsonArray("result"); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetEventsVolumeFromWorkspaceV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("path").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `path` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("path").toString())); + } + // validate the required field `query` + GetEventsVolumeFromWorkspaceV1Query.validateJsonElement(jsonObj.get("query")); + // ensure the json data is an array + if (!jsonObj.get("result").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `result` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("result").toString())); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetEventsVolumeFromWorkspaceV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetEventsVolumeFromWorkspaceV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetEventsVolumeFromWorkspaceV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetEventsVolumeFromWorkspaceV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetEventsVolumeFromWorkspaceV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + JsonArray jsonArrayresult = jsonObj.getAsJsonArray("result"); + // validate the required field `result` (array) + for (int i = 0; i < jsonArrayresult.size(); i++) { + SourceEventVolumeV1.validateJsonElement(jsonArrayresult.get(i)); + } + ; + // validate the optional field `pagination` + if (jsonObj.get("pagination") != null && !jsonObj.get("pagination").isJsonNull()) { + PaginationOutput.validateJsonElement(jsonObj.get("pagination")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetEventsVolumeFromWorkspaceV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetEventsVolumeFromWorkspaceV1Output' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetEventsVolumeFromWorkspaceV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetEventsVolumeFromWorkspaceV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetEventsVolumeFromWorkspaceV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } } - } - - /** - * Create an instance of GetEventsVolumeFromWorkspaceV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetEventsVolumeFromWorkspaceV1Output - * @throws IOException if the JSON string is invalid with respect to GetEventsVolumeFromWorkspaceV1Output - */ - public static GetEventsVolumeFromWorkspaceV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetEventsVolumeFromWorkspaceV1Output.class); - } - - /** - * Convert an instance of GetEventsVolumeFromWorkspaceV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of GetEventsVolumeFromWorkspaceV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetEventsVolumeFromWorkspaceV1Output + * @throws IOException if the JSON string is invalid with respect to + * GetEventsVolumeFromWorkspaceV1Output + */ + public static GetEventsVolumeFromWorkspaceV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetEventsVolumeFromWorkspaceV1Output.class); + } + + /** + * Convert an instance of GetEventsVolumeFromWorkspaceV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetEventsVolumeFromWorkspaceV1Query.java b/src/main/java/com/segment/publicapi/models/GetEventsVolumeFromWorkspaceV1Query.java new file mode 100644 index 00000000..839b6689 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetEventsVolumeFromWorkspaceV1Query.java @@ -0,0 +1,649 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetEventVolumeOutputQuery represents the input query sent to output. */ +public class GetEventsVolumeFromWorkspaceV1Query { + public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; + + @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) + private String workspaceId; + + /** Granularity corresponds to the requested bucket granularity. */ + @JsonAdapter(GranularityEnum.Adapter.class) + public enum GranularityEnum { + DAY("DAY"), + + HOUR("HOUR"), + + MINUTE("MINUTE"); + + private String value; + + GranularityEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static GranularityEnum fromValue(String value) { + for (GranularityEnum b : GranularityEnum.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 GranularityEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public GranularityEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return GranularityEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_GRANULARITY = "granularity"; + + @SerializedName(SERIALIZED_NAME_GRANULARITY) + private GranularityEnum granularity; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + + @SerializedName(SERIALIZED_NAME_START_TIME) + private String startTime; + + public static final String SERIALIZED_NAME_END_TIME = "endTime"; + + @SerializedName(SERIALIZED_NAME_END_TIME) + private String endTime; + + public static final String SERIALIZED_NAME_GROUP_BY = "groupBy"; + + @SerializedName(SERIALIZED_NAME_GROUP_BY) + private List groupBy; + + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; + + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private List sourceId; + + public static final String SERIALIZED_NAME_EVENT_NAME = "eventName"; + + @SerializedName(SERIALIZED_NAME_EVENT_NAME) + private List eventName; + + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private List eventType; + + public static final String SERIALIZED_NAME_APP_VERSION = "appVersion"; + + @SerializedName(SERIALIZED_NAME_APP_VERSION) + private List appVersion; + + public static final String SERIALIZED_NAME_LIMIT = "limit"; + + @SerializedName(SERIALIZED_NAME_LIMIT) + private BigDecimal limit; + + public GetEventsVolumeFromWorkspaceV1Query() {} + + public GetEventsVolumeFromWorkspaceV1Query workspaceId(String workspaceId) { + + this.workspaceId = workspaceId; + return this; + } + + /** + * Workspace being requested. + * + * @return workspaceId + */ + @javax.annotation.Nonnull + public String getWorkspaceId() { + return workspaceId; + } + + public void setWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + } + + public GetEventsVolumeFromWorkspaceV1Query granularity(GranularityEnum granularity) { + + this.granularity = granularity; + return this; + } + + /** + * Granularity corresponds to the requested bucket granularity. + * + * @return granularity + */ + @javax.annotation.Nonnull + public GranularityEnum getGranularity() { + return granularity; + } + + public void setGranularity(GranularityEnum granularity) { + this.granularity = granularity; + } + + public GetEventsVolumeFromWorkspaceV1Query startTime(String startTime) { + + this.startTime = startTime; + return this; + } + + /** + * StartTime is the ISO8601 formatted timestamp corresponding to the beginning of the requested + * time frame, inclusive. + * + * @return startTime + */ + @javax.annotation.Nonnull + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public GetEventsVolumeFromWorkspaceV1Query endTime(String endTime) { + + this.endTime = endTime; + return this; + } + + /** + * EndTime is the ISO8601 formatted timestamp corresponding to the end of the requested time + * frame, noninclusive. + * + * @return endTime + */ + @javax.annotation.Nonnull + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public GetEventsVolumeFromWorkspaceV1Query groupBy(List groupBy) { + + this.groupBy = groupBy; + return this; + } + + public GetEventsVolumeFromWorkspaceV1Query addGroupByItem(String groupByItem) { + if (this.groupBy == null) { + this.groupBy = new ArrayList<>(); + } + this.groupBy.add(groupByItem); + return this; + } + + /** + * GroupBy is a comma-delimited list of strings representing the dimensions to group the result + * by. The current options are: `eventName` or `eventType`. + * + * @return groupBy + */ + @javax.annotation.Nullable + public List getGroupBy() { + return groupBy; + } + + public void setGroupBy(List groupBy) { + this.groupBy = groupBy; + } + + public GetEventsVolumeFromWorkspaceV1Query sourceId(List sourceId) { + + this.sourceId = sourceId; + return this; + } + + public GetEventsVolumeFromWorkspaceV1Query addSourceIdItem(String sourceIdItem) { + if (this.sourceId == null) { + this.sourceId = new ArrayList<>(); + } + this.sourceId.add(sourceIdItem); + return this; + } + + /** + * List of strings which allow you to restrict the result to just the given Sources. + * + * @return sourceId + */ + @javax.annotation.Nullable + public List getSourceId() { + return sourceId; + } + + public void setSourceId(List sourceId) { + this.sourceId = sourceId; + } + + public GetEventsVolumeFromWorkspaceV1Query eventName(List eventName) { + + this.eventName = eventName; + return this; + } + + public GetEventsVolumeFromWorkspaceV1Query addEventNameItem(String eventNameItem) { + if (this.eventName == null) { + this.eventName = new ArrayList<>(); + } + this.eventName.add(eventNameItem); + return this; + } + + /** + * EventName is a list of strings which allow you to restrict the result to just the given event + * names. + * + * @return eventName + */ + @javax.annotation.Nullable + public List getEventName() { + return eventName; + } + + public void setEventName(List eventName) { + this.eventName = eventName; + } + + public GetEventsVolumeFromWorkspaceV1Query eventType(List eventType) { + + this.eventType = eventType; + return this; + } + + public GetEventsVolumeFromWorkspaceV1Query addEventTypeItem(String eventTypeItem) { + if (this.eventType == null) { + this.eventType = new ArrayList<>(); + } + this.eventType.add(eventTypeItem); + return this; + } + + /** + * EventType is a list of strings which allow you to restrict the result to just the given event + * types. + * + * @return eventType + */ + @javax.annotation.Nullable + public List getEventType() { + return eventType; + } + + public void setEventType(List eventType) { + this.eventType = eventType; + } + + public GetEventsVolumeFromWorkspaceV1Query appVersion(List appVersion) { + + this.appVersion = appVersion; + return this; + } + + public GetEventsVolumeFromWorkspaceV1Query addAppVersionItem(String appVersionItem) { + if (this.appVersion == null) { + this.appVersion = new ArrayList<>(); + } + this.appVersion.add(appVersionItem); + return this; + } + + /** + * AppVersion is a list of strings which allow you to restrict the result to just the given + * application versions. + * + * @return appVersion + */ + @javax.annotation.Nullable + public List getAppVersion() { + return appVersion; + } + + public void setAppVersion(List appVersion) { + this.appVersion = appVersion; + } + + public GetEventsVolumeFromWorkspaceV1Query limit(BigDecimal limit) { + + this.limit = limit; + return this; + } + + /** + * Limit is the total number of items in the result. + * + * @return limit + */ + @javax.annotation.Nullable + public BigDecimal getLimit() { + return limit; + } + + public void setLimit(BigDecimal limit) { + this.limit = limit; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetEventsVolumeFromWorkspaceV1Query getEventsVolumeFromWorkspaceV1Query = + (GetEventsVolumeFromWorkspaceV1Query) o; + return Objects.equals(this.workspaceId, getEventsVolumeFromWorkspaceV1Query.workspaceId) + && Objects.equals(this.granularity, getEventsVolumeFromWorkspaceV1Query.granularity) + && Objects.equals(this.startTime, getEventsVolumeFromWorkspaceV1Query.startTime) + && Objects.equals(this.endTime, getEventsVolumeFromWorkspaceV1Query.endTime) + && Objects.equals(this.groupBy, getEventsVolumeFromWorkspaceV1Query.groupBy) + && Objects.equals(this.sourceId, getEventsVolumeFromWorkspaceV1Query.sourceId) + && Objects.equals(this.eventName, getEventsVolumeFromWorkspaceV1Query.eventName) + && Objects.equals(this.eventType, getEventsVolumeFromWorkspaceV1Query.eventType) + && Objects.equals(this.appVersion, getEventsVolumeFromWorkspaceV1Query.appVersion) + && Objects.equals(this.limit, getEventsVolumeFromWorkspaceV1Query.limit); + } + + @Override + public int hashCode() { + return Objects.hash( + workspaceId, + granularity, + startTime, + endTime, + groupBy, + sourceId, + eventName, + eventType, + appVersion, + limit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetEventsVolumeFromWorkspaceV1Query {\n"); + sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); + sb.append(" granularity: ").append(toIndentedString(granularity)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" groupBy: ").append(toIndentedString(groupBy)).append("\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" eventName: ").append(toIndentedString(eventName)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" appVersion: ").append(toIndentedString(appVersion)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("workspaceId"); + openapiFields.add("granularity"); + openapiFields.add("startTime"); + openapiFields.add("endTime"); + openapiFields.add("groupBy"); + openapiFields.add("sourceId"); + openapiFields.add("eventName"); + openapiFields.add("eventType"); + openapiFields.add("appVersion"); + openapiFields.add("limit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("workspaceId"); + openapiRequiredFields.add("granularity"); + openapiRequiredFields.add("startTime"); + openapiRequiredFields.add("endTime"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetEventsVolumeFromWorkspaceV1Query + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetEventsVolumeFromWorkspaceV1Query.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetEventsVolumeFromWorkspaceV1Query is" + + " not found in the empty JSON string", + GetEventsVolumeFromWorkspaceV1Query.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetEventsVolumeFromWorkspaceV1Query.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetEventsVolumeFromWorkspaceV1Query` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetEventsVolumeFromWorkspaceV1Query.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("workspaceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `workspaceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("workspaceId").toString())); + } + if (!jsonObj.get("granularity").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `granularity` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("granularity").toString())); + } + if (!jsonObj.get("startTime").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `startTime` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("startTime").toString())); + } + if (!jsonObj.get("endTime").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `endTime` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("endTime").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("groupBy") != null + && !jsonObj.get("groupBy").isJsonNull() + && !jsonObj.get("groupBy").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `groupBy` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("groupBy").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("sourceId") != null + && !jsonObj.get("sourceId").isJsonNull() + && !jsonObj.get("sourceId").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("sourceId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("eventName") != null + && !jsonObj.get("eventName").isJsonNull() + && !jsonObj.get("eventName").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventName` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("eventName").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("eventType") != null + && !jsonObj.get("eventType").isJsonNull() + && !jsonObj.get("eventType").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventType` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("eventType").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("appVersion") != null + && !jsonObj.get("appVersion").isJsonNull() + && !jsonObj.get("appVersion").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `appVersion` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("appVersion").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetEventsVolumeFromWorkspaceV1Query.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetEventsVolumeFromWorkspaceV1Query' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetEventsVolumeFromWorkspaceV1Query.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetEventsVolumeFromWorkspaceV1Query value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetEventsVolumeFromWorkspaceV1Query read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetEventsVolumeFromWorkspaceV1Query given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetEventsVolumeFromWorkspaceV1Query + * @throws IOException if the JSON string is invalid with respect to + * GetEventsVolumeFromWorkspaceV1Query + */ + public static GetEventsVolumeFromWorkspaceV1Query fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetEventsVolumeFromWorkspaceV1Query.class); + } + + /** + * Convert an instance of GetEventsVolumeFromWorkspaceV1Query to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetFilterById200Response.java b/src/main/java/com/segment/publicapi/models/GetFilterById200Response.java new file mode 100644 index 00000000..fc89c66b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetFilterById200Response.java @@ -0,0 +1,194 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetFilterById200Response */ +public class GetFilterById200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetFilterByIdOutput data; + + public GetFilterById200Response() {} + + public GetFilterById200Response data(GetFilterByIdOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetFilterByIdOutput getData() { + return data; + } + + public void setData(GetFilterByIdOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetFilterById200Response getFilterById200Response = (GetFilterById200Response) o; + return Objects.equals(this.data, getFilterById200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetFilterById200Response {\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 GetFilterById200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetFilterById200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetFilterById200Response is not found" + + " in the empty JSON string", + GetFilterById200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetFilterById200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetFilterById200Response` 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()) { + GetFilterByIdOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetFilterById200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetFilterById200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetFilterById200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetFilterById200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetFilterById200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetFilterById200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetFilterById200Response + * @throws IOException if the JSON string is invalid with respect to GetFilterById200Response + */ + public static GetFilterById200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetFilterById200Response.class); + } + + /** + * Convert an instance of GetFilterById200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetFilterByIdOutput.java b/src/main/java/com/segment/publicapi/models/GetFilterByIdOutput.java new file mode 100644 index 00000000..742903b8 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetFilterByIdOutput.java @@ -0,0 +1,202 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output for GetFilterById. */ +public class GetFilterByIdOutput { + public static final String SERIALIZED_NAME_FILTER = "filter"; + + @SerializedName(SERIALIZED_NAME_FILTER) + private Filter filter; + + public GetFilterByIdOutput() {} + + public GetFilterByIdOutput filter(Filter filter) { + + this.filter = filter; + return this; + } + + /** + * Get filter + * + * @return filter + */ + @javax.annotation.Nonnull + public Filter getFilter() { + return filter; + } + + public void setFilter(Filter filter) { + this.filter = filter; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetFilterByIdOutput getFilterByIdOutput = (GetFilterByIdOutput) o; + return Objects.equals(this.filter, getFilterByIdOutput.filter); + } + + @Override + public int hashCode() { + return Objects.hash(filter); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetFilterByIdOutput {\n"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("filter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("filter"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetFilterByIdOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetFilterByIdOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetFilterByIdOutput is not found in" + + " the empty JSON string", + GetFilterByIdOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetFilterByIdOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetFilterByIdOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetFilterByIdOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `filter` + Filter.validateJsonElement(jsonObj.get("filter")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetFilterByIdOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetFilterByIdOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetFilterByIdOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetFilterByIdOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetFilterByIdOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetFilterByIdOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetFilterByIdOutput + * @throws IOException if the JSON string is invalid with respect to GetFilterByIdOutput + */ + public static GetFilterByIdOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetFilterByIdOutput.class); + } + + /** + * Convert an instance of GetFilterByIdOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetFilterInDestination200Response.java b/src/main/java/com/segment/publicapi/models/GetFilterInDestination200Response.java index bfb94747..62adf463 100644 --- a/src/main/java/com/segment/publicapi/models/GetFilterInDestination200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetFilterInDestination200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,192 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetFilterInDestinationV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetFilterInDestination200Response - */ - +/** GetFilterInDestination200Response */ public class GetFilterInDestination200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetFilterInDestinationV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetFilterInDestination200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetFilterInDestinationV1Output data; - public GetFilterInDestination200Response data(GetFilterInDestinationV1Output data) { - - this.data = data; - return this; - } + public GetFilterInDestination200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetFilterInDestination200Response data(GetFilterInDestinationV1Output data) { - public GetFilterInDestinationV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetFilterInDestinationV1Output getData() { + return data; + } - public void setData(GetFilterInDestinationV1Output data) { - this.data = data; - } + public void setData(GetFilterInDestinationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetFilterInDestination200Response getFilterInDestination200Response = + (GetFilterInDestination200Response) o; + return Objects.equals(this.data, getFilterInDestination200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetFilterInDestination200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetFilterInDestination200Response getFilterInDestination200Response = (GetFilterInDestination200Response) o; - return Objects.equals(this.data, getFilterInDestination200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetFilterInDestination200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetFilterInDestination200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetFilterInDestination200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetFilterInDestination200Response is not found in the empty JSON string", GetFilterInDestination200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetFilterInDestination200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetFilterInDestination200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetFilterInDestination200Response is" + + " not found in the empty JSON string", + GetFilterInDestination200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetFilterInDestination200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetFilterInDestination200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetFilterInDestination200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetFilterInDestination200Response` 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()) { + GetFilterInDestinationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetFilterInDestination200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetFilterInDestination200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetFilterInDestination200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetFilterInDestination200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetFilterInDestination200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetFilterInDestination200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetFilterInDestination200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetFilterInDestination200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetFilterInDestination200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetFilterInDestination200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetFilterInDestination200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetFilterInDestination200Response + * @throws IOException if the JSON string is invalid with respect to + * GetFilterInDestination200Response + */ + public static GetFilterInDestination200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetFilterInDestination200Response.class); } - } - - /** - * Create an instance of GetFilterInDestination200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetFilterInDestination200Response - * @throws IOException if the JSON string is invalid with respect to GetFilterInDestination200Response - */ - public static GetFilterInDestination200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetFilterInDestination200Response.class); - } - - /** - * Convert an instance of GetFilterInDestination200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetFilterInDestination200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetFilterInDestinationV1Output.java b/src/main/java/com/segment/publicapi/models/GetFilterInDestinationV1Output.java index 74e53a41..3e24073e 100644 --- a/src/main/java/com/segment/publicapi/models/GetFilterInDestinationV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetFilterInDestinationV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,200 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Filter1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Output for GetDestinationFiltersV1. - */ -@ApiModel(description = "Output for GetDestinationFiltersV1.") - +/** Output for GetDestinationFiltersV1. */ public class GetFilterInDestinationV1Output { - public static final String SERIALIZED_NAME_FILTER = "filter"; - @SerializedName(SERIALIZED_NAME_FILTER) - private Filter1 filter; + public static final String SERIALIZED_NAME_FILTER = "filter"; - public GetFilterInDestinationV1Output() { - } + @SerializedName(SERIALIZED_NAME_FILTER) + private DestinationFilterV1 filter; - public GetFilterInDestinationV1Output filter(Filter1 filter) { - - this.filter = filter; - return this; - } + public GetFilterInDestinationV1Output() {} - /** - * Get filter - * @return filter - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetFilterInDestinationV1Output filter(DestinationFilterV1 filter) { - public Filter1 getFilter() { - return filter; - } + this.filter = filter; + return this; + } + /** + * Get filter + * + * @return filter + */ + @javax.annotation.Nonnull + public DestinationFilterV1 getFilter() { + return filter; + } - public void setFilter(Filter1 filter) { - this.filter = filter; - } + public void setFilter(DestinationFilterV1 filter) { + this.filter = filter; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetFilterInDestinationV1Output getFilterInDestinationV1Output = + (GetFilterInDestinationV1Output) o; + return Objects.equals(this.filter, getFilterInDestinationV1Output.filter); + } + @Override + public int hashCode() { + return Objects.hash(filter); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetFilterInDestinationV1Output {\n"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetFilterInDestinationV1Output getFilterInDestinationV1Output = (GetFilterInDestinationV1Output) o; - return Objects.equals(this.filter, getFilterInDestinationV1Output.filter); - } - - @Override - public int hashCode() { - return Objects.hash(filter); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetFilterInDestinationV1Output {\n"); - sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("filter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("filter"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("filter"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("filter"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetFilterInDestinationV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetFilterInDestinationV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetFilterInDestinationV1Output is not found in the empty JSON string", GetFilterInDestinationV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetFilterInDestinationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetFilterInDestinationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetFilterInDestinationV1Output is not" + + " found in the empty JSON string", + GetFilterInDestinationV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetFilterInDestinationV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetFilterInDestinationV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetFilterInDestinationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetFilterInDestinationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetFilterInDestinationV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetFilterInDestinationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `filter` + DestinationFilterV1.validateJsonElement(jsonObj.get("filter")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetFilterInDestinationV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetFilterInDestinationV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetFilterInDestinationV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetFilterInDestinationV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetFilterInDestinationV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetFilterInDestinationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetFilterInDestinationV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetFilterInDestinationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetFilterInDestinationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetFilterInDestinationV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetFilterInDestinationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetFilterInDestinationV1Output + * @throws IOException if the JSON string is invalid with respect to + * GetFilterInDestinationV1Output + */ + public static GetFilterInDestinationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetFilterInDestinationV1Output.class); } - } - - /** - * Create an instance of GetFilterInDestinationV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetFilterInDestinationV1Output - * @throws IOException if the JSON string is invalid with respect to GetFilterInDestinationV1Output - */ - public static GetFilterInDestinationV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetFilterInDestinationV1Output.class); - } - - /** - * Convert an instance of GetFilterInDestinationV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetFilterInDestinationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetFunction200Response.java b/src/main/java/com/segment/publicapi/models/GetFunction200Response.java index 49fca5c9..613e907d 100644 --- a/src/main/java/com/segment/publicapi/models/GetFunction200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetFunction200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,185 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetFunctionV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetFunction200Response - */ - +/** GetFunction200Response */ public class GetFunction200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetFunctionV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetFunction200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetFunctionV1Output data; - public GetFunction200Response data(GetFunctionV1Output data) { - - this.data = data; - return this; - } + public GetFunction200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetFunction200Response data(GetFunctionV1Output data) { - public GetFunctionV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetFunctionV1Output getData() { + return data; + } - public void setData(GetFunctionV1Output data) { - this.data = data; - } + public void setData(GetFunctionV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetFunction200Response getFunction200Response = (GetFunction200Response) o; + return Objects.equals(this.data, getFunction200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetFunction200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetFunction200Response getFunction200Response = (GetFunction200Response) o; - return Objects.equals(this.data, getFunction200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetFunction200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetFunction200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetFunction200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetFunction200Response is not found in the empty JSON string", GetFunction200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetFunction200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetFunction200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetFunction200Response is not found in" + + " the empty JSON string", + GetFunction200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetFunction200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetFunction200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetFunction200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetFunction200Response` 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()) { + GetFunctionV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetFunction200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetFunction200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetFunction200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetFunction200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetFunction200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetFunction200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetFunction200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetFunction200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetFunction200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetFunction200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetFunction200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetFunction200Response + * @throws IOException if the JSON string is invalid with respect to GetFunction200Response + */ + public static GetFunction200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetFunction200Response.class); } - } - - /** - * Create an instance of GetFunction200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetFunction200Response - * @throws IOException if the JSON string is invalid with respect to GetFunction200Response - */ - public static GetFunction200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetFunction200Response.class); - } - - /** - * Convert an instance of GetFunction200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetFunction200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetFunctionV1Output.java b/src/main/java/com/segment/publicapi/models/GetFunctionV1Output.java index 7bd7cae8..318c309f 100644 --- a/src/main/java/com/segment/publicapi/models/GetFunctionV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetFunctionV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Function; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Gets a single Function. - */ -@ApiModel(description = "Gets a single Function.") - +/** Gets a single Function. */ public class GetFunctionV1Output { - public static final String SERIALIZED_NAME_FUNCTION = "function"; - @SerializedName(SERIALIZED_NAME_FUNCTION) - private Function function; + public static final String SERIALIZED_NAME_FUNCTION = "function"; - public GetFunctionV1Output() { - } + @SerializedName(SERIALIZED_NAME_FUNCTION) + private FunctionV1 function; - public GetFunctionV1Output function(Function function) { - - this.function = function; - return this; - } + public GetFunctionV1Output() {} - /** - * Get function - * @return function - **/ - @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "") + public GetFunctionV1Output function(FunctionV1 function) { - public Function getFunction() { - return function; - } + this.function = function; + return this; + } + /** + * Get function + * + * @return function + */ + @javax.annotation.Nullable + public FunctionV1 getFunction() { + return function; + } - public void setFunction(Function function) { - this.function = function; - } + public void setFunction(FunctionV1 function) { + this.function = function; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetFunctionV1Output getFunctionV1Output = (GetFunctionV1Output) o; + return Objects.equals(this.function, getFunctionV1Output.function); + } + @Override + public int hashCode() { + return Objects.hash(function); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetFunctionV1Output {\n"); + sb.append(" function: ").append(toIndentedString(function)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetFunctionV1Output getFunctionV1Output = (GetFunctionV1Output) o; - return Objects.equals(this.function, getFunctionV1Output.function); - } - - @Override - public int hashCode() { - return Objects.hash(function); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetFunctionV1Output {\n"); - sb.append(" function: ").append(toIndentedString(function)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("function"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("function"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("function"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("function"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetFunctionV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetFunctionV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetFunctionV1Output is not found in the empty JSON string", GetFunctionV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetFunctionV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetFunctionV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetFunctionV1Output is not found in" + + " the empty JSON string", + GetFunctionV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetFunctionV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetFunctionV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetFunctionV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetFunctionV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetFunctionV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetFunctionV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `function` + FunctionV1.validateJsonElement(jsonObj.get("function")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetFunctionV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetFunctionV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetFunctionV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetFunctionV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetFunctionV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetFunctionV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetFunctionV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetFunctionV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetFunctionV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetFunctionV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetFunctionV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetFunctionV1Output + * @throws IOException if the JSON string is invalid with respect to GetFunctionV1Output + */ + public static GetFunctionV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetFunctionV1Output.class); } - } - - /** - * Create an instance of GetFunctionV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetFunctionV1Output - * @throws IOException if the JSON string is invalid with respect to GetFunctionV1Output - */ - public static GetFunctionV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetFunctionV1Output.class); - } - - /** - * Convert an instance of GetFunctionV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetFunctionV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetFunctionVersion200Response.java b/src/main/java/com/segment/publicapi/models/GetFunctionVersion200Response.java new file mode 100644 index 00000000..e95497d6 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetFunctionVersion200Response.java @@ -0,0 +1,199 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetFunctionVersion200Response */ +public class GetFunctionVersion200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetFunctionVersionAlphaOutput data; + + public GetFunctionVersion200Response() {} + + public GetFunctionVersion200Response data(GetFunctionVersionAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetFunctionVersionAlphaOutput getData() { + return data; + } + + public void setData(GetFunctionVersionAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetFunctionVersion200Response getFunctionVersion200Response = + (GetFunctionVersion200Response) o; + return Objects.equals(this.data, getFunctionVersion200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetFunctionVersion200Response {\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 + * GetFunctionVersion200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetFunctionVersion200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetFunctionVersion200Response is not" + + " found in the empty JSON string", + GetFunctionVersion200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetFunctionVersion200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetFunctionVersion200Response` 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()) { + GetFunctionVersionAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetFunctionVersion200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetFunctionVersion200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetFunctionVersion200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetFunctionVersion200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetFunctionVersion200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetFunctionVersion200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetFunctionVersion200Response + * @throws IOException if the JSON string is invalid with respect to + * GetFunctionVersion200Response + */ + public static GetFunctionVersion200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetFunctionVersion200Response.class); + } + + /** + * Convert an instance of GetFunctionVersion200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetFunctionVersionAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GetFunctionVersionAlphaOutput.java new file mode 100644 index 00000000..95eda8db --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetFunctionVersionAlphaOutput.java @@ -0,0 +1,208 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Get Function version output. */ +public class GetFunctionVersionAlphaOutput { + public static final String SERIALIZED_NAME_VERSION = "version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + private Version version; + + public GetFunctionVersionAlphaOutput() {} + + public GetFunctionVersionAlphaOutput version(Version version) { + + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @javax.annotation.Nonnull + public Version getVersion() { + return version; + } + + public void setVersion(Version version) { + this.version = version; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetFunctionVersionAlphaOutput getFunctionVersionAlphaOutput = + (GetFunctionVersionAlphaOutput) o; + return Objects.equals(this.version, getFunctionVersionAlphaOutput.version); + } + + @Override + public int hashCode() { + return Objects.hash(version); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetFunctionVersionAlphaOutput {\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("version"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("version"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetFunctionVersionAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetFunctionVersionAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetFunctionVersionAlphaOutput is not" + + " found in the empty JSON string", + GetFunctionVersionAlphaOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetFunctionVersionAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetFunctionVersionAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetFunctionVersionAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `version` + Version.validateJsonElement(jsonObj.get("version")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetFunctionVersionAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetFunctionVersionAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetFunctionVersionAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetFunctionVersionAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetFunctionVersionAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetFunctionVersionAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetFunctionVersionAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * GetFunctionVersionAlphaOutput + */ + public static GetFunctionVersionAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetFunctionVersionAlphaOutput.class); + } + + /** + * Convert an instance of GetFunctionVersionAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetInsertFunctionInstance200Response.java b/src/main/java/com/segment/publicapi/models/GetInsertFunctionInstance200Response.java new file mode 100644 index 00000000..e775e73b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetInsertFunctionInstance200Response.java @@ -0,0 +1,203 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetInsertFunctionInstance200Response */ +public class GetInsertFunctionInstance200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetInsertFunctionInstanceAlphaOutput data; + + public GetInsertFunctionInstance200Response() {} + + public GetInsertFunctionInstance200Response data(GetInsertFunctionInstanceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetInsertFunctionInstanceAlphaOutput getData() { + return data; + } + + public void setData(GetInsertFunctionInstanceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetInsertFunctionInstance200Response getInsertFunctionInstance200Response = + (GetInsertFunctionInstance200Response) o; + return Objects.equals(this.data, getInsertFunctionInstance200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetInsertFunctionInstance200Response {\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 + * GetInsertFunctionInstance200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetInsertFunctionInstance200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetInsertFunctionInstance200Response" + + " is not found in the empty JSON string", + GetInsertFunctionInstance200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetInsertFunctionInstance200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetInsertFunctionInstance200Response` 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()) { + GetInsertFunctionInstanceAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetInsertFunctionInstance200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetInsertFunctionInstance200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetInsertFunctionInstance200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetInsertFunctionInstance200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetInsertFunctionInstance200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetInsertFunctionInstance200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetInsertFunctionInstance200Response + * @throws IOException if the JSON string is invalid with respect to + * GetInsertFunctionInstance200Response + */ + public static GetInsertFunctionInstance200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetInsertFunctionInstance200Response.class); + } + + /** + * Convert an instance of GetInsertFunctionInstance200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetInsertFunctionInstanceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GetInsertFunctionInstanceAlphaOutput.java new file mode 100644 index 00000000..67936eef --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetInsertFunctionInstanceAlphaOutput.java @@ -0,0 +1,217 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Returns the insert Function instance. */ +public class GetInsertFunctionInstanceAlphaOutput { + public static final String SERIALIZED_NAME_INSERT_FUNCTION_INSTANCE = "insertFunctionInstance"; + + @SerializedName(SERIALIZED_NAME_INSERT_FUNCTION_INSTANCE) + private InsertFunctionInstanceAlpha insertFunctionInstance; + + public GetInsertFunctionInstanceAlphaOutput() {} + + public GetInsertFunctionInstanceAlphaOutput insertFunctionInstance( + InsertFunctionInstanceAlpha insertFunctionInstance) { + + this.insertFunctionInstance = insertFunctionInstance; + return this; + } + + /** + * Get insertFunctionInstance + * + * @return insertFunctionInstance + */ + @javax.annotation.Nonnull + public InsertFunctionInstanceAlpha getInsertFunctionInstance() { + return insertFunctionInstance; + } + + public void setInsertFunctionInstance(InsertFunctionInstanceAlpha insertFunctionInstance) { + this.insertFunctionInstance = insertFunctionInstance; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetInsertFunctionInstanceAlphaOutput getInsertFunctionInstanceAlphaOutput = + (GetInsertFunctionInstanceAlphaOutput) o; + return Objects.equals( + this.insertFunctionInstance, + getInsertFunctionInstanceAlphaOutput.insertFunctionInstance); + } + + @Override + public int hashCode() { + return Objects.hash(insertFunctionInstance); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetInsertFunctionInstanceAlphaOutput {\n"); + sb.append(" insertFunctionInstance: ") + .append(toIndentedString(insertFunctionInstance)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("insertFunctionInstance"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("insertFunctionInstance"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetInsertFunctionInstanceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetInsertFunctionInstanceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetInsertFunctionInstanceAlphaOutput" + + " is not found in the empty JSON string", + GetInsertFunctionInstanceAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetInsertFunctionInstanceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetInsertFunctionInstanceAlphaOutput` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetInsertFunctionInstanceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `insertFunctionInstance` + InsertFunctionInstanceAlpha.validateJsonElement(jsonObj.get("insertFunctionInstance")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetInsertFunctionInstanceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetInsertFunctionInstanceAlphaOutput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetInsertFunctionInstanceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetInsertFunctionInstanceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetInsertFunctionInstanceAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetInsertFunctionInstanceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetInsertFunctionInstanceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * GetInsertFunctionInstanceAlphaOutput + */ + public static GetInsertFunctionInstanceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetInsertFunctionInstanceAlphaOutput.class); + } + + /** + * Convert an instance of GetInsertFunctionInstanceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetLatestFromEdgeFunctions200Response.java b/src/main/java/com/segment/publicapi/models/GetLatestFromEdgeFunctions200Response.java index 3ec98714..0922882b 100644 --- a/src/main/java/com/segment/publicapi/models/GetLatestFromEdgeFunctions200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetLatestFromEdgeFunctions200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetLatestFromEdgeFunctionsAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetLatestFromEdgeFunctions200Response - */ - +/** GetLatestFromEdgeFunctions200Response */ public class GetLatestFromEdgeFunctions200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetLatestFromEdgeFunctionsAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetLatestFromEdgeFunctions200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetLatestFromEdgeFunctionsAlphaOutput data; - public GetLatestFromEdgeFunctions200Response data(GetLatestFromEdgeFunctionsAlphaOutput data) { - - this.data = data; - return this; - } + public GetLatestFromEdgeFunctions200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetLatestFromEdgeFunctions200Response data(GetLatestFromEdgeFunctionsAlphaOutput data) { - public GetLatestFromEdgeFunctionsAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetLatestFromEdgeFunctionsAlphaOutput getData() { + return data; + } - public void setData(GetLatestFromEdgeFunctionsAlphaOutput data) { - this.data = data; - } + public void setData(GetLatestFromEdgeFunctionsAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetLatestFromEdgeFunctions200Response getLatestFromEdgeFunctions200Response = + (GetLatestFromEdgeFunctions200Response) o; + return Objects.equals(this.data, getLatestFromEdgeFunctions200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetLatestFromEdgeFunctions200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetLatestFromEdgeFunctions200Response getLatestFromEdgeFunctions200Response = (GetLatestFromEdgeFunctions200Response) o; - return Objects.equals(this.data, getLatestFromEdgeFunctions200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetLatestFromEdgeFunctions200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetLatestFromEdgeFunctions200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetLatestFromEdgeFunctions200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetLatestFromEdgeFunctions200Response is not found in the empty JSON string", GetLatestFromEdgeFunctions200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetLatestFromEdgeFunctions200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetLatestFromEdgeFunctions200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetLatestFromEdgeFunctions200Response" + + " is not found in the empty JSON string", + GetLatestFromEdgeFunctions200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetLatestFromEdgeFunctions200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetLatestFromEdgeFunctions200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetLatestFromEdgeFunctions200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetLatestFromEdgeFunctions200Response` 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()) { + GetLatestFromEdgeFunctionsAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetLatestFromEdgeFunctions200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetLatestFromEdgeFunctions200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetLatestFromEdgeFunctions200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetLatestFromEdgeFunctions200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetLatestFromEdgeFunctions200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetLatestFromEdgeFunctions200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetLatestFromEdgeFunctions200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetLatestFromEdgeFunctions200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetLatestFromEdgeFunctions200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetLatestFromEdgeFunctions200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetLatestFromEdgeFunctions200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetLatestFromEdgeFunctions200Response + * @throws IOException if the JSON string is invalid with respect to + * GetLatestFromEdgeFunctions200Response + */ + public static GetLatestFromEdgeFunctions200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetLatestFromEdgeFunctions200Response.class); } - } - - /** - * Create an instance of GetLatestFromEdgeFunctions200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetLatestFromEdgeFunctions200Response - * @throws IOException if the JSON string is invalid with respect to GetLatestFromEdgeFunctions200Response - */ - public static GetLatestFromEdgeFunctions200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetLatestFromEdgeFunctions200Response.class); - } - - /** - * Convert an instance of GetLatestFromEdgeFunctions200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetLatestFromEdgeFunctions200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetLatestFromEdgeFunctionsAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GetLatestFromEdgeFunctionsAlphaOutput.java index 7a35172a..7dd7c62b 100644 --- a/src/main/java/com/segment/publicapi/models/GetLatestFromEdgeFunctionsAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/GetLatestFromEdgeFunctionsAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,205 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.EdgeFunctions1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Output for GetLatestFromEdgeFunctions. - */ -@ApiModel(description = "Output for GetLatestFromEdgeFunctions.") - +/** Output for GetLatestFromEdgeFunctions. */ public class GetLatestFromEdgeFunctionsAlphaOutput { - public static final String SERIALIZED_NAME_EDGE_FUNCTIONS = "edgeFunctions"; - @SerializedName(SERIALIZED_NAME_EDGE_FUNCTIONS) - private EdgeFunctions1 edgeFunctions; + public static final String SERIALIZED_NAME_EDGE_FUNCTIONS = "edgeFunctions"; - public GetLatestFromEdgeFunctionsAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_EDGE_FUNCTIONS) + private EdgeFunctionsAlpha edgeFunctions; - public GetLatestFromEdgeFunctionsAlphaOutput edgeFunctions(EdgeFunctions1 edgeFunctions) { - - this.edgeFunctions = edgeFunctions; - return this; - } + public GetLatestFromEdgeFunctionsAlphaOutput() {} - /** - * Get edgeFunctions - * @return edgeFunctions - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetLatestFromEdgeFunctionsAlphaOutput edgeFunctions(EdgeFunctionsAlpha edgeFunctions) { - public EdgeFunctions1 getEdgeFunctions() { - return edgeFunctions; - } + this.edgeFunctions = edgeFunctions; + return this; + } + /** + * Get edgeFunctions + * + * @return edgeFunctions + */ + @javax.annotation.Nonnull + public EdgeFunctionsAlpha getEdgeFunctions() { + return edgeFunctions; + } - public void setEdgeFunctions(EdgeFunctions1 edgeFunctions) { - this.edgeFunctions = edgeFunctions; - } + public void setEdgeFunctions(EdgeFunctionsAlpha edgeFunctions) { + this.edgeFunctions = edgeFunctions; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetLatestFromEdgeFunctionsAlphaOutput getLatestFromEdgeFunctionsAlphaOutput = + (GetLatestFromEdgeFunctionsAlphaOutput) o; + return Objects.equals( + this.edgeFunctions, getLatestFromEdgeFunctionsAlphaOutput.edgeFunctions); + } + @Override + public int hashCode() { + return Objects.hash(edgeFunctions); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetLatestFromEdgeFunctionsAlphaOutput {\n"); + sb.append(" edgeFunctions: ").append(toIndentedString(edgeFunctions)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetLatestFromEdgeFunctionsAlphaOutput getLatestFromEdgeFunctionsAlphaOutput = (GetLatestFromEdgeFunctionsAlphaOutput) o; - return Objects.equals(this.edgeFunctions, getLatestFromEdgeFunctionsAlphaOutput.edgeFunctions); - } - - @Override - public int hashCode() { - return Objects.hash(edgeFunctions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetLatestFromEdgeFunctionsAlphaOutput {\n"); - sb.append(" edgeFunctions: ").append(toIndentedString(edgeFunctions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("edgeFunctions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("edgeFunctions"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("edgeFunctions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("edgeFunctions"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetLatestFromEdgeFunctionsAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetLatestFromEdgeFunctionsAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetLatestFromEdgeFunctionsAlphaOutput is not found in the empty JSON string", GetLatestFromEdgeFunctionsAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetLatestFromEdgeFunctionsAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetLatestFromEdgeFunctionsAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetLatestFromEdgeFunctionsAlphaOutput" + + " is not found in the empty JSON string", + GetLatestFromEdgeFunctionsAlphaOutput.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetLatestFromEdgeFunctionsAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetLatestFromEdgeFunctionsAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetLatestFromEdgeFunctionsAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetLatestFromEdgeFunctionsAlphaOutput` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetLatestFromEdgeFunctionsAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetLatestFromEdgeFunctionsAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `edgeFunctions` + EdgeFunctionsAlpha.validateJsonElement(jsonObj.get("edgeFunctions")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetLatestFromEdgeFunctionsAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetLatestFromEdgeFunctionsAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetLatestFromEdgeFunctionsAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetLatestFromEdgeFunctionsAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetLatestFromEdgeFunctionsAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetLatestFromEdgeFunctionsAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetLatestFromEdgeFunctionsAlphaOutput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetLatestFromEdgeFunctionsAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetLatestFromEdgeFunctionsAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetLatestFromEdgeFunctionsAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetLatestFromEdgeFunctionsAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetLatestFromEdgeFunctionsAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * GetLatestFromEdgeFunctionsAlphaOutput + */ + public static GetLatestFromEdgeFunctionsAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetLatestFromEdgeFunctionsAlphaOutput.class); } - } - - /** - * Create an instance of GetLatestFromEdgeFunctionsAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetLatestFromEdgeFunctionsAlphaOutput - * @throws IOException if the JSON string is invalid with respect to GetLatestFromEdgeFunctionsAlphaOutput - */ - public static GetLatestFromEdgeFunctionsAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetLatestFromEdgeFunctionsAlphaOutput.class); - } - - /** - * Convert an instance of GetLatestFromEdgeFunctionsAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetLatestFromEdgeFunctionsAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetMessagingSubscriptionFailureResponse.java b/src/main/java/com/segment/publicapi/models/GetMessagingSubscriptionFailureResponse.java index 75a7baa8..daf72ec8 100644 --- a/src/main/java/com/segment/publicapi/models/GetMessagingSubscriptionFailureResponse.java +++ b/src/main/java/com/segment/publicapi/models/GetMessagingSubscriptionFailureResponse.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,286 +9,304 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.MessageSubscriptionResponseError; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetMessagingSubscriptionFailureResponse - */ - +/** GetMessagingSubscriptionFailureResponse */ public class GetMessagingSubscriptionFailureResponse { - public static final String SERIALIZED_NAME_KEY = "key"; - @SerializedName(SERIALIZED_NAME_KEY) - private String key; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - private String type; + public static final String SERIALIZED_NAME_KEY = "key"; - public static final String SERIALIZED_NAME_ERRORS = "errors"; - @SerializedName(SERIALIZED_NAME_ERRORS) - private List errors = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_KEY) + private String key; - public GetMessagingSubscriptionFailureResponse() { - } + public static final String SERIALIZED_NAME_TYPE = "type"; - public GetMessagingSubscriptionFailureResponse key(String key) { - - this.key = key; - return this; - } + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; - /** - * Key is the phone number or email. - * @return key - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Key is the phone number or email.") + public static final String SERIALIZED_NAME_ERRORS = "errors"; - public String getKey() { - return key; - } + @SerializedName(SERIALIZED_NAME_ERRORS) + private List errors = new ArrayList<>(); + public GetMessagingSubscriptionFailureResponse() {} - public void setKey(String key) { - this.key = key; - } + public GetMessagingSubscriptionFailureResponse key(String key) { + this.key = key; + return this; + } - public GetMessagingSubscriptionFailureResponse type(String type) { - - this.type = type; - return this; - } - - /** - * This will be the exact type as given in the request. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "This will be the exact type as given in the request.") + /** + * Key is the phone number or email. + * + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } - public String getType() { - return type; - } + public void setKey(String key) { + this.key = key; + } + public GetMessagingSubscriptionFailureResponse type(String type) { - public void setType(String type) { - this.type = type; - } + this.type = type; + return this; + } + /** + * This will be the exact type as given in the request. + * + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } - public GetMessagingSubscriptionFailureResponse errors(List errors) { - - this.errors = errors; - return this; - } + public void setType(String type) { + this.type = type; + } - public GetMessagingSubscriptionFailureResponse addErrorsItem(MessageSubscriptionResponseError errorsItem) { - this.errors.add(errorsItem); - return this; - } + public GetMessagingSubscriptionFailureResponse errors( + List errors) { - /** - * Per key errors, such as validation errors. - * @return errors - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Per key errors, such as validation errors.") + this.errors = errors; + return this; + } - public List getErrors() { - return errors; - } + public GetMessagingSubscriptionFailureResponse addErrorsItem( + MessageSubscriptionResponseError errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + /** + * Per key errors, such as validation errors. + * + * @return errors + */ + @javax.annotation.Nonnull + public List getErrors() { + return errors; + } - public void setErrors(List errors) { - this.errors = errors; - } + public void setErrors(List errors) { + this.errors = errors; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetMessagingSubscriptionFailureResponse getMessagingSubscriptionFailureResponse = + (GetMessagingSubscriptionFailureResponse) o; + return Objects.equals(this.key, getMessagingSubscriptionFailureResponse.key) + && Objects.equals(this.type, getMessagingSubscriptionFailureResponse.type) + && Objects.equals(this.errors, getMessagingSubscriptionFailureResponse.errors); + } + @Override + public int hashCode() { + return Objects.hash(key, type, errors); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetMessagingSubscriptionFailureResponse {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetMessagingSubscriptionFailureResponse getMessagingSubscriptionFailureResponse = (GetMessagingSubscriptionFailureResponse) o; - return Objects.equals(this.key, getMessagingSubscriptionFailureResponse.key) && - Objects.equals(this.type, getMessagingSubscriptionFailureResponse.type) && - Objects.equals(this.errors, getMessagingSubscriptionFailureResponse.errors); - } - - @Override - public int hashCode() { - return Objects.hash(key, type, errors); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetMessagingSubscriptionFailureResponse {\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("key"); + openapiFields.add("type"); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("errors"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("key"); - openapiFields.add("type"); - openapiFields.add("errors"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("key"); - openapiRequiredFields.add("type"); - openapiRequiredFields.add("errors"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetMessagingSubscriptionFailureResponse - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetMessagingSubscriptionFailureResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetMessagingSubscriptionFailureResponse is not found in the empty JSON string", GetMessagingSubscriptionFailureResponse.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetMessagingSubscriptionFailureResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetMessagingSubscriptionFailureResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetMessagingSubscriptionFailureResponse is not found in the" + + " empty JSON string", + GetMessagingSubscriptionFailureResponse.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetMessagingSubscriptionFailureResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetMessagingSubscriptionFailureResponse` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetMessagingSubscriptionFailureResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetMessagingSubscriptionFailureResponse` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetMessagingSubscriptionFailureResponse.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetMessagingSubscriptionFailureResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } } - } - if (!jsonObj.get("key").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").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())); - } - // ensure the json data is an array - if (!jsonObj.get("errors").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); - } - - JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetMessagingSubscriptionFailureResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetMessagingSubscriptionFailureResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetMessagingSubscriptionFailureResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetMessagingSubscriptionFailureResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetMessagingSubscriptionFailureResponse read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `key` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("key").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())); + } + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errors` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("errors").toString())); + } + + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + // validate the required field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + MessageSubscriptionResponseError.validateJsonElement(jsonArrayerrors.get(i)); + } + ; } - } - - /** - * Create an instance of GetMessagingSubscriptionFailureResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetMessagingSubscriptionFailureResponse - * @throws IOException if the JSON string is invalid with respect to GetMessagingSubscriptionFailureResponse - */ - public static GetMessagingSubscriptionFailureResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetMessagingSubscriptionFailureResponse.class); - } - - /** - * Convert an instance of GetMessagingSubscriptionFailureResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetMessagingSubscriptionFailureResponse.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'GetMessagingSubscriptionFailureResponse' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetMessagingSubscriptionFailureResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetMessagingSubscriptionFailureResponse value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetMessagingSubscriptionFailureResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetMessagingSubscriptionFailureResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetMessagingSubscriptionFailureResponse + * @throws IOException if the JSON string is invalid with respect to + * GetMessagingSubscriptionFailureResponse + */ + public static GetMessagingSubscriptionFailureResponse fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetMessagingSubscriptionFailureResponse.class); + } + + /** + * Convert an instance of GetMessagingSubscriptionFailureResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetMessagingSubscriptionSuccessResponse.java b/src/main/java/com/segment/publicapi/models/GetMessagingSubscriptionSuccessResponse.java index 96c4efb0..4e690191 100644 --- a/src/main/java/com/segment/publicapi/models/GetMessagingSubscriptionSuccessResponse.java +++ b/src/main/java/com/segment/publicapi/models/GetMessagingSubscriptionSuccessResponse.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,370 +9,485 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** GetMessagingSubscriptionSuccessResponse */ +public class GetMessagingSubscriptionSuccessResponse { + public static final String SERIALIZED_NAME_KEY = "key"; -/** - * GetMessagingSubscriptionSuccessResponse - */ + @SerializedName(SERIALIZED_NAME_KEY) + private String key; -public class GetMessagingSubscriptionSuccessResponse { - public static final String SERIALIZED_NAME_KEY = "key"; - @SerializedName(SERIALIZED_NAME_KEY) - private String key; - - /** - * Type is communication medium used. Either EMAIL or SMS. - */ - @JsonAdapter(TypeEnum.Adapter.class) - public enum TypeEnum { - EMAIL("EMAIL"), - - SMS("SMS"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } + /** Type is communication medium used. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ANDROID_PUSH("ANDROID_PUSH"), - public String getValue() { - return value; - } + EMAIL("EMAIL"), - @Override - public String toString() { - return String.valueOf(value); - } + IOS_PUSH("IOS_PUSH"), - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; + SMS("SMS"), + + WHATSAPP("WHATSAPP"); + + private String value; + + TypeEnum(String value) { + this.value = value; } - } - 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; - - /** - * The user subscribed, unsubscribed, or on initial status. This is absent if the phone number or email is not found. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - DID_NOT_SUBSCRIBE("DID_NOT_SUBSCRIBE"), - - SUBSCRIBED("SUBSCRIBED"), - - UNSUBSCRIBED("UNSUBSCRIBED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } + public String getValue() { + return value; + } - public String getValue() { - return value; - } + @Override + public String toString() { + return String.valueOf(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 StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + /** + * The user subscribed, unsubscribed, or on initial status. This is absent if the phone number + * or email is not found. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + DID_NOT_SUBSCRIBE("DID_NOT_SUBSCRIBE"), + + SUBSCRIBED("SUBSCRIBED"), + + UNSUBSCRIBED("UNSUBSCRIBED"); + + 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); + } } - } - 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_GROUPS = "groups"; + + @SerializedName(SERIALIZED_NAME_GROUPS) + private List groups; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private String updatedAt; + + public GetMessagingSubscriptionSuccessResponse() {} + + public GetMessagingSubscriptionSuccessResponse key(String key) { + + this.key = key; + return this; } - } - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status; + /** + * Key is the phone number or email. + * + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } - public GetMessagingSubscriptionSuccessResponse() { - } + public void setKey(String key) { + this.key = key; + } - public GetMessagingSubscriptionSuccessResponse key(String key) { - - this.key = key; - return this; - } + public GetMessagingSubscriptionSuccessResponse type(TypeEnum type) { - /** - * Key is the phone number or email. - * @return key - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Key is the phone number or email.") + this.type = type; + return this; + } - public String getKey() { - return key; - } + /** + * Type is communication medium used. + * + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + public void setType(TypeEnum type) { + this.type = type; + } - public void setKey(String key) { - this.key = key; - } + public GetMessagingSubscriptionSuccessResponse status(StatusEnum status) { + this.status = status; + return this; + } - public GetMessagingSubscriptionSuccessResponse type(TypeEnum type) { - - this.type = type; - return this; - } + /** + * The user subscribed, unsubscribed, or on initial status. This is absent if the phone number + * or email is not found. + * + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } - /** - * Type is communication medium used. Either EMAIL or SMS. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Type is communication medium used. Either EMAIL or SMS.") + public void setStatus(StatusEnum status) { + this.status = status; + } - public TypeEnum getType() { - return type; - } + public GetMessagingSubscriptionSuccessResponse groups( + List groups) { + this.groups = groups; + return this; + } - public void setType(TypeEnum type) { - this.type = type; - } + public GetMessagingSubscriptionSuccessResponse addGroupsItem( + GroupSubscriptionStatusResponse groupsItem) { + if (this.groups == null) { + this.groups = new ArrayList<>(); + } + this.groups.add(groupsItem); + return this; + } + /** + * Optional subscription groups. + * + * @return groups + */ + @javax.annotation.Nullable + public List getGroups() { + return groups; + } - public GetMessagingSubscriptionSuccessResponse status(StatusEnum status) { - - this.status = status; - return this; - } + public void setGroups(List groups) { + this.groups = groups; + } - /** - * The user subscribed, unsubscribed, or on initial status. This is absent if the phone number or email is not found. - * @return status - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The user subscribed, unsubscribed, or on initial status. This is absent if the phone number or email is not found.") + public GetMessagingSubscriptionSuccessResponse updatedAt(String updatedAt) { - public StatusEnum getStatus() { - return status; - } + this.updatedAt = updatedAt; + return this; + } + /** + * The timestamp of this subscription status's last change. + * + * @return updatedAt + */ + @javax.annotation.Nullable + public String getUpdatedAt() { + return updatedAt; + } - public void setStatus(StatusEnum status) { - this.status = status; - } + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetMessagingSubscriptionSuccessResponse getMessagingSubscriptionSuccessResponse = + (GetMessagingSubscriptionSuccessResponse) o; + return Objects.equals(this.key, getMessagingSubscriptionSuccessResponse.key) + && Objects.equals(this.type, getMessagingSubscriptionSuccessResponse.type) + && Objects.equals(this.status, getMessagingSubscriptionSuccessResponse.status) + && Objects.equals(this.groups, getMessagingSubscriptionSuccessResponse.groups) + && Objects.equals( + this.updatedAt, getMessagingSubscriptionSuccessResponse.updatedAt); + } + @Override + public int hashCode() { + return Objects.hash(key, type, status, groups, updatedAt); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetMessagingSubscriptionSuccessResponse {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" groups: ").append(toIndentedString(groups)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetMessagingSubscriptionSuccessResponse getMessagingSubscriptionSuccessResponse = (GetMessagingSubscriptionSuccessResponse) o; - return Objects.equals(this.key, getMessagingSubscriptionSuccessResponse.key) && - Objects.equals(this.type, getMessagingSubscriptionSuccessResponse.type) && - Objects.equals(this.status, getMessagingSubscriptionSuccessResponse.status); - } - - @Override - public int hashCode() { - return Objects.hash(key, type, status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetMessagingSubscriptionSuccessResponse {\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("key"); + openapiFields.add("type"); + openapiFields.add("status"); + openapiFields.add("groups"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("type"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("key"); - openapiFields.add("type"); - openapiFields.add("status"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("key"); - openapiRequiredFields.add("type"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetMessagingSubscriptionSuccessResponse - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetMessagingSubscriptionSuccessResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetMessagingSubscriptionSuccessResponse is not found in the empty JSON string", GetMessagingSubscriptionSuccessResponse.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetMessagingSubscriptionSuccessResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetMessagingSubscriptionSuccessResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetMessagingSubscriptionSuccessResponse is not found in the" + + " empty JSON string", + GetMessagingSubscriptionSuccessResponse.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetMessagingSubscriptionSuccessResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetMessagingSubscriptionSuccessResponse` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetMessagingSubscriptionSuccessResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetMessagingSubscriptionSuccessResponse` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetMessagingSubscriptionSuccessResponse.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetMessagingSubscriptionSuccessResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("key").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `key` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("key").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("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("groups") != null && !jsonObj.get("groups").isJsonNull()) { + JsonArray jsonArraygroups = jsonObj.getAsJsonArray("groups"); + if (jsonArraygroups != null) { + // ensure the json data is an array + if (!jsonObj.get("groups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `groups` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("groups").toString())); + } + + // validate the optional field `groups` (array) + for (int i = 0; i < jsonArraygroups.size(); i++) { + GroupSubscriptionStatusResponse.validateJsonElement(jsonArraygroups.get(i)); + } + ; + } + } + 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("key").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").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("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 (!GetMessagingSubscriptionSuccessResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetMessagingSubscriptionSuccessResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetMessagingSubscriptionSuccessResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetMessagingSubscriptionSuccessResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetMessagingSubscriptionSuccessResponse read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of GetMessagingSubscriptionSuccessResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetMessagingSubscriptionSuccessResponse - * @throws IOException if the JSON string is invalid with respect to GetMessagingSubscriptionSuccessResponse - */ - public static GetMessagingSubscriptionSuccessResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetMessagingSubscriptionSuccessResponse.class); - } - - /** - * Convert an instance of GetMessagingSubscriptionSuccessResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetMessagingSubscriptionSuccessResponse.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'GetMessagingSubscriptionSuccessResponse' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetMessagingSubscriptionSuccessResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetMessagingSubscriptionSuccessResponse value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetMessagingSubscriptionSuccessResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetMessagingSubscriptionSuccessResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetMessagingSubscriptionSuccessResponse + * @throws IOException if the JSON string is invalid with respect to + * GetMessagingSubscriptionSuccessResponse + */ + public static GetMessagingSubscriptionSuccessResponse fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetMessagingSubscriptionSuccessResponse.class); + } + + /** + * Convert an instance of GetMessagingSubscriptionSuccessResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetRegulation200Response.java b/src/main/java/com/segment/publicapi/models/GetRegulation200Response.java index 55c6543a..1fda983a 100644 --- a/src/main/java/com/segment/publicapi/models/GetRegulation200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetRegulation200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetRegulationV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetRegulation200Response - */ - +/** GetRegulation200Response */ public class GetRegulation200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetRegulationV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetRegulation200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetRegulationV1Output data; - public GetRegulation200Response data(GetRegulationV1Output data) { - - this.data = data; - return this; - } + public GetRegulation200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetRegulation200Response data(GetRegulationV1Output data) { - public GetRegulationV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetRegulationV1Output getData() { + return data; + } - public void setData(GetRegulationV1Output data) { - this.data = data; - } + public void setData(GetRegulationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetRegulation200Response getRegulation200Response = (GetRegulation200Response) o; + return Objects.equals(this.data, getRegulation200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetRegulation200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetRegulation200Response getRegulation200Response = (GetRegulation200Response) o; - return Objects.equals(this.data, getRegulation200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetRegulation200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetRegulation200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetRegulation200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetRegulation200Response is not found in the empty JSON string", GetRegulation200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetRegulation200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetRegulation200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetRegulation200Response is not found" + + " in the empty JSON string", + GetRegulation200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetRegulation200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetRegulation200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetRegulation200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetRegulation200Response` 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()) { + GetRegulationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetRegulation200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetRegulation200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetRegulation200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetRegulation200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetRegulation200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetRegulation200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetRegulation200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetRegulation200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetRegulation200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetRegulation200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetRegulation200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetRegulation200Response + * @throws IOException if the JSON string is invalid with respect to GetRegulation200Response + */ + public static GetRegulation200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetRegulation200Response.class); } - } - - /** - * Create an instance of GetRegulation200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetRegulation200Response - * @throws IOException if the JSON string is invalid with respect to GetRegulation200Response - */ - public static GetRegulation200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetRegulation200Response.class); - } - - /** - * Convert an instance of GetRegulation200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetRegulation200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetRegulationV1Output.java b/src/main/java/com/segment/publicapi/models/GetRegulationV1Output.java index bd1b44e7..80c12e82 100644 --- a/src/main/java/com/segment/publicapi/models/GetRegulationV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetRegulationV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Regulation; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The regulate request returned. - */ -@ApiModel(description = "The regulate request returned.") - +/** The regulate request returned. */ public class GetRegulationV1Output { - public static final String SERIALIZED_NAME_REGULATION = "regulation"; - @SerializedName(SERIALIZED_NAME_REGULATION) - private Regulation regulation; + public static final String SERIALIZED_NAME_REGULATION = "regulation"; - public GetRegulationV1Output() { - } + @SerializedName(SERIALIZED_NAME_REGULATION) + private Regulation regulation; - public GetRegulationV1Output regulation(Regulation regulation) { - - this.regulation = regulation; - return this; - } + public GetRegulationV1Output() {} - /** - * Get regulation - * @return regulation - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetRegulationV1Output regulation(Regulation regulation) { - public Regulation getRegulation() { - return regulation; - } + this.regulation = regulation; + return this; + } + /** + * Get regulation + * + * @return regulation + */ + @javax.annotation.Nonnull + public Regulation getRegulation() { + return regulation; + } - public void setRegulation(Regulation regulation) { - this.regulation = regulation; - } + public void setRegulation(Regulation regulation) { + this.regulation = regulation; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetRegulationV1Output getRegulationV1Output = (GetRegulationV1Output) o; + return Objects.equals(this.regulation, getRegulationV1Output.regulation); + } + @Override + public int hashCode() { + return Objects.hash(regulation); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetRegulationV1Output {\n"); + sb.append(" regulation: ").append(toIndentedString(regulation)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetRegulationV1Output getRegulationV1Output = (GetRegulationV1Output) o; - return Objects.equals(this.regulation, getRegulationV1Output.regulation); - } - - @Override - public int hashCode() { - return Objects.hash(regulation); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetRegulationV1Output {\n"); - sb.append(" regulation: ").append(toIndentedString(regulation)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("regulation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("regulation"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("regulation"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("regulation"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetRegulationV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetRegulationV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetRegulationV1Output is not found in the empty JSON string", GetRegulationV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetRegulationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetRegulationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetRegulationV1Output is not found in" + + " the empty JSON string", + GetRegulationV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetRegulationV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetRegulationV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetRegulationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetRegulationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetRegulationV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetRegulationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `regulation` + Regulation.validateJsonElement(jsonObj.get("regulation")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetRegulationV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetRegulationV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetRegulationV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetRegulationV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetRegulationV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetRegulationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetRegulationV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetRegulationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetRegulationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetRegulationV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetRegulationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetRegulationV1Output + * @throws IOException if the JSON string is invalid with respect to GetRegulationV1Output + */ + public static GetRegulationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetRegulationV1Output.class); } - } - - /** - * Create an instance of GetRegulationV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetRegulationV1Output - * @throws IOException if the JSON string is invalid with respect to GetRegulationV1Output - */ - public static GetRegulationV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetRegulationV1Output.class); - } - - /** - * Convert an instance of GetRegulationV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetRegulationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetReverseETLSyncStatus200Response.java b/src/main/java/com/segment/publicapi/models/GetReverseETLSyncStatus200Response.java new file mode 100644 index 00000000..1cb82596 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetReverseETLSyncStatus200Response.java @@ -0,0 +1,201 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetReverseETLSyncStatus200Response */ +public class GetReverseETLSyncStatus200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetReverseETLSyncStatusOutput data; + + public GetReverseETLSyncStatus200Response() {} + + public GetReverseETLSyncStatus200Response data(GetReverseETLSyncStatusOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetReverseETLSyncStatusOutput getData() { + return data; + } + + public void setData(GetReverseETLSyncStatusOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetReverseETLSyncStatus200Response getReverseETLSyncStatus200Response = + (GetReverseETLSyncStatus200Response) o; + return Objects.equals(this.data, getReverseETLSyncStatus200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetReverseETLSyncStatus200Response {\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 + * GetReverseETLSyncStatus200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetReverseETLSyncStatus200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetReverseETLSyncStatus200Response is" + + " not found in the empty JSON string", + GetReverseETLSyncStatus200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetReverseETLSyncStatus200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetReverseETLSyncStatus200Response` 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()) { + GetReverseETLSyncStatusOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetReverseETLSyncStatus200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetReverseETLSyncStatus200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetReverseETLSyncStatus200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetReverseETLSyncStatus200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetReverseETLSyncStatus200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetReverseETLSyncStatus200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetReverseETLSyncStatus200Response + * @throws IOException if the JSON string is invalid with respect to + * GetReverseETLSyncStatus200Response + */ + public static GetReverseETLSyncStatus200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetReverseETLSyncStatus200Response.class); + } + + /** + * Convert an instance of GetReverseETLSyncStatus200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetReverseETLSyncStatusOutput.java b/src/main/java/com/segment/publicapi/models/GetReverseETLSyncStatusOutput.java new file mode 100644 index 00000000..67e794a4 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetReverseETLSyncStatusOutput.java @@ -0,0 +1,212 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output for triggering a manual sync for a RETL connection. */ +public class GetReverseETLSyncStatusOutput { + public static final String SERIALIZED_NAME_REVERSE_E_T_L_SYNC_STATUS = "reverseETLSyncStatus"; + + @SerializedName(SERIALIZED_NAME_REVERSE_E_T_L_SYNC_STATUS) + private ReverseETLSyncStatus reverseETLSyncStatus; + + public GetReverseETLSyncStatusOutput() {} + + public GetReverseETLSyncStatusOutput reverseETLSyncStatus( + ReverseETLSyncStatus reverseETLSyncStatus) { + + this.reverseETLSyncStatus = reverseETLSyncStatus; + return this; + } + + /** + * Get reverseETLSyncStatus + * + * @return reverseETLSyncStatus + */ + @javax.annotation.Nonnull + public ReverseETLSyncStatus getReverseETLSyncStatus() { + return reverseETLSyncStatus; + } + + public void setReverseETLSyncStatus(ReverseETLSyncStatus reverseETLSyncStatus) { + this.reverseETLSyncStatus = reverseETLSyncStatus; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetReverseETLSyncStatusOutput getReverseETLSyncStatusOutput = + (GetReverseETLSyncStatusOutput) o; + return Objects.equals( + this.reverseETLSyncStatus, getReverseETLSyncStatusOutput.reverseETLSyncStatus); + } + + @Override + public int hashCode() { + return Objects.hash(reverseETLSyncStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetReverseETLSyncStatusOutput {\n"); + sb.append(" reverseETLSyncStatus: ") + .append(toIndentedString(reverseETLSyncStatus)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reverseETLSyncStatus"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("reverseETLSyncStatus"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetReverseETLSyncStatusOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetReverseETLSyncStatusOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetReverseETLSyncStatusOutput is not" + + " found in the empty JSON string", + GetReverseETLSyncStatusOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetReverseETLSyncStatusOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetReverseETLSyncStatusOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetReverseETLSyncStatusOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `reverseETLSyncStatus` + ReverseETLSyncStatus.validateJsonElement(jsonObj.get("reverseETLSyncStatus")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetReverseETLSyncStatusOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetReverseETLSyncStatusOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetReverseETLSyncStatusOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetReverseETLSyncStatusOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetReverseETLSyncStatusOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetReverseETLSyncStatusOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetReverseETLSyncStatusOutput + * @throws IOException if the JSON string is invalid with respect to + * GetReverseETLSyncStatusOutput + */ + public static GetReverseETLSyncStatusOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetReverseETLSyncStatusOutput.class); + } + + /** + * Convert an instance of GetReverseETLSyncStatusOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetReverseEtlModel200Response.java b/src/main/java/com/segment/publicapi/models/GetReverseEtlModel200Response.java new file mode 100644 index 00000000..f0bb19f5 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetReverseEtlModel200Response.java @@ -0,0 +1,199 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GetReverseEtlModel200Response */ +public class GetReverseEtlModel200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private GetReverseEtlModelOutput data; + + public GetReverseEtlModel200Response() {} + + public GetReverseEtlModel200Response data(GetReverseEtlModelOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetReverseEtlModelOutput getData() { + return data; + } + + public void setData(GetReverseEtlModelOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetReverseEtlModel200Response getReverseEtlModel200Response = + (GetReverseEtlModel200Response) o; + return Objects.equals(this.data, getReverseEtlModel200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetReverseEtlModel200Response {\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 + * GetReverseEtlModel200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetReverseEtlModel200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetReverseEtlModel200Response is not" + + " found in the empty JSON string", + GetReverseEtlModel200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetReverseEtlModel200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetReverseEtlModel200Response` 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()) { + GetReverseEtlModelOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetReverseEtlModel200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetReverseEtlModel200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetReverseEtlModel200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetReverseEtlModel200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetReverseEtlModel200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetReverseEtlModel200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetReverseEtlModel200Response + * @throws IOException if the JSON string is invalid with respect to + * GetReverseEtlModel200Response + */ + public static GetReverseEtlModel200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetReverseEtlModel200Response.class); + } + + /** + * Convert an instance of GetReverseEtlModel200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetReverseEtlModelOutput.java b/src/main/java/com/segment/publicapi/models/GetReverseEtlModelOutput.java new file mode 100644 index 00000000..f176634c --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetReverseEtlModelOutput.java @@ -0,0 +1,203 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Defines the result of getting a Model. */ +public class GetReverseEtlModelOutput { + public static final String SERIALIZED_NAME_REVERSE_ETL_MODEL = "reverseEtlModel"; + + @SerializedName(SERIALIZED_NAME_REVERSE_ETL_MODEL) + private ReverseEtlModel reverseEtlModel; + + public GetReverseEtlModelOutput() {} + + public GetReverseEtlModelOutput reverseEtlModel(ReverseEtlModel reverseEtlModel) { + + this.reverseEtlModel = reverseEtlModel; + return this; + } + + /** + * Get reverseEtlModel + * + * @return reverseEtlModel + */ + @javax.annotation.Nonnull + public ReverseEtlModel getReverseEtlModel() { + return reverseEtlModel; + } + + public void setReverseEtlModel(ReverseEtlModel reverseEtlModel) { + this.reverseEtlModel = reverseEtlModel; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetReverseEtlModelOutput getReverseEtlModelOutput = (GetReverseEtlModelOutput) o; + return Objects.equals(this.reverseEtlModel, getReverseEtlModelOutput.reverseEtlModel); + } + + @Override + public int hashCode() { + return Objects.hash(reverseEtlModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetReverseEtlModelOutput {\n"); + sb.append(" reverseEtlModel: ").append(toIndentedString(reverseEtlModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reverseEtlModel"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("reverseEtlModel"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetReverseEtlModelOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetReverseEtlModelOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetReverseEtlModelOutput is not found" + + " in the empty JSON string", + GetReverseEtlModelOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetReverseEtlModelOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetReverseEtlModelOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetReverseEtlModelOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `reverseEtlModel` + ReverseEtlModel.validateJsonElement(jsonObj.get("reverseEtlModel")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetReverseEtlModelOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetReverseEtlModelOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetReverseEtlModelOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetReverseEtlModelOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetReverseEtlModelOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetReverseEtlModelOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetReverseEtlModelOutput + * @throws IOException if the JSON string is invalid with respect to GetReverseEtlModelOutput + */ + public static GetReverseEtlModelOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetReverseEtlModelOutput.class); + } + + /** + * Convert an instance of GetReverseEtlModelOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSource200Response.java b/src/main/java/com/segment/publicapi/models/GetSource200Response.java index 295fb49c..76bcbc88 100644 --- a/src/main/java/com/segment/publicapi/models/GetSource200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetSource200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,185 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetSourceAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetSource200Response - */ - +/** GetSource200Response */ public class GetSource200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetSourceAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetSource200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetSourceV1Output data; - public GetSource200Response data(GetSourceAlphaOutput data) { - - this.data = data; - return this; - } + public GetSource200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetSource200Response data(GetSourceV1Output data) { - public GetSourceAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetSourceV1Output getData() { + return data; + } - public void setData(GetSourceAlphaOutput data) { - this.data = data; - } + public void setData(GetSourceV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSource200Response getSource200Response = (GetSource200Response) o; + return Objects.equals(this.data, getSource200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSource200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetSource200Response getSource200Response = (GetSource200Response) o; - return Objects.equals(this.data, getSource200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSource200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSource200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSource200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSource200Response is not found in the empty JSON string", GetSource200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetSource200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSource200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetSource200Response is not found in" + + " the empty JSON string", + GetSource200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSource200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSource200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSource200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSource200Response` 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()) { + GetSourceV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetSource200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSource200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSource200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSource200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSource200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSource200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSource200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetSource200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSource200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSource200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSource200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSource200Response + * @throws IOException if the JSON string is invalid with respect to GetSource200Response + */ + public static GetSource200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSource200Response.class); } - } - - /** - * Create an instance of GetSource200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSource200Response - * @throws IOException if the JSON string is invalid with respect to GetSource200Response - */ - public static GetSource200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSource200Response.class); - } - - /** - * Convert an instance of GetSource200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetSource200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSource200Response1.java b/src/main/java/com/segment/publicapi/models/GetSource200Response1.java index 4aeba4ef..6dea3514 100644 --- a/src/main/java/com/segment/publicapi/models/GetSource200Response1.java +++ b/src/main/java/com/segment/publicapi/models/GetSource200Response1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,185 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetSourceV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetSource200Response1 - */ - +/** GetSource200Response1 */ public class GetSource200Response1 { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetSourceV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetSource200Response1() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetSourceAlphaOutput data; - public GetSource200Response1 data(GetSourceV1Output data) { - - this.data = data; - return this; - } + public GetSource200Response1() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetSource200Response1 data(GetSourceAlphaOutput data) { - public GetSourceV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetSourceAlphaOutput getData() { + return data; + } - public void setData(GetSourceV1Output data) { - this.data = data; - } + public void setData(GetSourceAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSource200Response1 getSource200Response1 = (GetSource200Response1) o; + return Objects.equals(this.data, getSource200Response1.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSource200Response1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetSource200Response1 getSource200Response1 = (GetSource200Response1) o; - return Objects.equals(this.data, getSource200Response1.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSource200Response1 {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSource200Response1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSource200Response1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSource200Response1 is not found in the empty JSON string", GetSource200Response1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetSource200Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSource200Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetSource200Response1 is not found in" + + " the empty JSON string", + GetSource200Response1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSource200Response1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSource200Response1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSource200Response1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSource200Response1` 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()) { + GetSourceAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetSource200Response1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSource200Response1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSource200Response1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSource200Response1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSource200Response1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSource200Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSource200Response1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetSource200Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSource200Response1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSource200Response1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSource200Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSource200Response1 + * @throws IOException if the JSON string is invalid with respect to GetSource200Response1 + */ + public static GetSource200Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSource200Response1.class); } - } - - /** - * Create an instance of GetSource200Response1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSource200Response1 - * @throws IOException if the JSON string is invalid with respect to GetSource200Response1 - */ - public static GetSource200Response1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSource200Response1.class); - } - - /** - * Convert an instance of GetSource200Response1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetSource200Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSourceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GetSourceAlphaOutput.java index 30d905a8..cafff03c 100644 --- a/src/main/java/com/segment/publicapi/models/GetSourceAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/GetSourceAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,231 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Source1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Returns a Source. */ +public class GetSourceAlphaOutput { + public static final String SERIALIZED_NAME_SOURCE = "source"; -/** - * Returns a Source. - */ -@ApiModel(description = "Returns a Source.") + @SerializedName(SERIALIZED_NAME_SOURCE) + private SourceAlpha source; -public class GetSourceAlphaOutput { - public static final String SERIALIZED_NAME_SOURCE = "source"; - @SerializedName(SERIALIZED_NAME_SOURCE) - private Source1 source; + public static final String SERIALIZED_NAME_TRACKING_PLAN_ID = "trackingPlanId"; - public GetSourceAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_TRACKING_PLAN_ID) + private String trackingPlanId; + + public GetSourceAlphaOutput() {} + + public GetSourceAlphaOutput source(SourceAlpha source) { + + this.source = source; + return this; + } + + /** + * Get source + * + * @return source + */ + @javax.annotation.Nonnull + public SourceAlpha getSource() { + return source; + } - public GetSourceAlphaOutput source(Source1 source) { - - this.source = source; - return this; - } + public void setSource(SourceAlpha source) { + this.source = source; + } - /** - * Get source - * @return source - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetSourceAlphaOutput trackingPlanId(String trackingPlanId) { - public Source1 getSource() { - return source; - } + this.trackingPlanId = trackingPlanId; + return this; + } + /** + * The id of the Tracking Plan connected to the Source. + * + * @return trackingPlanId + */ + @javax.annotation.Nullable + public String getTrackingPlanId() { + return trackingPlanId; + } - public void setSource(Source1 source) { - this.source = source; - } + public void setTrackingPlanId(String trackingPlanId) { + this.trackingPlanId = trackingPlanId; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSourceAlphaOutput getSourceAlphaOutput = (GetSourceAlphaOutput) o; + return Objects.equals(this.source, getSourceAlphaOutput.source) + && Objects.equals(this.trackingPlanId, getSourceAlphaOutput.trackingPlanId); + } + @Override + public int hashCode() { + return Objects.hash(source, trackingPlanId); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSourceAlphaOutput {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" trackingPlanId: ").append(toIndentedString(trackingPlanId)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetSourceAlphaOutput getSourceAlphaOutput = (GetSourceAlphaOutput) o; - return Objects.equals(this.source, getSourceAlphaOutput.source); - } - - @Override - public int hashCode() { - return Objects.hash(source); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSourceAlphaOutput {\n"); - sb.append(" source: ").append(toIndentedString(source)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("trackingPlanId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); + openapiRequiredFields.add("trackingPlanId"); } - return o.toString().replace("\n", "\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"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("source"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSourceAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSourceAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSourceAlphaOutput is not found in the empty JSON string", GetSourceAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetSourceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSourceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetSourceAlphaOutput is not found in" + + " the empty JSON string", + GetSourceAlphaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSourceAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSourceAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSourceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSourceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetSourceAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetSourceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `source` + SourceAlpha.validateJsonElement(jsonObj.get("source")); + if ((jsonObj.get("trackingPlanId") != null && !jsonObj.get("trackingPlanId").isJsonNull()) + && !jsonObj.get("trackingPlanId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `trackingPlanId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("trackingPlanId").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetSourceAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSourceAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSourceAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSourceAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSourceAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSourceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSourceAlphaOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetSourceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSourceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSourceAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSourceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSourceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to GetSourceAlphaOutput + */ + public static GetSourceAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSourceAlphaOutput.class); } - } - - /** - * Create an instance of GetSourceAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSourceAlphaOutput - * @throws IOException if the JSON string is invalid with respect to GetSourceAlphaOutput - */ - public static GetSourceAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSourceAlphaOutput.class); - } - - /** - * Convert an instance of GetSourceAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetSourceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSourceMetadata200Response.java b/src/main/java/com/segment/publicapi/models/GetSourceMetadata200Response.java index 127f06bb..ba20324a 100644 --- a/src/main/java/com/segment/publicapi/models/GetSourceMetadata200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetSourceMetadata200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,190 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetSourceMetadataV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetSourceMetadata200Response - */ - +/** GetSourceMetadata200Response */ public class GetSourceMetadata200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetSourceMetadataV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetSourceMetadata200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetSourceMetadataV1Output data; - public GetSourceMetadata200Response data(GetSourceMetadataV1Output data) { - - this.data = data; - return this; - } + public GetSourceMetadata200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetSourceMetadata200Response data(GetSourceMetadataV1Output data) { - public GetSourceMetadataV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetSourceMetadataV1Output getData() { + return data; + } - public void setData(GetSourceMetadataV1Output data) { - this.data = data; - } + public void setData(GetSourceMetadataV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSourceMetadata200Response getSourceMetadata200Response = + (GetSourceMetadata200Response) o; + return Objects.equals(this.data, getSourceMetadata200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSourceMetadata200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetSourceMetadata200Response getSourceMetadata200Response = (GetSourceMetadata200Response) o; - return Objects.equals(this.data, getSourceMetadata200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSourceMetadata200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSourceMetadata200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSourceMetadata200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSourceMetadata200Response is not found in the empty JSON string", GetSourceMetadata200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetSourceMetadata200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSourceMetadata200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetSourceMetadata200Response is not" + + " found in the empty JSON string", + GetSourceMetadata200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSourceMetadata200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSourceMetadata200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSourceMetadata200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSourceMetadata200Response` 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()) { + GetSourceMetadataV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetSourceMetadata200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSourceMetadata200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSourceMetadata200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSourceMetadata200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSourceMetadata200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSourceMetadata200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSourceMetadata200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetSourceMetadata200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSourceMetadata200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSourceMetadata200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSourceMetadata200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSourceMetadata200Response + * @throws IOException if the JSON string is invalid with respect to + * GetSourceMetadata200Response + */ + public static GetSourceMetadata200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSourceMetadata200Response.class); } - } - - /** - * Create an instance of GetSourceMetadata200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSourceMetadata200Response - * @throws IOException if the JSON string is invalid with respect to GetSourceMetadata200Response - */ - public static GetSourceMetadata200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSourceMetadata200Response.class); - } - - /** - * Convert an instance of GetSourceMetadata200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetSourceMetadata200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSourceMetadataV1Output.java b/src/main/java/com/segment/publicapi/models/GetSourceMetadataV1Output.java index 69211839..c2b92441 100644 --- a/src/main/java/com/segment/publicapi/models/GetSourceMetadataV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetSourceMetadataV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.SourceMetadata; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the Source catalog item looked up by id. - */ -@ApiModel(description = "Returns the Source catalog item looked up by id.") - +/** Returns the Source catalog item looked up by id. */ public class GetSourceMetadataV1Output { - public static final String SERIALIZED_NAME_SOURCE_METADATA = "sourceMetadata"; - @SerializedName(SERIALIZED_NAME_SOURCE_METADATA) - private SourceMetadata sourceMetadata; + public static final String SERIALIZED_NAME_SOURCE_METADATA = "sourceMetadata"; - public GetSourceMetadataV1Output() { - } + @SerializedName(SERIALIZED_NAME_SOURCE_METADATA) + private SourceMetadataV1 sourceMetadata; - public GetSourceMetadataV1Output sourceMetadata(SourceMetadata sourceMetadata) { - - this.sourceMetadata = sourceMetadata; - return this; - } + public GetSourceMetadataV1Output() {} - /** - * Get sourceMetadata - * @return sourceMetadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetSourceMetadataV1Output sourceMetadata(SourceMetadataV1 sourceMetadata) { - public SourceMetadata getSourceMetadata() { - return sourceMetadata; - } + this.sourceMetadata = sourceMetadata; + return this; + } + /** + * Get sourceMetadata + * + * @return sourceMetadata + */ + @javax.annotation.Nonnull + public SourceMetadataV1 getSourceMetadata() { + return sourceMetadata; + } - public void setSourceMetadata(SourceMetadata sourceMetadata) { - this.sourceMetadata = sourceMetadata; - } + public void setSourceMetadata(SourceMetadataV1 sourceMetadata) { + this.sourceMetadata = sourceMetadata; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSourceMetadataV1Output getSourceMetadataV1Output = (GetSourceMetadataV1Output) o; + return Objects.equals(this.sourceMetadata, getSourceMetadataV1Output.sourceMetadata); + } + @Override + public int hashCode() { + return Objects.hash(sourceMetadata); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSourceMetadataV1Output {\n"); + sb.append(" sourceMetadata: ").append(toIndentedString(sourceMetadata)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetSourceMetadataV1Output getSourceMetadataV1Output = (GetSourceMetadataV1Output) o; - return Objects.equals(this.sourceMetadata, getSourceMetadataV1Output.sourceMetadata); - } - - @Override - public int hashCode() { - return Objects.hash(sourceMetadata); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSourceMetadataV1Output {\n"); - sb.append(" sourceMetadata: ").append(toIndentedString(sourceMetadata)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceMetadata"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceMetadata"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourceMetadata"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("sourceMetadata"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSourceMetadataV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSourceMetadataV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSourceMetadataV1Output is not found in the empty JSON string", GetSourceMetadataV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetSourceMetadataV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSourceMetadataV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetSourceMetadataV1Output is not found" + + " in the empty JSON string", + GetSourceMetadataV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSourceMetadataV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSourceMetadataV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSourceMetadataV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSourceMetadataV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetSourceMetadataV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetSourceMetadataV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `sourceMetadata` + SourceMetadataV1.validateJsonElement(jsonObj.get("sourceMetadata")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetSourceMetadataV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSourceMetadataV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSourceMetadataV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSourceMetadataV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSourceMetadataV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSourceMetadataV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSourceMetadataV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetSourceMetadataV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSourceMetadataV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSourceMetadataV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSourceMetadataV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSourceMetadataV1Output + * @throws IOException if the JSON string is invalid with respect to GetSourceMetadataV1Output + */ + public static GetSourceMetadataV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSourceMetadataV1Output.class); } - } - - /** - * Create an instance of GetSourceMetadataV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSourceMetadataV1Output - * @throws IOException if the JSON string is invalid with respect to GetSourceMetadataV1Output - */ - public static GetSourceMetadataV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSourceMetadataV1Output.class); - } - - /** - * Convert an instance of GetSourceMetadataV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetSourceMetadataV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSourceV1Output.java b/src/main/java/com/segment/publicapi/models/GetSourceV1Output.java index bed46b92..dbf91a4c 100644 --- a/src/main/java/com/segment/publicapi/models/GetSourceV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetSourceV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,231 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Source4; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Returns a Source. */ +public class GetSourceV1Output { + public static final String SERIALIZED_NAME_SOURCE = "source"; -/** - * Returns a Source. - */ -@ApiModel(description = "Returns a Source.") + @SerializedName(SERIALIZED_NAME_SOURCE) + private SourceV1 source; -public class GetSourceV1Output { - public static final String SERIALIZED_NAME_SOURCE = "source"; - @SerializedName(SERIALIZED_NAME_SOURCE) - private Source4 source; + public static final String SERIALIZED_NAME_TRACKING_PLAN_ID = "trackingPlanId"; - public GetSourceV1Output() { - } + @SerializedName(SERIALIZED_NAME_TRACKING_PLAN_ID) + private String trackingPlanId; + + public GetSourceV1Output() {} + + public GetSourceV1Output source(SourceV1 source) { + + this.source = source; + return this; + } + + /** + * Get source + * + * @return source + */ + @javax.annotation.Nonnull + public SourceV1 getSource() { + return source; + } - public GetSourceV1Output source(Source4 source) { - - this.source = source; - return this; - } + public void setSource(SourceV1 source) { + this.source = source; + } - /** - * Get source - * @return source - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetSourceV1Output trackingPlanId(String trackingPlanId) { - public Source4 getSource() { - return source; - } + this.trackingPlanId = trackingPlanId; + return this; + } + /** + * The id of the Tracking Plan connected to the Source. + * + * @return trackingPlanId + */ + @javax.annotation.Nullable + public String getTrackingPlanId() { + return trackingPlanId; + } - public void setSource(Source4 source) { - this.source = source; - } + public void setTrackingPlanId(String trackingPlanId) { + this.trackingPlanId = trackingPlanId; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSourceV1Output getSourceV1Output = (GetSourceV1Output) o; + return Objects.equals(this.source, getSourceV1Output.source) + && Objects.equals(this.trackingPlanId, getSourceV1Output.trackingPlanId); + } + @Override + public int hashCode() { + return Objects.hash(source, trackingPlanId); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSourceV1Output {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" trackingPlanId: ").append(toIndentedString(trackingPlanId)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetSourceV1Output getSourceV1Output = (GetSourceV1Output) o; - return Objects.equals(this.source, getSourceV1Output.source); - } - - @Override - public int hashCode() { - return Objects.hash(source); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSourceV1Output {\n"); - sb.append(" source: ").append(toIndentedString(source)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("trackingPlanId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); + openapiRequiredFields.add("trackingPlanId"); } - return o.toString().replace("\n", "\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"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("source"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSourceV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSourceV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSourceV1Output is not found in the empty JSON string", GetSourceV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetSourceV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSourceV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetSourceV1Output is not found in the" + + " empty JSON string", + GetSourceV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSourceV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSourceV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSourceV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSourceV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetSourceV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetSourceV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `source` + SourceV1.validateJsonElement(jsonObj.get("source")); + if ((jsonObj.get("trackingPlanId") != null && !jsonObj.get("trackingPlanId").isJsonNull()) + && !jsonObj.get("trackingPlanId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `trackingPlanId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("trackingPlanId").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetSourceV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSourceV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSourceV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSourceV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSourceV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSourceV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSourceV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetSourceV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSourceV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSourceV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSourceV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSourceV1Output + * @throws IOException if the JSON string is invalid with respect to GetSourceV1Output + */ + public static GetSourceV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSourceV1Output.class); } - } - - /** - * Create an instance of GetSourceV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSourceV1Output - * @throws IOException if the JSON string is invalid with respect to GetSourceV1Output - */ - public static GetSourceV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSourceV1Output.class); - } - - /** - * Convert an instance of GetSourceV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetSourceV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSourcesCatalog200Response.java b/src/main/java/com/segment/publicapi/models/GetSourcesCatalog200Response.java index 1e5e0958..edf451b8 100644 --- a/src/main/java/com/segment/publicapi/models/GetSourcesCatalog200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetSourcesCatalog200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,190 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetSourcesCatalogV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetSourcesCatalog200Response - */ - +/** GetSourcesCatalog200Response */ public class GetSourcesCatalog200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetSourcesCatalogV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetSourcesCatalog200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetSourcesCatalogV1Output data; - public GetSourcesCatalog200Response data(GetSourcesCatalogV1Output data) { - - this.data = data; - return this; - } + public GetSourcesCatalog200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetSourcesCatalog200Response data(GetSourcesCatalogV1Output data) { - public GetSourcesCatalogV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetSourcesCatalogV1Output getData() { + return data; + } - public void setData(GetSourcesCatalogV1Output data) { - this.data = data; - } + public void setData(GetSourcesCatalogV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSourcesCatalog200Response getSourcesCatalog200Response = + (GetSourcesCatalog200Response) o; + return Objects.equals(this.data, getSourcesCatalog200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSourcesCatalog200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetSourcesCatalog200Response getSourcesCatalog200Response = (GetSourcesCatalog200Response) o; - return Objects.equals(this.data, getSourcesCatalog200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSourcesCatalog200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSourcesCatalog200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSourcesCatalog200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSourcesCatalog200Response is not found in the empty JSON string", GetSourcesCatalog200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetSourcesCatalog200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSourcesCatalog200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetSourcesCatalog200Response is not" + + " found in the empty JSON string", + GetSourcesCatalog200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSourcesCatalog200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSourcesCatalog200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSourcesCatalog200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSourcesCatalog200Response` 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()) { + GetSourcesCatalogV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetSourcesCatalog200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSourcesCatalog200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSourcesCatalog200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSourcesCatalog200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSourcesCatalog200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSourcesCatalog200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSourcesCatalog200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetSourcesCatalog200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSourcesCatalog200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSourcesCatalog200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSourcesCatalog200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSourcesCatalog200Response + * @throws IOException if the JSON string is invalid with respect to + * GetSourcesCatalog200Response + */ + public static GetSourcesCatalog200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSourcesCatalog200Response.class); } - } - - /** - * Create an instance of GetSourcesCatalog200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSourcesCatalog200Response - * @throws IOException if the JSON string is invalid with respect to GetSourcesCatalog200Response - */ - public static GetSourcesCatalog200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSourcesCatalog200Response.class); - } - - /** - * Convert an instance of GetSourcesCatalog200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetSourcesCatalog200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSourcesCatalogV1Output.java b/src/main/java/com/segment/publicapi/models/GetSourcesCatalogV1Output.java index 3cf0ebe7..b91e211f 100644 --- a/src/main/java/com/segment/publicapi/models/GetSourcesCatalogV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetSourcesCatalogV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,251 +9,250 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Pagination; -import com.segment.publicapi.models.SourceMetadataV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a list of all Source catalog items contained within a given page. - */ -@ApiModel(description = "Returns a list of all Source catalog items contained within a given page.") - +/** Returns a list of all Source catalog items contained within a given page. */ public class GetSourcesCatalogV1Output { - public static final String SERIALIZED_NAME_SOURCES_CATALOG = "sourcesCatalog"; - @SerializedName(SERIALIZED_NAME_SOURCES_CATALOG) - private List sourcesCatalog = new ArrayList<>(); + public static final String SERIALIZED_NAME_SOURCES_CATALOG = "sourcesCatalog"; - public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - @SerializedName(SERIALIZED_NAME_PAGINATION) - private Pagination pagination; + @SerializedName(SERIALIZED_NAME_SOURCES_CATALOG) + private List sourcesCatalog = new ArrayList<>(); - public GetSourcesCatalogV1Output() { - } + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - public GetSourcesCatalogV1Output sourcesCatalog(List sourcesCatalog) { - - this.sourcesCatalog = sourcesCatalog; - return this; - } + @SerializedName(SERIALIZED_NAME_PAGINATION) + private PaginationOutput pagination; - public GetSourcesCatalogV1Output addSourcesCatalogItem(SourceMetadataV1 sourcesCatalogItem) { - this.sourcesCatalog.add(sourcesCatalogItem); - return this; - } + public GetSourcesCatalogV1Output() {} - /** - * All Source catalog items contained within the requested page. - * @return sourcesCatalog - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "All Source catalog items contained within the requested page.") - - public List getSourcesCatalog() { - return sourcesCatalog; - } + public GetSourcesCatalogV1Output sourcesCatalog(List sourcesCatalog) { + this.sourcesCatalog = sourcesCatalog; + return this; + } - public void setSourcesCatalog(List sourcesCatalog) { - this.sourcesCatalog = sourcesCatalog; - } + public GetSourcesCatalogV1Output addSourcesCatalogItem(SourceMetadataV1 sourcesCatalogItem) { + if (this.sourcesCatalog == null) { + this.sourcesCatalog = new ArrayList<>(); + } + this.sourcesCatalog.add(sourcesCatalogItem); + return this; + } + /** + * All Source catalog items contained within the requested page. + * + * @return sourcesCatalog + */ + @javax.annotation.Nonnull + public List getSourcesCatalog() { + return sourcesCatalog; + } - public GetSourcesCatalogV1Output pagination(Pagination pagination) { - - this.pagination = pagination; - return this; - } + public void setSourcesCatalog(List sourcesCatalog) { + this.sourcesCatalog = sourcesCatalog; + } - /** - * Get pagination - * @return pagination - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetSourcesCatalogV1Output pagination(PaginationOutput pagination) { - public Pagination getPagination() { - return pagination; - } + this.pagination = pagination; + return this; + } + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nonnull + public PaginationOutput getPagination() { + return pagination; + } - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } + public void setPagination(PaginationOutput pagination) { + this.pagination = pagination; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSourcesCatalogV1Output getSourcesCatalogV1Output = (GetSourcesCatalogV1Output) o; + return Objects.equals(this.sourcesCatalog, getSourcesCatalogV1Output.sourcesCatalog) + && Objects.equals(this.pagination, getSourcesCatalogV1Output.pagination); + } + @Override + public int hashCode() { + return Objects.hash(sourcesCatalog, pagination); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSourcesCatalogV1Output {\n"); + sb.append(" sourcesCatalog: ").append(toIndentedString(sourcesCatalog)).append("\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetSourcesCatalogV1Output getSourcesCatalogV1Output = (GetSourcesCatalogV1Output) o; - return Objects.equals(this.sourcesCatalog, getSourcesCatalogV1Output.sourcesCatalog) && - Objects.equals(this.pagination, getSourcesCatalogV1Output.pagination); - } - - @Override - public int hashCode() { - return Objects.hash(sourcesCatalog, pagination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSourcesCatalogV1Output {\n"); - sb.append(" sourcesCatalog: ").append(toIndentedString(sourcesCatalog)).append("\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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourcesCatalog"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourcesCatalog"); + openapiRequiredFields.add("pagination"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourcesCatalog"); - openapiFields.add("pagination"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("sourcesCatalog"); - openapiRequiredFields.add("pagination"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSourcesCatalogV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSourcesCatalogV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSourcesCatalogV1Output is not found in the empty JSON string", GetSourcesCatalogV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetSourcesCatalogV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSourcesCatalogV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetSourcesCatalogV1Output is not found" + + " in the empty JSON string", + GetSourcesCatalogV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSourcesCatalogV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSourcesCatalogV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSourcesCatalogV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSourcesCatalogV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetSourcesCatalogV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetSourcesCatalogV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourcesCatalog").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourcesCatalog` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("sourcesCatalog").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("sourcesCatalog").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `sourcesCatalog` to be an array in the JSON string but got `%s`", jsonObj.get("sourcesCatalog").toString())); - } - JsonArray jsonArraysourcesCatalog = jsonObj.getAsJsonArray("sourcesCatalog"); - } + JsonArray jsonArraysourcesCatalog = jsonObj.getAsJsonArray("sourcesCatalog"); + // validate the required field `sourcesCatalog` (array) + for (int i = 0; i < jsonArraysourcesCatalog.size(); i++) { + SourceMetadataV1.validateJsonElement(jsonArraysourcesCatalog.get(i)); + } + ; + // validate the required field `pagination` + PaginationOutput.validateJsonElement(jsonObj.get("pagination")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetSourcesCatalogV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSourcesCatalogV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSourcesCatalogV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSourcesCatalogV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSourcesCatalogV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSourcesCatalogV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSourcesCatalogV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetSourcesCatalogV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSourcesCatalogV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSourcesCatalogV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSourcesCatalogV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSourcesCatalogV1Output + * @throws IOException if the JSON string is invalid with respect to GetSourcesCatalogV1Output + */ + public static GetSourcesCatalogV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSourcesCatalogV1Output.class); } - } - - /** - * Create an instance of GetSourcesCatalogV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSourcesCatalogV1Output - * @throws IOException if the JSON string is invalid with respect to GetSourcesCatalogV1Output - */ - public static GetSourcesCatalogV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSourcesCatalogV1Output.class); - } - - /** - * Convert an instance of GetSourcesCatalogV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetSourcesCatalogV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSpace200Response.java b/src/main/java/com/segment/publicapi/models/GetSpace200Response.java index 61e5d0e5..6737ad29 100644 --- a/src/main/java/com/segment/publicapi/models/GetSpace200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetSpace200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,185 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetSpaceAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetSpace200Response - */ - +/** GetSpace200Response */ public class GetSpace200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetSpaceAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetSpace200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetSpaceAlphaOutput data; - public GetSpace200Response data(GetSpaceAlphaOutput data) { - - this.data = data; - return this; - } + public GetSpace200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetSpace200Response data(GetSpaceAlphaOutput data) { - public GetSpaceAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetSpaceAlphaOutput getData() { + return data; + } - public void setData(GetSpaceAlphaOutput data) { - this.data = data; - } + public void setData(GetSpaceAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSpace200Response getSpace200Response = (GetSpace200Response) o; + return Objects.equals(this.data, getSpace200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSpace200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetSpace200Response getSpace200Response = (GetSpace200Response) o; - return Objects.equals(this.data, getSpace200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSpace200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSpace200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSpace200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSpace200Response is not found in the empty JSON string", GetSpace200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetSpace200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSpace200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetSpace200Response is not found in" + + " the empty JSON string", + GetSpace200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSpace200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSpace200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSpace200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSpace200Response` 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()) { + GetSpaceAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetSpace200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSpace200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSpace200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSpace200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSpace200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSpace200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSpace200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetSpace200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSpace200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSpace200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSpace200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSpace200Response + * @throws IOException if the JSON string is invalid with respect to GetSpace200Response + */ + public static GetSpace200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSpace200Response.class); } - } - - /** - * Create an instance of GetSpace200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSpace200Response - * @throws IOException if the JSON string is invalid with respect to GetSpace200Response - */ - public static GetSpace200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSpace200Response.class); - } - - /** - * Convert an instance of GetSpace200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetSpace200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSpaceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GetSpaceAlphaOutput.java index 72ee2072..0ed03ea2 100644 --- a/src/main/java/com/segment/publicapi/models/GetSpaceAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/GetSpaceAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Space; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Response for the getSpaceById endpoint. - */ -@ApiModel(description = "Response for the getSpaceById endpoint.") - +/** Response for the getSpaceById endpoint. */ public class GetSpaceAlphaOutput { - public static final String SERIALIZED_NAME_SPACE = "space"; - @SerializedName(SERIALIZED_NAME_SPACE) - private Space space; + public static final String SERIALIZED_NAME_SPACE = "space"; - public GetSpaceAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_SPACE) + private Space space; - public GetSpaceAlphaOutput space(Space space) { - - this.space = space; - return this; - } + public GetSpaceAlphaOutput() {} - /** - * Get space - * @return space - **/ - @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "") + public GetSpaceAlphaOutput space(Space space) { - public Space getSpace() { - return space; - } + this.space = space; + return this; + } + /** + * Get space + * + * @return space + */ + @javax.annotation.Nullable + public Space getSpace() { + return space; + } - public void setSpace(Space space) { - this.space = space; - } + public void setSpace(Space space) { + this.space = space; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSpaceAlphaOutput getSpaceAlphaOutput = (GetSpaceAlphaOutput) o; + return Objects.equals(this.space, getSpaceAlphaOutput.space); + } + @Override + public int hashCode() { + return Objects.hash(space); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSpaceAlphaOutput {\n"); + sb.append(" space: ").append(toIndentedString(space)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetSpaceAlphaOutput getSpaceAlphaOutput = (GetSpaceAlphaOutput) o; - return Objects.equals(this.space, getSpaceAlphaOutput.space); - } - - @Override - public int hashCode() { - return Objects.hash(space); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSpaceAlphaOutput {\n"); - sb.append(" space: ").append(toIndentedString(space)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("space"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("space"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("space"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("space"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSpaceAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSpaceAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSpaceAlphaOutput is not found in the empty JSON string", GetSpaceAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetSpaceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSpaceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetSpaceAlphaOutput is not found in" + + " the empty JSON string", + GetSpaceAlphaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSpaceAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSpaceAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSpaceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSpaceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetSpaceAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetSpaceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `space` + Space.validateJsonElement(jsonObj.get("space")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetSpaceAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSpaceAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSpaceAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSpaceAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSpaceAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSpaceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSpaceAlphaOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetSpaceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSpaceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSpaceAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSpaceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSpaceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to GetSpaceAlphaOutput + */ + public static GetSpaceAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSpaceAlphaOutput.class); } - } - - /** - * Create an instance of GetSpaceAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSpaceAlphaOutput - * @throws IOException if the JSON string is invalid with respect to GetSpaceAlphaOutput - */ - public static GetSpaceAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSpaceAlphaOutput.class); - } - - /** - * Convert an instance of GetSpaceAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetSpaceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSubscriptionFromDestination200Response.java b/src/main/java/com/segment/publicapi/models/GetSubscriptionFromDestination200Response.java index 9cf49952..300a6899 100644 --- a/src/main/java/com/segment/publicapi/models/GetSubscriptionFromDestination200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetSubscriptionFromDestination200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,198 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetSubscriptionFromDestinationAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetSubscriptionFromDestination200Response - */ - +/** GetSubscriptionFromDestination200Response */ public class GetSubscriptionFromDestination200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetSubscriptionFromDestinationAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetSubscriptionFromDestination200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetSubscriptionFromDestinationAlphaOutput data; - public GetSubscriptionFromDestination200Response data(GetSubscriptionFromDestinationAlphaOutput data) { - - this.data = data; - return this; - } + public GetSubscriptionFromDestination200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetSubscriptionFromDestination200Response data( + GetSubscriptionFromDestinationAlphaOutput data) { - public GetSubscriptionFromDestinationAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetSubscriptionFromDestinationAlphaOutput getData() { + return data; + } - public void setData(GetSubscriptionFromDestinationAlphaOutput data) { - this.data = data; - } + public void setData(GetSubscriptionFromDestinationAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSubscriptionFromDestination200Response getSubscriptionFromDestination200Response = + (GetSubscriptionFromDestination200Response) o; + return Objects.equals(this.data, getSubscriptionFromDestination200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSubscriptionFromDestination200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetSubscriptionFromDestination200Response getSubscriptionFromDestination200Response = (GetSubscriptionFromDestination200Response) o; - return Objects.equals(this.data, getSubscriptionFromDestination200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSubscriptionFromDestination200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSubscriptionFromDestination200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSubscriptionFromDestination200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSubscriptionFromDestination200Response is not found in the empty JSON string", GetSubscriptionFromDestination200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetSubscriptionFromDestination200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSubscriptionFromDestination200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetSubscriptionFromDestination200Response is not found in" + + " the empty JSON string", + GetSubscriptionFromDestination200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSubscriptionFromDestination200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSubscriptionFromDestination200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSubscriptionFromDestination200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSubscriptionFromDestination200Response` 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()) { + GetSubscriptionFromDestinationAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetSubscriptionFromDestination200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSubscriptionFromDestination200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSubscriptionFromDestination200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSubscriptionFromDestination200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSubscriptionFromDestination200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSubscriptionFromDestination200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetSubscriptionFromDestination200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetSubscriptionFromDestination200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetSubscriptionFromDestination200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSubscriptionFromDestination200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSubscriptionFromDestination200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSubscriptionFromDestination200Response + * @throws IOException if the JSON string is invalid with respect to + * GetSubscriptionFromDestination200Response + */ + public static GetSubscriptionFromDestination200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetSubscriptionFromDestination200Response.class); } - } - - /** - * Create an instance of GetSubscriptionFromDestination200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSubscriptionFromDestination200Response - * @throws IOException if the JSON string is invalid with respect to GetSubscriptionFromDestination200Response - */ - public static GetSubscriptionFromDestination200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSubscriptionFromDestination200Response.class); - } - - /** - * Convert an instance of GetSubscriptionFromDestination200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetSubscriptionFromDestination200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSubscriptionFromDestinationAlphaOutput.java b/src/main/java/com/segment/publicapi/models/GetSubscriptionFromDestinationAlphaOutput.java index 939d2824..11f05dd2 100644 --- a/src/main/java/com/segment/publicapi/models/GetSubscriptionFromDestinationAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/GetSubscriptionFromDestinationAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,209 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Subscription; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a subscription for a given subscription id. - */ -@ApiModel(description = "Returns a subscription for a given subscription id.") - +/** Returns a subscription for a given subscription id. */ public class GetSubscriptionFromDestinationAlphaOutput { - public static final String SERIALIZED_NAME_SUBSCRIPTION = "subscription"; - @SerializedName(SERIALIZED_NAME_SUBSCRIPTION) - private Subscription subscription; + public static final String SERIALIZED_NAME_SUBSCRIPTION = "subscription"; - public GetSubscriptionFromDestinationAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_SUBSCRIPTION) + private DestinationSubscription subscription; - public GetSubscriptionFromDestinationAlphaOutput subscription(Subscription subscription) { - - this.subscription = subscription; - return this; - } + public GetSubscriptionFromDestinationAlphaOutput() {} - /** - * Get subscription - * @return subscription - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetSubscriptionFromDestinationAlphaOutput subscription( + DestinationSubscription subscription) { - public Subscription getSubscription() { - return subscription; - } + this.subscription = subscription; + return this; + } + /** + * Get subscription + * + * @return subscription + */ + @javax.annotation.Nonnull + public DestinationSubscription getSubscription() { + return subscription; + } - public void setSubscription(Subscription subscription) { - this.subscription = subscription; - } + public void setSubscription(DestinationSubscription subscription) { + this.subscription = subscription; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSubscriptionFromDestinationAlphaOutput getSubscriptionFromDestinationAlphaOutput = + (GetSubscriptionFromDestinationAlphaOutput) o; + return Objects.equals( + this.subscription, getSubscriptionFromDestinationAlphaOutput.subscription); + } + @Override + public int hashCode() { + return Objects.hash(subscription); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSubscriptionFromDestinationAlphaOutput {\n"); + sb.append(" subscription: ").append(toIndentedString(subscription)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetSubscriptionFromDestinationAlphaOutput getSubscriptionFromDestinationAlphaOutput = (GetSubscriptionFromDestinationAlphaOutput) o; - return Objects.equals(this.subscription, getSubscriptionFromDestinationAlphaOutput.subscription); - } - - @Override - public int hashCode() { - return Objects.hash(subscription); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSubscriptionFromDestinationAlphaOutput {\n"); - sb.append(" subscription: ").append(toIndentedString(subscription)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("subscription"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("subscription"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("subscription"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("subscription"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSubscriptionFromDestinationAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSubscriptionFromDestinationAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSubscriptionFromDestinationAlphaOutput is not found in the empty JSON string", GetSubscriptionFromDestinationAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetSubscriptionFromDestinationAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSubscriptionFromDestinationAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " GetSubscriptionFromDestinationAlphaOutput is not found in" + + " the empty JSON string", + GetSubscriptionFromDestinationAlphaOutput.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSubscriptionFromDestinationAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSubscriptionFromDestinationAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSubscriptionFromDestinationAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSubscriptionFromDestinationAlphaOutput` properties." + + " JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetSubscriptionFromDestinationAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + GetSubscriptionFromDestinationAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `subscription` + DestinationSubscription.validateJsonElement(jsonObj.get("subscription")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetSubscriptionFromDestinationAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSubscriptionFromDestinationAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSubscriptionFromDestinationAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSubscriptionFromDestinationAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSubscriptionFromDestinationAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSubscriptionFromDestinationAlphaOutput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'GetSubscriptionFromDestinationAlphaOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetSubscriptionFromDestinationAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, GetSubscriptionFromDestinationAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSubscriptionFromDestinationAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSubscriptionFromDestinationAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSubscriptionFromDestinationAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * GetSubscriptionFromDestinationAlphaOutput + */ + public static GetSubscriptionFromDestinationAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, GetSubscriptionFromDestinationAlphaOutput.class); } - } - - /** - * Create an instance of GetSubscriptionFromDestinationAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSubscriptionFromDestinationAlphaOutput - * @throws IOException if the JSON string is invalid with respect to GetSubscriptionFromDestinationAlphaOutput - */ - public static GetSubscriptionFromDestinationAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSubscriptionFromDestinationAlphaOutput.class); - } - - /** - * Convert an instance of GetSubscriptionFromDestinationAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetSubscriptionFromDestinationAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetSubscriptionRequest.java b/src/main/java/com/segment/publicapi/models/GetSubscriptionRequest.java index ca415707..56a3c528 100644 --- a/src/main/java/com/segment/publicapi/models/GetSubscriptionRequest.java +++ b/src/main/java/com/segment/publicapi/models/GetSubscriptionRequest.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,288 +9,288 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** GetSubscriptionRequest */ +public class GetSubscriptionRequest { + public static final String SERIALIZED_NAME_KEY = "key"; -/** - * GetSubscriptionRequest - */ + @SerializedName(SERIALIZED_NAME_KEY) + private String key; -public class GetSubscriptionRequest { - public static final String SERIALIZED_NAME_KEY = "key"; - @SerializedName(SERIALIZED_NAME_KEY) - private String key; - - /** - * Type is communication medium used. Either EMAIL or SMS. - */ - @JsonAdapter(TypeEnum.Adapter.class) - public enum TypeEnum { - EMAIL("EMAIL"), - - SMS("SMS"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } + /** Type is communication medium used. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ANDROID_PUSH("ANDROID_PUSH"), - public String getValue() { - return value; - } + EMAIL("EMAIL"), - @Override - public String toString() { - return String.valueOf(value); - } + IOS_PUSH("IOS_PUSH"), + + SMS("SMS"), - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; + WHATSAPP("WHATSAPP"); + + private String value; + + TypeEnum(String value) { + this.value = value; } - } - 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 String getValue() { + return value; + } - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - private TypeEnum type; + @Override + public String toString() { + return String.valueOf(value); + } - public GetSubscriptionRequest() { - } + 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 GetSubscriptionRequest key(String key) { - - this.key = key; - return this; - } + 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); + } + } + } - /** - * Key is the phone number or email. - * @return key - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Key is the phone number or email.") + public static final String SERIALIZED_NAME_TYPE = "type"; - public String getKey() { - return key; - } + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + public GetSubscriptionRequest() {} - public void setKey(String key) { - this.key = key; - } + public GetSubscriptionRequest key(String key) { + this.key = key; + return this; + } - public GetSubscriptionRequest type(TypeEnum type) { - - this.type = type; - return this; - } + /** + * Key is the phone number or email. + * + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } - /** - * Type is communication medium used. Either EMAIL or SMS. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Type is communication medium used. Either EMAIL or SMS.") + public void setKey(String key) { + this.key = key; + } - public TypeEnum getType() { - return type; - } + public GetSubscriptionRequest type(TypeEnum type) { + this.type = type; + return this; + } - public void setType(TypeEnum type) { - this.type = type; - } + /** + * Type is communication medium used. + * + * @return type + */ + @javax.annotation.Nonnull + 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; + } + GetSubscriptionRequest getSubscriptionRequest = (GetSubscriptionRequest) o; + return Objects.equals(this.key, getSubscriptionRequest.key) + && Objects.equals(this.type, getSubscriptionRequest.type); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public int hashCode() { + return Objects.hash(key, type); } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSubscriptionRequest {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); } - GetSubscriptionRequest getSubscriptionRequest = (GetSubscriptionRequest) o; - return Objects.equals(this.key, getSubscriptionRequest.key) && - Objects.equals(this.type, getSubscriptionRequest.type); - } - - @Override - public int hashCode() { - return Objects.hash(key, type); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetSubscriptionRequest {\n"); - sb.append(" key: ").append(toIndentedString(key)).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"; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("key"); - openapiFields.add("type"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("key"); - openapiRequiredFields.add("type"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetSubscriptionRequest - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetSubscriptionRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetSubscriptionRequest is not found in the empty JSON string", GetSubscriptionRequest.openapiRequiredFields.toString())); + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("key"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("key"); + 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 GetSubscriptionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSubscriptionRequest.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetSubscriptionRequest is not found in" + + " the empty JSON string", + GetSubscriptionRequest.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetSubscriptionRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSubscriptionRequest` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSubscriptionRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetSubscriptionRequest` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetSubscriptionRequest.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetSubscriptionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("key").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `key` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("key").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 (!GetSubscriptionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSubscriptionRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetSubscriptionRequest.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSubscriptionRequest value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSubscriptionRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - if (!jsonObj.get("key").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").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 (!GetSubscriptionRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetSubscriptionRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetSubscriptionRequest.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetSubscriptionRequest value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetSubscriptionRequest read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of GetSubscriptionRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetSubscriptionRequest - * @throws IOException if the JSON string is invalid with respect to GetSubscriptionRequest - */ - public static GetSubscriptionRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetSubscriptionRequest.class); - } - - /** - * Convert an instance of GetSubscriptionRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of GetSubscriptionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSubscriptionRequest + * @throws IOException if the JSON string is invalid with respect to GetSubscriptionRequest + */ + public static GetSubscriptionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSubscriptionRequest.class); + } + + /** + * Convert an instance of GetSubscriptionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetTrackingPlan200Response.java b/src/main/java/com/segment/publicapi/models/GetTrackingPlan200Response.java index 08a55453..6384876c 100644 --- a/src/main/java/com/segment/publicapi/models/GetTrackingPlan200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetTrackingPlan200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetTrackingPlanV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetTrackingPlan200Response - */ - +/** GetTrackingPlan200Response */ public class GetTrackingPlan200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetTrackingPlanV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetTrackingPlan200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetTrackingPlanV1Output data; - public GetTrackingPlan200Response data(GetTrackingPlanV1Output data) { - - this.data = data; - return this; - } + public GetTrackingPlan200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetTrackingPlan200Response data(GetTrackingPlanV1Output data) { - public GetTrackingPlanV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetTrackingPlanV1Output getData() { + return data; + } - public void setData(GetTrackingPlanV1Output data) { - this.data = data; - } + public void setData(GetTrackingPlanV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTrackingPlan200Response getTrackingPlan200Response = (GetTrackingPlan200Response) o; + return Objects.equals(this.data, getTrackingPlan200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetTrackingPlan200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetTrackingPlan200Response getTrackingPlan200Response = (GetTrackingPlan200Response) o; - return Objects.equals(this.data, getTrackingPlan200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetTrackingPlan200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetTrackingPlan200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetTrackingPlan200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetTrackingPlan200Response is not found in the empty JSON string", GetTrackingPlan200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetTrackingPlan200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetTrackingPlan200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetTrackingPlan200Response is not" + + " found in the empty JSON string", + GetTrackingPlan200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetTrackingPlan200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetTrackingPlan200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetTrackingPlan200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetTrackingPlan200Response` 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()) { + GetTrackingPlanV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetTrackingPlan200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetTrackingPlan200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetTrackingPlan200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetTrackingPlan200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetTrackingPlan200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetTrackingPlan200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetTrackingPlan200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetTrackingPlan200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetTrackingPlan200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetTrackingPlan200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetTrackingPlan200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetTrackingPlan200Response + * @throws IOException if the JSON string is invalid with respect to GetTrackingPlan200Response + */ + public static GetTrackingPlan200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetTrackingPlan200Response.class); } - } - - /** - * Create an instance of GetTrackingPlan200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetTrackingPlan200Response - * @throws IOException if the JSON string is invalid with respect to GetTrackingPlan200Response - */ - public static GetTrackingPlan200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetTrackingPlan200Response.class); - } - - /** - * Convert an instance of GetTrackingPlan200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetTrackingPlan200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetTrackingPlanV1Output.java b/src/main/java/com/segment/publicapi/models/GetTrackingPlanV1Output.java index 0bd43183..b7c3e363 100644 --- a/src/main/java/com/segment/publicapi/models/GetTrackingPlanV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetTrackingPlanV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.TrackingPlan; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Gets a single Tracking Plan. - */ -@ApiModel(description = "Gets a single Tracking Plan.") - +/** Gets a single Tracking Plan. */ public class GetTrackingPlanV1Output { - public static final String SERIALIZED_NAME_TRACKING_PLAN = "trackingPlan"; - @SerializedName(SERIALIZED_NAME_TRACKING_PLAN) - private TrackingPlan trackingPlan; + public static final String SERIALIZED_NAME_TRACKING_PLAN = "trackingPlan"; - public GetTrackingPlanV1Output() { - } + @SerializedName(SERIALIZED_NAME_TRACKING_PLAN) + private TrackingPlanV1 trackingPlan; - public GetTrackingPlanV1Output trackingPlan(TrackingPlan trackingPlan) { - - this.trackingPlan = trackingPlan; - return this; - } + public GetTrackingPlanV1Output() {} - /** - * Get trackingPlan - * @return trackingPlan - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetTrackingPlanV1Output trackingPlan(TrackingPlanV1 trackingPlan) { - public TrackingPlan getTrackingPlan() { - return trackingPlan; - } + this.trackingPlan = trackingPlan; + return this; + } + /** + * Get trackingPlan + * + * @return trackingPlan + */ + @javax.annotation.Nonnull + public TrackingPlanV1 getTrackingPlan() { + return trackingPlan; + } - public void setTrackingPlan(TrackingPlan trackingPlan) { - this.trackingPlan = trackingPlan; - } + public void setTrackingPlan(TrackingPlanV1 trackingPlan) { + this.trackingPlan = trackingPlan; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTrackingPlanV1Output getTrackingPlanV1Output = (GetTrackingPlanV1Output) o; + return Objects.equals(this.trackingPlan, getTrackingPlanV1Output.trackingPlan); + } + @Override + public int hashCode() { + return Objects.hash(trackingPlan); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetTrackingPlanV1Output {\n"); + sb.append(" trackingPlan: ").append(toIndentedString(trackingPlan)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetTrackingPlanV1Output getTrackingPlanV1Output = (GetTrackingPlanV1Output) o; - return Objects.equals(this.trackingPlan, getTrackingPlanV1Output.trackingPlan); - } - - @Override - public int hashCode() { - return Objects.hash(trackingPlan); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetTrackingPlanV1Output {\n"); - sb.append(" trackingPlan: ").append(toIndentedString(trackingPlan)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("trackingPlan"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("trackingPlan"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("trackingPlan"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("trackingPlan"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetTrackingPlanV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetTrackingPlanV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetTrackingPlanV1Output is not found in the empty JSON string", GetTrackingPlanV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetTrackingPlanV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetTrackingPlanV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetTrackingPlanV1Output is not found" + + " in the empty JSON string", + GetTrackingPlanV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetTrackingPlanV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetTrackingPlanV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetTrackingPlanV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetTrackingPlanV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetTrackingPlanV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetTrackingPlanV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `trackingPlan` + TrackingPlanV1.validateJsonElement(jsonObj.get("trackingPlan")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetTrackingPlanV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetTrackingPlanV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetTrackingPlanV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetTrackingPlanV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetTrackingPlanV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetTrackingPlanV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetTrackingPlanV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetTrackingPlanV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetTrackingPlanV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetTrackingPlanV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetTrackingPlanV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetTrackingPlanV1Output + * @throws IOException if the JSON string is invalid with respect to GetTrackingPlanV1Output + */ + public static GetTrackingPlanV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetTrackingPlanV1Output.class); } - } - - /** - * Create an instance of GetTrackingPlanV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetTrackingPlanV1Output - * @throws IOException if the JSON string is invalid with respect to GetTrackingPlanV1Output - */ - public static GetTrackingPlanV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetTrackingPlanV1Output.class); - } - - /** - * Convert an instance of GetTrackingPlanV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetTrackingPlanV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetTransformation200Response.java b/src/main/java/com/segment/publicapi/models/GetTransformation200Response.java index 16376347..4938abde 100644 --- a/src/main/java/com/segment/publicapi/models/GetTransformation200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetTransformation200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,190 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetTransformationBetaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetTransformation200Response - */ - +/** GetTransformation200Response */ public class GetTransformation200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetTransformationBetaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetTransformation200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetTransformationV1Output data; - public GetTransformation200Response data(GetTransformationBetaOutput data) { - - this.data = data; - return this; - } + public GetTransformation200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetTransformation200Response data(GetTransformationV1Output data) { - public GetTransformationBetaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetTransformationV1Output getData() { + return data; + } - public void setData(GetTransformationBetaOutput data) { - this.data = data; - } + public void setData(GetTransformationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTransformation200Response getTransformation200Response = + (GetTransformation200Response) o; + return Objects.equals(this.data, getTransformation200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetTransformation200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetTransformation200Response getTransformation200Response = (GetTransformation200Response) o; - return Objects.equals(this.data, getTransformation200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetTransformation200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetTransformation200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetTransformation200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetTransformation200Response is not found in the empty JSON string", GetTransformation200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetTransformation200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetTransformation200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetTransformation200Response is not" + + " found in the empty JSON string", + GetTransformation200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetTransformation200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetTransformation200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetTransformation200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetTransformation200Response` 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()) { + GetTransformationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetTransformation200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetTransformation200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetTransformation200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetTransformation200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetTransformation200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetTransformation200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetTransformation200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetTransformation200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetTransformation200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetTransformation200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetTransformation200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetTransformation200Response + * @throws IOException if the JSON string is invalid with respect to + * GetTransformation200Response + */ + public static GetTransformation200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetTransformation200Response.class); } - } - - /** - * Create an instance of GetTransformation200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetTransformation200Response - * @throws IOException if the JSON string is invalid with respect to GetTransformation200Response - */ - public static GetTransformation200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetTransformation200Response.class); - } - - /** - * Convert an instance of GetTransformation200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetTransformation200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetTransformationBetaInput.java b/src/main/java/com/segment/publicapi/models/GetTransformationBetaInput.java new file mode 100644 index 00000000..018d10aa --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetTransformationBetaInput.java @@ -0,0 +1,208 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** The input of Transformation retrieval. */ +public class GetTransformationBetaInput { + public static final String SERIALIZED_NAME_TRANSFORMATION_ID = "transformationId"; + + @SerializedName(SERIALIZED_NAME_TRANSFORMATION_ID) + private String transformationId; + + public GetTransformationBetaInput() {} + + public GetTransformationBetaInput transformationId(String transformationId) { + + this.transformationId = transformationId; + return this; + } + + /** + * The Transformation id. + * + * @return transformationId + */ + @javax.annotation.Nonnull + public String getTransformationId() { + return transformationId; + } + + public void setTransformationId(String transformationId) { + this.transformationId = transformationId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTransformationBetaInput getTransformationBetaInput = (GetTransformationBetaInput) o; + return Objects.equals(this.transformationId, getTransformationBetaInput.transformationId); + } + + @Override + public int hashCode() { + return Objects.hash(transformationId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetTransformationBetaInput {\n"); + sb.append(" transformationId: ").append(toIndentedString(transformationId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transformationId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("transformationId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetTransformationBetaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetTransformationBetaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetTransformationBetaInput is not" + + " found in the empty JSON string", + GetTransformationBetaInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetTransformationBetaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetTransformationBetaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetTransformationBetaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("transformationId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transformationId` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("transformationId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetTransformationBetaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetTransformationBetaInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetTransformationBetaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetTransformationBetaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetTransformationBetaInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetTransformationBetaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetTransformationBetaInput + * @throws IOException if the JSON string is invalid with respect to GetTransformationBetaInput + */ + public static GetTransformationBetaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetTransformationBetaInput.class); + } + + /** + * Convert an instance of GetTransformationBetaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetTransformationBetaOutput.java b/src/main/java/com/segment/publicapi/models/GetTransformationBetaOutput.java index c8084adc..39840664 100644 --- a/src/main/java/com/segment/publicapi/models/GetTransformationBetaOutput.java +++ b/src/main/java/com/segment/publicapi/models/GetTransformationBetaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,196 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Transformation; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The output of Transformation retrieval. - */ -@ApiModel(description = "The output of Transformation retrieval.") - +/** The output of Transformation retrieval. */ public class GetTransformationBetaOutput { - public static final String SERIALIZED_NAME_TRANSFORMATION = "transformation"; - @SerializedName(SERIALIZED_NAME_TRANSFORMATION) - private Transformation transformation; + public static final String SERIALIZED_NAME_TRANSFORMATION = "transformation"; - public GetTransformationBetaOutput() { - } + @SerializedName(SERIALIZED_NAME_TRANSFORMATION) + private TransformationBeta transformation; - public GetTransformationBetaOutput transformation(Transformation transformation) { - - this.transformation = transformation; - return this; - } + public GetTransformationBetaOutput() {} - /** - * Get transformation - * @return transformation - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetTransformationBetaOutput transformation(TransformationBeta transformation) { - public Transformation getTransformation() { - return transformation; - } + this.transformation = transformation; + return this; + } + /** + * Get transformation + * + * @return transformation + */ + @javax.annotation.Nonnull + public TransformationBeta getTransformation() { + return transformation; + } - public void setTransformation(Transformation transformation) { - this.transformation = transformation; - } + public void setTransformation(TransformationBeta transformation) { + this.transformation = transformation; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTransformationBetaOutput getTransformationBetaOutput = (GetTransformationBetaOutput) o; + return Objects.equals(this.transformation, getTransformationBetaOutput.transformation); + } + @Override + public int hashCode() { + return Objects.hash(transformation); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetTransformationBetaOutput {\n"); + sb.append(" transformation: ").append(toIndentedString(transformation)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetTransformationBetaOutput getTransformationBetaOutput = (GetTransformationBetaOutput) o; - return Objects.equals(this.transformation, getTransformationBetaOutput.transformation); - } - - @Override - public int hashCode() { - return Objects.hash(transformation); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetTransformationBetaOutput {\n"); - sb.append(" transformation: ").append(toIndentedString(transformation)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transformation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("transformation"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("transformation"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("transformation"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetTransformationBetaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetTransformationBetaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetTransformationBetaOutput is not found in the empty JSON string", GetTransformationBetaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetTransformationBetaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetTransformationBetaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetTransformationBetaOutput is not" + + " found in the empty JSON string", + GetTransformationBetaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetTransformationBetaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetTransformationBetaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetTransformationBetaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetTransformationBetaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetTransformationBetaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetTransformationBetaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `transformation` + TransformationBeta.validateJsonElement(jsonObj.get("transformation")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetTransformationBetaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetTransformationBetaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetTransformationBetaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetTransformationBetaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetTransformationBetaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetTransformationBetaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetTransformationBetaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetTransformationBetaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetTransformationBetaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetTransformationBetaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetTransformationBetaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetTransformationBetaOutput + * @throws IOException if the JSON string is invalid with respect to GetTransformationBetaOutput + */ + public static GetTransformationBetaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetTransformationBetaOutput.class); } - } - - /** - * Create an instance of GetTransformationBetaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetTransformationBetaOutput - * @throws IOException if the JSON string is invalid with respect to GetTransformationBetaOutput - */ - public static GetTransformationBetaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetTransformationBetaOutput.class); - } - - /** - * Convert an instance of GetTransformationBetaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetTransformationBetaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetTransformationV1Output.java b/src/main/java/com/segment/publicapi/models/GetTransformationV1Output.java new file mode 100644 index 00000000..63e3cc2e --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GetTransformationV1Output.java @@ -0,0 +1,203 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** The output of Transformation retrieval. */ +public class GetTransformationV1Output { + public static final String SERIALIZED_NAME_TRANSFORMATION = "transformation"; + + @SerializedName(SERIALIZED_NAME_TRANSFORMATION) + private TransformationV1 transformation; + + public GetTransformationV1Output() {} + + public GetTransformationV1Output transformation(TransformationV1 transformation) { + + this.transformation = transformation; + return this; + } + + /** + * Get transformation + * + * @return transformation + */ + @javax.annotation.Nonnull + public TransformationV1 getTransformation() { + return transformation; + } + + public void setTransformation(TransformationV1 transformation) { + this.transformation = transformation; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTransformationV1Output getTransformationV1Output = (GetTransformationV1Output) o; + return Objects.equals(this.transformation, getTransformationV1Output.transformation); + } + + @Override + public int hashCode() { + return Objects.hash(transformation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetTransformationV1Output {\n"); + sb.append(" transformation: ").append(toIndentedString(transformation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transformation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("transformation"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetTransformationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetTransformationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetTransformationV1Output is not found" + + " in the empty JSON string", + GetTransformationV1Output.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetTransformationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetTransformationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetTransformationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `transformation` + TransformationV1.validateJsonElement(jsonObj.get("transformation")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetTransformationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetTransformationV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetTransformationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetTransformationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetTransformationV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetTransformationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetTransformationV1Output + * @throws IOException if the JSON string is invalid with respect to GetTransformationV1Output + */ + public static GetTransformationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetTransformationV1Output.class); + } + + /** + * Convert an instance of GetTransformationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetUser200Response.java b/src/main/java/com/segment/publicapi/models/GetUser200Response.java index b643bbab..562a4dea 100644 --- a/src/main/java/com/segment/publicapi/models/GetUser200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetUser200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,185 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetUserV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetUser200Response - */ - +/** GetUser200Response */ public class GetUser200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetUserV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetUser200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetUserV1Output data; - public GetUser200Response data(GetUserV1Output data) { - - this.data = data; - return this; - } + public GetUser200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetUser200Response data(GetUserV1Output data) { - public GetUserV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetUserV1Output getData() { + return data; + } - public void setData(GetUserV1Output data) { - this.data = data; - } + public void setData(GetUserV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUser200Response getUser200Response = (GetUser200Response) o; + return Objects.equals(this.data, getUser200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetUser200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetUser200Response getUser200Response = (GetUser200Response) o; - return Objects.equals(this.data, getUser200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetUser200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetUser200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetUser200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetUser200Response is not found in the empty JSON string", GetUser200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetUser200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetUser200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetUser200Response is not found in the" + + " empty JSON string", + GetUser200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetUser200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetUser200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetUser200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetUser200Response` 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()) { + GetUserV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetUser200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetUser200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetUser200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetUser200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetUser200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetUser200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetUser200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetUser200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetUser200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetUser200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetUser200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetUser200Response + * @throws IOException if the JSON string is invalid with respect to GetUser200Response + */ + public static GetUser200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetUser200Response.class); } - } - - /** - * Create an instance of GetUser200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetUser200Response - * @throws IOException if the JSON string is invalid with respect to GetUser200Response - */ - public static GetUser200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetUser200Response.class); - } - - /** - * Convert an instance of GetUser200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetUser200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetUserGroup200Response.java b/src/main/java/com/segment/publicapi/models/GetUserGroup200Response.java index 72ccbcf5..37313713 100644 --- a/src/main/java/com/segment/publicapi/models/GetUserGroup200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetUserGroup200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetUserGroupV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetUserGroup200Response - */ - +/** GetUserGroup200Response */ public class GetUserGroup200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetUserGroupV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetUserGroup200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetUserGroupV1Output data; - public GetUserGroup200Response data(GetUserGroupV1Output data) { - - this.data = data; - return this; - } + public GetUserGroup200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetUserGroup200Response data(GetUserGroupV1Output data) { - public GetUserGroupV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetUserGroupV1Output getData() { + return data; + } - public void setData(GetUserGroupV1Output data) { - this.data = data; - } + public void setData(GetUserGroupV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUserGroup200Response getUserGroup200Response = (GetUserGroup200Response) o; + return Objects.equals(this.data, getUserGroup200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetUserGroup200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetUserGroup200Response getUserGroup200Response = (GetUserGroup200Response) o; - return Objects.equals(this.data, getUserGroup200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetUserGroup200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetUserGroup200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetUserGroup200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetUserGroup200Response is not found in the empty JSON string", GetUserGroup200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetUserGroup200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetUserGroup200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetUserGroup200Response is not found" + + " in the empty JSON string", + GetUserGroup200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetUserGroup200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetUserGroup200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetUserGroup200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetUserGroup200Response` 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()) { + GetUserGroupV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetUserGroup200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetUserGroup200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetUserGroup200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetUserGroup200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetUserGroup200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetUserGroup200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetUserGroup200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetUserGroup200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetUserGroup200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetUserGroup200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetUserGroup200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetUserGroup200Response + * @throws IOException if the JSON string is invalid with respect to GetUserGroup200Response + */ + public static GetUserGroup200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetUserGroup200Response.class); } - } - - /** - * Create an instance of GetUserGroup200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetUserGroup200Response - * @throws IOException if the JSON string is invalid with respect to GetUserGroup200Response - */ - public static GetUserGroup200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetUserGroup200Response.class); - } - - /** - * Convert an instance of GetUserGroup200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetUserGroup200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetUserGroupV1Output.java b/src/main/java/com/segment/publicapi/models/GetUserGroupV1Output.java index 2cd100a1..836a82f1 100644 --- a/src/main/java/com/segment/publicapi/models/GetUserGroupV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetUserGroupV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UserGroup2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a user group with the given id. - */ -@ApiModel(description = "Returns a user group with the given id.") - +/** Returns a user group with the given id. */ public class GetUserGroupV1Output { - public static final String SERIALIZED_NAME_USER_GROUP = "userGroup"; - @SerializedName(SERIALIZED_NAME_USER_GROUP) - private UserGroup2 userGroup; + public static final String SERIALIZED_NAME_USER_GROUP = "userGroup"; - public GetUserGroupV1Output() { - } + @SerializedName(SERIALIZED_NAME_USER_GROUP) + private UserGroupV1 userGroup; - public GetUserGroupV1Output userGroup(UserGroup2 userGroup) { - - this.userGroup = userGroup; - return this; - } + public GetUserGroupV1Output() {} - /** - * Get userGroup - * @return userGroup - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetUserGroupV1Output userGroup(UserGroupV1 userGroup) { - public UserGroup2 getUserGroup() { - return userGroup; - } + this.userGroup = userGroup; + return this; + } + /** + * Get userGroup + * + * @return userGroup + */ + @javax.annotation.Nonnull + public UserGroupV1 getUserGroup() { + return userGroup; + } - public void setUserGroup(UserGroup2 userGroup) { - this.userGroup = userGroup; - } + public void setUserGroup(UserGroupV1 userGroup) { + this.userGroup = userGroup; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUserGroupV1Output getUserGroupV1Output = (GetUserGroupV1Output) o; + return Objects.equals(this.userGroup, getUserGroupV1Output.userGroup); + } + @Override + public int hashCode() { + return Objects.hash(userGroup); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetUserGroupV1Output {\n"); + sb.append(" userGroup: ").append(toIndentedString(userGroup)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetUserGroupV1Output getUserGroupV1Output = (GetUserGroupV1Output) o; - return Objects.equals(this.userGroup, getUserGroupV1Output.userGroup); - } - - @Override - public int hashCode() { - return Objects.hash(userGroup); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetUserGroupV1Output {\n"); - sb.append(" userGroup: ").append(toIndentedString(userGroup)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("userGroup"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("userGroup"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("userGroup"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("userGroup"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetUserGroupV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetUserGroupV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetUserGroupV1Output is not found in the empty JSON string", GetUserGroupV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetUserGroupV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetUserGroupV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetUserGroupV1Output is not found in" + + " the empty JSON string", + GetUserGroupV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetUserGroupV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetUserGroupV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetUserGroupV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetUserGroupV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetUserGroupV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetUserGroupV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `userGroup` + UserGroupV1.validateJsonElement(jsonObj.get("userGroup")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetUserGroupV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetUserGroupV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetUserGroupV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetUserGroupV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetUserGroupV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetUserGroupV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetUserGroupV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetUserGroupV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetUserGroupV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetUserGroupV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetUserGroupV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetUserGroupV1Output + * @throws IOException if the JSON string is invalid with respect to GetUserGroupV1Output + */ + public static GetUserGroupV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetUserGroupV1Output.class); } - } - - /** - * Create an instance of GetUserGroupV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetUserGroupV1Output - * @throws IOException if the JSON string is invalid with respect to GetUserGroupV1Output - */ - public static GetUserGroupV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetUserGroupV1Output.class); - } - - /** - * Convert an instance of GetUserGroupV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetUserGroupV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetUserV1Output.java b/src/main/java/com/segment/publicapi/models/GetUserV1Output.java index 846902ab..158f9f77 100644 --- a/src/main/java/com/segment/publicapi/models/GetUserV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetUserV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.User; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the user. - */ -@ApiModel(description = "Returns the user.") - +/** Returns the user. */ public class GetUserV1Output { - public static final String SERIALIZED_NAME_USER = "user"; - @SerializedName(SERIALIZED_NAME_USER) - private User user; + public static final String SERIALIZED_NAME_USER = "user"; - public GetUserV1Output() { - } + @SerializedName(SERIALIZED_NAME_USER) + private UserV1 user; - public GetUserV1Output user(User user) { - - this.user = user; - return this; - } + public GetUserV1Output() {} - /** - * Get user - * @return user - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetUserV1Output user(UserV1 user) { - public User getUser() { - return user; - } + this.user = user; + return this; + } + /** + * Get user + * + * @return user + */ + @javax.annotation.Nonnull + public UserV1 getUser() { + return user; + } - public void setUser(User user) { - this.user = user; - } + public void setUser(UserV1 user) { + this.user = user; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUserV1Output getUserV1Output = (GetUserV1Output) o; + return Objects.equals(this.user, getUserV1Output.user); + } + @Override + public int hashCode() { + return Objects.hash(user); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetUserV1Output {\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetUserV1Output getUserV1Output = (GetUserV1Output) o; - return Objects.equals(this.user, getUserV1Output.user); - } - - @Override - public int hashCode() { - return Objects.hash(user); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetUserV1Output {\n"); - sb.append(" user: ").append(toIndentedString(user)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("user"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("user"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("user"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("user"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetUserV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetUserV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetUserV1Output is not found in the empty JSON string", GetUserV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetUserV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetUserV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetUserV1Output is not found in the" + + " empty JSON string", + GetUserV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetUserV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetUserV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetUserV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetUserV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetUserV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetUserV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `user` + UserV1.validateJsonElement(jsonObj.get("user")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetUserV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetUserV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetUserV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetUserV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetUserV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetUserV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetUserV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetUserV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetUserV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetUserV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetUserV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetUserV1Output + * @throws IOException if the JSON string is invalid with respect to GetUserV1Output + */ + public static GetUserV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetUserV1Output.class); } - } - - /** - * Create an instance of GetUserV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetUserV1Output - * @throws IOException if the JSON string is invalid with respect to GetUserV1Output - */ - public static GetUserV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetUserV1Output.class); - } - - /** - * Convert an instance of GetUserV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetUserV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetWarehouse200Response.java b/src/main/java/com/segment/publicapi/models/GetWarehouse200Response.java index dbf81912..7d817e1c 100644 --- a/src/main/java/com/segment/publicapi/models/GetWarehouse200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetWarehouse200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetWarehouseV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetWarehouse200Response - */ - +/** GetWarehouse200Response */ public class GetWarehouse200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetWarehouseV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetWarehouse200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetWarehouseV1Output data; - public GetWarehouse200Response data(GetWarehouseV1Output data) { - - this.data = data; - return this; - } + public GetWarehouse200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetWarehouse200Response data(GetWarehouseV1Output data) { - public GetWarehouseV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetWarehouseV1Output getData() { + return data; + } - public void setData(GetWarehouseV1Output data) { - this.data = data; - } + public void setData(GetWarehouseV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWarehouse200Response getWarehouse200Response = (GetWarehouse200Response) o; + return Objects.equals(this.data, getWarehouse200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetWarehouse200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetWarehouse200Response getWarehouse200Response = (GetWarehouse200Response) o; - return Objects.equals(this.data, getWarehouse200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetWarehouse200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetWarehouse200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetWarehouse200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetWarehouse200Response is not found in the empty JSON string", GetWarehouse200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetWarehouse200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetWarehouse200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetWarehouse200Response is not found" + + " in the empty JSON string", + GetWarehouse200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetWarehouse200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetWarehouse200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetWarehouse200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetWarehouse200Response` 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()) { + GetWarehouseV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetWarehouse200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetWarehouse200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetWarehouse200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetWarehouse200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetWarehouse200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetWarehouse200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetWarehouse200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetWarehouse200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetWarehouse200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetWarehouse200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetWarehouse200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetWarehouse200Response + * @throws IOException if the JSON string is invalid with respect to GetWarehouse200Response + */ + public static GetWarehouse200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetWarehouse200Response.class); } - } - - /** - * Create an instance of GetWarehouse200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetWarehouse200Response - * @throws IOException if the JSON string is invalid with respect to GetWarehouse200Response - */ - public static GetWarehouse200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetWarehouse200Response.class); - } - - /** - * Convert an instance of GetWarehouse200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetWarehouse200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetWarehouseMetadata200Response.java b/src/main/java/com/segment/publicapi/models/GetWarehouseMetadata200Response.java index 8ab4fb7c..99e69060 100644 --- a/src/main/java/com/segment/publicapi/models/GetWarehouseMetadata200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetWarehouseMetadata200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetWarehouseMetadataV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetWarehouseMetadata200Response - */ - +/** GetWarehouseMetadata200Response */ public class GetWarehouseMetadata200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetWarehouseMetadataV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetWarehouseMetadata200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetWarehouseMetadataV1Output data; - public GetWarehouseMetadata200Response data(GetWarehouseMetadataV1Output data) { - - this.data = data; - return this; - } + public GetWarehouseMetadata200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetWarehouseMetadata200Response data(GetWarehouseMetadataV1Output data) { - public GetWarehouseMetadataV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetWarehouseMetadataV1Output getData() { + return data; + } - public void setData(GetWarehouseMetadataV1Output data) { - this.data = data; - } + public void setData(GetWarehouseMetadataV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWarehouseMetadata200Response getWarehouseMetadata200Response = + (GetWarehouseMetadata200Response) o; + return Objects.equals(this.data, getWarehouseMetadata200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetWarehouseMetadata200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetWarehouseMetadata200Response getWarehouseMetadata200Response = (GetWarehouseMetadata200Response) o; - return Objects.equals(this.data, getWarehouseMetadata200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetWarehouseMetadata200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetWarehouseMetadata200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetWarehouseMetadata200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetWarehouseMetadata200Response is not found in the empty JSON string", GetWarehouseMetadata200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetWarehouseMetadata200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetWarehouseMetadata200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetWarehouseMetadata200Response is not" + + " found in the empty JSON string", + GetWarehouseMetadata200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetWarehouseMetadata200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetWarehouseMetadata200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetWarehouseMetadata200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetWarehouseMetadata200Response` 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()) { + GetWarehouseMetadataV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetWarehouseMetadata200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetWarehouseMetadata200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetWarehouseMetadata200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetWarehouseMetadata200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetWarehouseMetadata200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetWarehouseMetadata200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetWarehouseMetadata200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetWarehouseMetadata200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetWarehouseMetadata200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetWarehouseMetadata200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetWarehouseMetadata200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetWarehouseMetadata200Response + * @throws IOException if the JSON string is invalid with respect to + * GetWarehouseMetadata200Response + */ + public static GetWarehouseMetadata200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetWarehouseMetadata200Response.class); } - } - - /** - * Create an instance of GetWarehouseMetadata200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetWarehouseMetadata200Response - * @throws IOException if the JSON string is invalid with respect to GetWarehouseMetadata200Response - */ - public static GetWarehouseMetadata200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetWarehouseMetadata200Response.class); - } - - /** - * Convert an instance of GetWarehouseMetadata200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetWarehouseMetadata200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetWarehouseMetadataV1Output.java b/src/main/java/com/segment/publicapi/models/GetWarehouseMetadataV1Output.java index 446756fe..8518c7d8 100644 --- a/src/main/java/com/segment/publicapi/models/GetWarehouseMetadataV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetWarehouseMetadataV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,202 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.WarehouseMetadata; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a Warehouse catalog item looked up by id. - */ -@ApiModel(description = "Returns a Warehouse catalog item looked up by id.") - +/** Returns a Warehouse catalog item looked up by id. */ public class GetWarehouseMetadataV1Output { - public static final String SERIALIZED_NAME_WAREHOUSE_METADATA = "warehouseMetadata"; - @SerializedName(SERIALIZED_NAME_WAREHOUSE_METADATA) - private WarehouseMetadata warehouseMetadata; + public static final String SERIALIZED_NAME_WAREHOUSE_METADATA = "warehouseMetadata"; - public GetWarehouseMetadataV1Output() { - } + @SerializedName(SERIALIZED_NAME_WAREHOUSE_METADATA) + private WarehouseMetadataV1 warehouseMetadata; - public GetWarehouseMetadataV1Output warehouseMetadata(WarehouseMetadata warehouseMetadata) { - - this.warehouseMetadata = warehouseMetadata; - return this; - } + public GetWarehouseMetadataV1Output() {} - /** - * Get warehouseMetadata - * @return warehouseMetadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetWarehouseMetadataV1Output warehouseMetadata(WarehouseMetadataV1 warehouseMetadata) { - public WarehouseMetadata getWarehouseMetadata() { - return warehouseMetadata; - } + this.warehouseMetadata = warehouseMetadata; + return this; + } + /** + * Get warehouseMetadata + * + * @return warehouseMetadata + */ + @javax.annotation.Nonnull + public WarehouseMetadataV1 getWarehouseMetadata() { + return warehouseMetadata; + } - public void setWarehouseMetadata(WarehouseMetadata warehouseMetadata) { - this.warehouseMetadata = warehouseMetadata; - } + public void setWarehouseMetadata(WarehouseMetadataV1 warehouseMetadata) { + this.warehouseMetadata = warehouseMetadata; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWarehouseMetadataV1Output getWarehouseMetadataV1Output = + (GetWarehouseMetadataV1Output) o; + return Objects.equals( + this.warehouseMetadata, getWarehouseMetadataV1Output.warehouseMetadata); + } + @Override + public int hashCode() { + return Objects.hash(warehouseMetadata); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetWarehouseMetadataV1Output {\n"); + sb.append(" warehouseMetadata: ") + .append(toIndentedString(warehouseMetadata)) + .append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetWarehouseMetadataV1Output getWarehouseMetadataV1Output = (GetWarehouseMetadataV1Output) o; - return Objects.equals(this.warehouseMetadata, getWarehouseMetadataV1Output.warehouseMetadata); - } - - @Override - public int hashCode() { - return Objects.hash(warehouseMetadata); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetWarehouseMetadataV1Output {\n"); - sb.append(" warehouseMetadata: ").append(toIndentedString(warehouseMetadata)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("warehouseMetadata"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("warehouseMetadata"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("warehouseMetadata"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("warehouseMetadata"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetWarehouseMetadataV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetWarehouseMetadataV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetWarehouseMetadataV1Output is not found in the empty JSON string", GetWarehouseMetadataV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetWarehouseMetadataV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetWarehouseMetadataV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetWarehouseMetadataV1Output is not" + + " found in the empty JSON string", + GetWarehouseMetadataV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetWarehouseMetadataV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetWarehouseMetadataV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetWarehouseMetadataV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetWarehouseMetadataV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetWarehouseMetadataV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetWarehouseMetadataV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `warehouseMetadata` + WarehouseMetadataV1.validateJsonElement(jsonObj.get("warehouseMetadata")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetWarehouseMetadataV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetWarehouseMetadataV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetWarehouseMetadataV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetWarehouseMetadataV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetWarehouseMetadataV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetWarehouseMetadataV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetWarehouseMetadataV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetWarehouseMetadataV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetWarehouseMetadataV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetWarehouseMetadataV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetWarehouseMetadataV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetWarehouseMetadataV1Output + * @throws IOException if the JSON string is invalid with respect to + * GetWarehouseMetadataV1Output + */ + public static GetWarehouseMetadataV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetWarehouseMetadataV1Output.class); } - } - - /** - * Create an instance of GetWarehouseMetadataV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetWarehouseMetadataV1Output - * @throws IOException if the JSON string is invalid with respect to GetWarehouseMetadataV1Output - */ - public static GetWarehouseMetadataV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetWarehouseMetadataV1Output.class); - } - - /** - * Convert an instance of GetWarehouseMetadataV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetWarehouseMetadataV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetWarehouseV1Output.java b/src/main/java/com/segment/publicapi/models/GetWarehouseV1Output.java index 104271f6..b7b336df 100644 --- a/src/main/java/com/segment/publicapi/models/GetWarehouseV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetWarehouseV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Warehouse; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a Warehouse. - */ -@ApiModel(description = "Returns a Warehouse.") - +/** Returns a Warehouse. */ public class GetWarehouseV1Output { - public static final String SERIALIZED_NAME_WAREHOUSE = "warehouse"; - @SerializedName(SERIALIZED_NAME_WAREHOUSE) - private Warehouse warehouse; + public static final String SERIALIZED_NAME_WAREHOUSE = "warehouse"; - public GetWarehouseV1Output() { - } + @SerializedName(SERIALIZED_NAME_WAREHOUSE) + private WarehouseV1 warehouse; - public GetWarehouseV1Output warehouse(Warehouse warehouse) { - - this.warehouse = warehouse; - return this; - } + public GetWarehouseV1Output() {} - /** - * Get warehouse - * @return warehouse - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetWarehouseV1Output warehouse(WarehouseV1 warehouse) { - public Warehouse getWarehouse() { - return warehouse; - } + this.warehouse = warehouse; + return this; + } + /** + * Get warehouse + * + * @return warehouse + */ + @javax.annotation.Nonnull + public WarehouseV1 getWarehouse() { + return warehouse; + } - public void setWarehouse(Warehouse warehouse) { - this.warehouse = warehouse; - } + public void setWarehouse(WarehouseV1 warehouse) { + this.warehouse = warehouse; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWarehouseV1Output getWarehouseV1Output = (GetWarehouseV1Output) o; + return Objects.equals(this.warehouse, getWarehouseV1Output.warehouse); + } + @Override + public int hashCode() { + return Objects.hash(warehouse); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetWarehouseV1Output {\n"); + sb.append(" warehouse: ").append(toIndentedString(warehouse)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetWarehouseV1Output getWarehouseV1Output = (GetWarehouseV1Output) o; - return Objects.equals(this.warehouse, getWarehouseV1Output.warehouse); - } - - @Override - public int hashCode() { - return Objects.hash(warehouse); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetWarehouseV1Output {\n"); - sb.append(" warehouse: ").append(toIndentedString(warehouse)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("warehouse"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("warehouse"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("warehouse"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("warehouse"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetWarehouseV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetWarehouseV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetWarehouseV1Output is not found in the empty JSON string", GetWarehouseV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetWarehouseV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetWarehouseV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetWarehouseV1Output is not found in" + + " the empty JSON string", + GetWarehouseV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetWarehouseV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetWarehouseV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetWarehouseV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetWarehouseV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetWarehouseV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetWarehouseV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `warehouse` + WarehouseV1.validateJsonElement(jsonObj.get("warehouse")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetWarehouseV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetWarehouseV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetWarehouseV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetWarehouseV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetWarehouseV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetWarehouseV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetWarehouseV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetWarehouseV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetWarehouseV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetWarehouseV1Output + * @throws IOException if the JSON string is invalid with respect to GetWarehouseV1Output + */ + public static GetWarehouseV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetWarehouseV1Output.class); } - } - - /** - * Create an instance of GetWarehouseV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetWarehouseV1Output - * @throws IOException if the JSON string is invalid with respect to GetWarehouseV1Output - */ - public static GetWarehouseV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetWarehouseV1Output.class); - } - - /** - * Convert an instance of GetWarehouseV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetWarehouseV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetWarehousesCatalog200Response.java b/src/main/java/com/segment/publicapi/models/GetWarehousesCatalog200Response.java index c1ce1546..406f90e6 100644 --- a/src/main/java/com/segment/publicapi/models/GetWarehousesCatalog200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetWarehousesCatalog200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetWarehousesCatalogV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetWarehousesCatalog200Response - */ - +/** GetWarehousesCatalog200Response */ public class GetWarehousesCatalog200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetWarehousesCatalogV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetWarehousesCatalog200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetWarehousesCatalogV1Output data; - public GetWarehousesCatalog200Response data(GetWarehousesCatalogV1Output data) { - - this.data = data; - return this; - } + public GetWarehousesCatalog200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetWarehousesCatalog200Response data(GetWarehousesCatalogV1Output data) { - public GetWarehousesCatalogV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetWarehousesCatalogV1Output getData() { + return data; + } - public void setData(GetWarehousesCatalogV1Output data) { - this.data = data; - } + public void setData(GetWarehousesCatalogV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWarehousesCatalog200Response getWarehousesCatalog200Response = + (GetWarehousesCatalog200Response) o; + return Objects.equals(this.data, getWarehousesCatalog200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetWarehousesCatalog200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetWarehousesCatalog200Response getWarehousesCatalog200Response = (GetWarehousesCatalog200Response) o; - return Objects.equals(this.data, getWarehousesCatalog200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetWarehousesCatalog200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetWarehousesCatalog200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetWarehousesCatalog200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetWarehousesCatalog200Response is not found in the empty JSON string", GetWarehousesCatalog200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetWarehousesCatalog200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetWarehousesCatalog200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetWarehousesCatalog200Response is not" + + " found in the empty JSON string", + GetWarehousesCatalog200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetWarehousesCatalog200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetWarehousesCatalog200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetWarehousesCatalog200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetWarehousesCatalog200Response` 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()) { + GetWarehousesCatalogV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetWarehousesCatalog200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetWarehousesCatalog200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetWarehousesCatalog200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetWarehousesCatalog200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetWarehousesCatalog200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetWarehousesCatalog200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetWarehousesCatalog200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetWarehousesCatalog200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetWarehousesCatalog200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetWarehousesCatalog200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetWarehousesCatalog200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetWarehousesCatalog200Response + * @throws IOException if the JSON string is invalid with respect to + * GetWarehousesCatalog200Response + */ + public static GetWarehousesCatalog200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetWarehousesCatalog200Response.class); } - } - - /** - * Create an instance of GetWarehousesCatalog200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetWarehousesCatalog200Response - * @throws IOException if the JSON string is invalid with respect to GetWarehousesCatalog200Response - */ - public static GetWarehousesCatalog200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetWarehousesCatalog200Response.class); - } - - /** - * Convert an instance of GetWarehousesCatalog200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetWarehousesCatalog200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetWarehousesCatalogV1Output.java b/src/main/java/com/segment/publicapi/models/GetWarehousesCatalogV1Output.java index 4871eca6..f1e4f3aa 100644 --- a/src/main/java/com/segment/publicapi/models/GetWarehousesCatalogV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetWarehousesCatalogV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,251 +9,259 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Pagination; -import com.segment.publicapi.models.WarehouseMetadataV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns a list of all Warehouse catalog items contained within a given page. - */ -@ApiModel(description = "Returns a list of all Warehouse catalog items contained within a given page.") - +/** Returns a list of all Warehouse catalog items contained within a given page. */ public class GetWarehousesCatalogV1Output { - public static final String SERIALIZED_NAME_WAREHOUSES_CATALOG = "warehousesCatalog"; - @SerializedName(SERIALIZED_NAME_WAREHOUSES_CATALOG) - private List warehousesCatalog = new ArrayList<>(); + public static final String SERIALIZED_NAME_WAREHOUSES_CATALOG = "warehousesCatalog"; - public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - @SerializedName(SERIALIZED_NAME_PAGINATION) - private Pagination pagination; + @SerializedName(SERIALIZED_NAME_WAREHOUSES_CATALOG) + private List warehousesCatalog = new ArrayList<>(); - public GetWarehousesCatalogV1Output() { - } + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - public GetWarehousesCatalogV1Output warehousesCatalog(List warehousesCatalog) { - - this.warehousesCatalog = warehousesCatalog; - return this; - } + @SerializedName(SERIALIZED_NAME_PAGINATION) + private PaginationOutput pagination; - public GetWarehousesCatalogV1Output addWarehousesCatalogItem(WarehouseMetadataV1 warehousesCatalogItem) { - this.warehousesCatalog.add(warehousesCatalogItem); - return this; - } + public GetWarehousesCatalogV1Output() {} - /** - * All Warehouse catalog items contained within the requested page. - * @return warehousesCatalog - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "All Warehouse catalog items contained within the requested page.") - - public List getWarehousesCatalog() { - return warehousesCatalog; - } + public GetWarehousesCatalogV1Output warehousesCatalog( + List warehousesCatalog) { + this.warehousesCatalog = warehousesCatalog; + return this; + } - public void setWarehousesCatalog(List warehousesCatalog) { - this.warehousesCatalog = warehousesCatalog; - } + public GetWarehousesCatalogV1Output addWarehousesCatalogItem( + WarehouseMetadataV1 warehousesCatalogItem) { + if (this.warehousesCatalog == null) { + this.warehousesCatalog = new ArrayList<>(); + } + this.warehousesCatalog.add(warehousesCatalogItem); + return this; + } + /** + * All Warehouse catalog items contained within the requested page. + * + * @return warehousesCatalog + */ + @javax.annotation.Nonnull + public List getWarehousesCatalog() { + return warehousesCatalog; + } - public GetWarehousesCatalogV1Output pagination(Pagination pagination) { - - this.pagination = pagination; - return this; - } + public void setWarehousesCatalog(List warehousesCatalog) { + this.warehousesCatalog = warehousesCatalog; + } - /** - * Get pagination - * @return pagination - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetWarehousesCatalogV1Output pagination(PaginationOutput pagination) { - public Pagination getPagination() { - return pagination; - } + this.pagination = pagination; + return this; + } + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nonnull + public PaginationOutput getPagination() { + return pagination; + } - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } + public void setPagination(PaginationOutput pagination) { + this.pagination = pagination; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWarehousesCatalogV1Output getWarehousesCatalogV1Output = + (GetWarehousesCatalogV1Output) o; + return Objects.equals( + this.warehousesCatalog, getWarehousesCatalogV1Output.warehousesCatalog) + && Objects.equals(this.pagination, getWarehousesCatalogV1Output.pagination); + } + @Override + public int hashCode() { + return Objects.hash(warehousesCatalog, pagination); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetWarehousesCatalogV1Output {\n"); + sb.append(" warehousesCatalog: ") + .append(toIndentedString(warehousesCatalog)) + .append("\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetWarehousesCatalogV1Output getWarehousesCatalogV1Output = (GetWarehousesCatalogV1Output) o; - return Objects.equals(this.warehousesCatalog, getWarehousesCatalogV1Output.warehousesCatalog) && - Objects.equals(this.pagination, getWarehousesCatalogV1Output.pagination); - } - - @Override - public int hashCode() { - return Objects.hash(warehousesCatalog, pagination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetWarehousesCatalogV1Output {\n"); - sb.append(" warehousesCatalog: ").append(toIndentedString(warehousesCatalog)).append("\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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("warehousesCatalog"); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("warehousesCatalog"); + openapiRequiredFields.add("pagination"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("warehousesCatalog"); - openapiFields.add("pagination"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("warehousesCatalog"); - openapiRequiredFields.add("pagination"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetWarehousesCatalogV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetWarehousesCatalogV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetWarehousesCatalogV1Output is not found in the empty JSON string", GetWarehousesCatalogV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * GetWarehousesCatalogV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetWarehousesCatalogV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetWarehousesCatalogV1Output is not" + + " found in the empty JSON string", + GetWarehousesCatalogV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetWarehousesCatalogV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetWarehousesCatalogV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetWarehousesCatalogV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetWarehousesCatalogV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetWarehousesCatalogV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetWarehousesCatalogV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("warehousesCatalog").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `warehousesCatalog` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("warehousesCatalog").toString())); } - } - // ensure the json data is an array - if (!jsonObj.get("warehousesCatalog").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `warehousesCatalog` to be an array in the JSON string but got `%s`", jsonObj.get("warehousesCatalog").toString())); - } - JsonArray jsonArraywarehousesCatalog = jsonObj.getAsJsonArray("warehousesCatalog"); - } + JsonArray jsonArraywarehousesCatalog = jsonObj.getAsJsonArray("warehousesCatalog"); + // validate the required field `warehousesCatalog` (array) + for (int i = 0; i < jsonArraywarehousesCatalog.size(); i++) { + WarehouseMetadataV1.validateJsonElement(jsonArraywarehousesCatalog.get(i)); + } + ; + // validate the required field `pagination` + PaginationOutput.validateJsonElement(jsonObj.get("pagination")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetWarehousesCatalogV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetWarehousesCatalogV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetWarehousesCatalogV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetWarehousesCatalogV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetWarehousesCatalogV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetWarehousesCatalogV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetWarehousesCatalogV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GetWarehousesCatalogV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetWarehousesCatalogV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetWarehousesCatalogV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetWarehousesCatalogV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetWarehousesCatalogV1Output + * @throws IOException if the JSON string is invalid with respect to + * GetWarehousesCatalogV1Output + */ + public static GetWarehousesCatalogV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetWarehousesCatalogV1Output.class); } - } - - /** - * Create an instance of GetWarehousesCatalogV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetWarehousesCatalogV1Output - * @throws IOException if the JSON string is invalid with respect to GetWarehousesCatalogV1Output - */ - public static GetWarehousesCatalogV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetWarehousesCatalogV1Output.class); - } - - /** - * Convert an instance of GetWarehousesCatalogV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetWarehousesCatalogV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetWorkspace200Response.java b/src/main/java/com/segment/publicapi/models/GetWorkspace200Response.java index eeaac250..5d723608 100644 --- a/src/main/java/com/segment/publicapi/models/GetWorkspace200Response.java +++ b/src/main/java/com/segment/publicapi/models/GetWorkspace200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.GetWorkspaceV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * GetWorkspace200Response - */ - +/** GetWorkspace200Response */ public class GetWorkspace200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private GetWorkspaceV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public GetWorkspace200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private GetWorkspaceV1Output data; - public GetWorkspace200Response data(GetWorkspaceV1Output data) { - - this.data = data; - return this; - } + public GetWorkspace200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public GetWorkspace200Response data(GetWorkspaceV1Output data) { - public GetWorkspaceV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public GetWorkspaceV1Output getData() { + return data; + } - public void setData(GetWorkspaceV1Output data) { - this.data = data; - } + public void setData(GetWorkspaceV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWorkspace200Response getWorkspace200Response = (GetWorkspace200Response) o; + return Objects.equals(this.data, getWorkspace200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetWorkspace200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetWorkspace200Response getWorkspace200Response = (GetWorkspace200Response) o; - return Objects.equals(this.data, getWorkspace200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetWorkspace200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetWorkspace200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetWorkspace200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetWorkspace200Response is not found in the empty JSON string", GetWorkspace200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetWorkspace200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetWorkspace200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetWorkspace200Response is not found" + + " in the empty JSON string", + GetWorkspace200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetWorkspace200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetWorkspace200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetWorkspace200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetWorkspace200Response` 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()) { + GetWorkspaceV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetWorkspace200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetWorkspace200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetWorkspace200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetWorkspace200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetWorkspace200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetWorkspace200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetWorkspace200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetWorkspace200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetWorkspace200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetWorkspace200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetWorkspace200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetWorkspace200Response + * @throws IOException if the JSON string is invalid with respect to GetWorkspace200Response + */ + public static GetWorkspace200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetWorkspace200Response.class); } - } - - /** - * Create an instance of GetWorkspace200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetWorkspace200Response - * @throws IOException if the JSON string is invalid with respect to GetWorkspace200Response - */ - public static GetWorkspace200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetWorkspace200Response.class); - } - - /** - * Convert an instance of GetWorkspace200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetWorkspace200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GetWorkspaceV1Output.java b/src/main/java/com/segment/publicapi/models/GetWorkspaceV1Output.java index a2298d60..ff5045f9 100644 --- a/src/main/java/com/segment/publicapi/models/GetWorkspaceV1Output.java +++ b/src/main/java/com/segment/publicapi/models/GetWorkspaceV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Workspace; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Represents the output of loading the Workspace. - */ -@ApiModel(description = "Represents the output of loading the Workspace.") - +/** Represents the output of loading the Workspace. */ public class GetWorkspaceV1Output { - public static final String SERIALIZED_NAME_WORKSPACE = "workspace"; - @SerializedName(SERIALIZED_NAME_WORKSPACE) - private Workspace workspace; + public static final String SERIALIZED_NAME_WORKSPACE = "workspace"; - public GetWorkspaceV1Output() { - } + @SerializedName(SERIALIZED_NAME_WORKSPACE) + private WorkspaceV1 workspace; - public GetWorkspaceV1Output workspace(Workspace workspace) { - - this.workspace = workspace; - return this; - } + public GetWorkspaceV1Output() {} - /** - * Get workspace - * @return workspace - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public GetWorkspaceV1Output workspace(WorkspaceV1 workspace) { - public Workspace getWorkspace() { - return workspace; - } + this.workspace = workspace; + return this; + } + /** + * Get workspace + * + * @return workspace + */ + @javax.annotation.Nonnull + public WorkspaceV1 getWorkspace() { + return workspace; + } - public void setWorkspace(Workspace workspace) { - this.workspace = workspace; - } + public void setWorkspace(WorkspaceV1 workspace) { + this.workspace = workspace; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWorkspaceV1Output getWorkspaceV1Output = (GetWorkspaceV1Output) o; + return Objects.equals(this.workspace, getWorkspaceV1Output.workspace); + } + @Override + public int hashCode() { + return Objects.hash(workspace); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetWorkspaceV1Output {\n"); + sb.append(" workspace: ").append(toIndentedString(workspace)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GetWorkspaceV1Output getWorkspaceV1Output = (GetWorkspaceV1Output) o; - return Objects.equals(this.workspace, getWorkspaceV1Output.workspace); - } - - @Override - public int hashCode() { - return Objects.hash(workspace); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetWorkspaceV1Output {\n"); - sb.append(" workspace: ").append(toIndentedString(workspace)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("workspace"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("workspace"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("workspace"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("workspace"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GetWorkspaceV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GetWorkspaceV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GetWorkspaceV1Output is not found in the empty JSON string", GetWorkspaceV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetWorkspaceV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetWorkspaceV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GetWorkspaceV1Output is not found in" + + " the empty JSON string", + GetWorkspaceV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GetWorkspaceV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetWorkspaceV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetWorkspaceV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GetWorkspaceV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GetWorkspaceV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetWorkspaceV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `workspace` + WorkspaceV1.validateJsonElement(jsonObj.get("workspace")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetWorkspaceV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetWorkspaceV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GetWorkspaceV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GetWorkspaceV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GetWorkspaceV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetWorkspaceV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetWorkspaceV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetWorkspaceV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetWorkspaceV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetWorkspaceV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetWorkspaceV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetWorkspaceV1Output + * @throws IOException if the JSON string is invalid with respect to GetWorkspaceV1Output + */ + public static GetWorkspaceV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetWorkspaceV1Output.class); } - } - - /** - * Create an instance of GetWorkspaceV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetWorkspaceV1Output - * @throws IOException if the JSON string is invalid with respect to GetWorkspaceV1Output - */ - public static GetWorkspaceV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetWorkspaceV1Output.class); - } - - /** - * Convert an instance of GetWorkspaceV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of GetWorkspaceV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Group.java b/src/main/java/com/segment/publicapi/models/Group.java deleted file mode 100644 index dd48b5f9..00000000 --- a/src/main/java/com/segment/publicapi/models/Group.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * Group settings. - */ -@ApiModel(description = "Group settings.") - -public class Group { - public static final String SERIALIZED_NAME_ALLOW_UNPLANNED_TRAITS = "allowUnplannedTraits"; - @SerializedName(SERIALIZED_NAME_ALLOW_UNPLANNED_TRAITS) - private Boolean allowUnplannedTraits; - - public static final String SERIALIZED_NAME_ALLOW_TRAITS_ON_VIOLATIONS = "allowTraitsOnViolations"; - @SerializedName(SERIALIZED_NAME_ALLOW_TRAITS_ON_VIOLATIONS) - private Boolean allowTraitsOnViolations; - - /** - * The common group event on violations. Config API note: equal to `commonGroupEventOnViolations`. - */ - @JsonAdapter(CommonEventOnViolationsEnum.Adapter.class) - public enum CommonEventOnViolationsEnum { - ALLOW("ALLOW"), - - BLOCK("BLOCK"), - - OMIT_TRAITS("OMIT_TRAITS"); - - private String value; - - CommonEventOnViolationsEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static CommonEventOnViolationsEnum fromValue(String value) { - for (CommonEventOnViolationsEnum b : CommonEventOnViolationsEnum.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 CommonEventOnViolationsEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public CommonEventOnViolationsEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return CommonEventOnViolationsEnum.fromValue(value); - } - } - } - - public static final String SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS = "commonEventOnViolations"; - @SerializedName(SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS) - private CommonEventOnViolationsEnum commonEventOnViolations; - - public Group() { - } - - public Group allowUnplannedTraits(Boolean allowUnplannedTraits) { - - this.allowUnplannedTraits = allowUnplannedTraits; - return this; - } - - /** - * Enable to allow unplanned group traits. Config API note: equal to `allowUnplannedGroupTraits`. - * @return allowUnplannedTraits - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow unplanned group traits. Config API note: equal to `allowUnplannedGroupTraits`.") - - public Boolean getAllowUnplannedTraits() { - return allowUnplannedTraits; - } - - - public void setAllowUnplannedTraits(Boolean allowUnplannedTraits) { - this.allowUnplannedTraits = allowUnplannedTraits; - } - - - public Group allowTraitsOnViolations(Boolean allowTraitsOnViolations) { - - this.allowTraitsOnViolations = allowTraitsOnViolations; - return this; - } - - /** - * Enable to allow group traits on violations. Config API note: equal to `allowGroupTraitsOnViolations`. - * @return allowTraitsOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow group traits on violations. Config API note: equal to `allowGroupTraitsOnViolations`.") - - public Boolean getAllowTraitsOnViolations() { - return allowTraitsOnViolations; - } - - - public void setAllowTraitsOnViolations(Boolean allowTraitsOnViolations) { - this.allowTraitsOnViolations = allowTraitsOnViolations; - } - - - public Group commonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { - - this.commonEventOnViolations = commonEventOnViolations; - return this; - } - - /** - * The common group event on violations. Config API note: equal to `commonGroupEventOnViolations`. - * @return commonEventOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The common group event on violations. Config API note: equal to `commonGroupEventOnViolations`.") - - public CommonEventOnViolationsEnum getCommonEventOnViolations() { - return commonEventOnViolations; - } - - - public void setCommonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { - this.commonEventOnViolations = commonEventOnViolations; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Group group = (Group) o; - return Objects.equals(this.allowUnplannedTraits, group.allowUnplannedTraits) && - Objects.equals(this.allowTraitsOnViolations, group.allowTraitsOnViolations) && - Objects.equals(this.commonEventOnViolations, group.commonEventOnViolations); - } - - @Override - public int hashCode() { - return Objects.hash(allowUnplannedTraits, allowTraitsOnViolations, commonEventOnViolations); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Group {\n"); - sb.append(" allowUnplannedTraits: ").append(toIndentedString(allowUnplannedTraits)).append("\n"); - sb.append(" allowTraitsOnViolations: ").append(toIndentedString(allowTraitsOnViolations)).append("\n"); - sb.append(" commonEventOnViolations: ").append(toIndentedString(commonEventOnViolations)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("allowUnplannedTraits"); - openapiFields.add("allowTraitsOnViolations"); - openapiFields.add("commonEventOnViolations"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Group - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Group.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Group is not found in the empty JSON string", Group.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Group.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Group` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - if ((jsonObj.get("commonEventOnViolations") != null && !jsonObj.get("commonEventOnViolations").isJsonNull()) && !jsonObj.get("commonEventOnViolations").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `commonEventOnViolations` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commonEventOnViolations").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Group.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Group' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Group.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Group value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Group read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Group given an JSON string - * - * @param jsonString JSON string - * @return An instance of Group - * @throws IOException if the JSON string is invalid with respect to Group - */ - public static Group fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Group.class); - } - - /** - * Convert an instance of Group to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/GroupSourceSettingsV1.java b/src/main/java/com/segment/publicapi/models/GroupSourceSettingsV1.java index 41637191..fd8bbf47 100644 --- a/src/main/java/com/segment/publicapi/models/GroupSourceSettingsV1.java +++ b/src/main/java/com/segment/publicapi/models/GroupSourceSettingsV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,308 +9,315 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** GroupSourceSettingsV1 */ +public class GroupSourceSettingsV1 { + public static final String SERIALIZED_NAME_ALLOW_UNPLANNED_TRAITS = "allowUnplannedTraits"; -/** - * GroupSourceSettingsV1 - */ + @SerializedName(SERIALIZED_NAME_ALLOW_UNPLANNED_TRAITS) + private Boolean allowUnplannedTraits; -public class GroupSourceSettingsV1 { - public static final String SERIALIZED_NAME_ALLOW_UNPLANNED_TRAITS = "allowUnplannedTraits"; - @SerializedName(SERIALIZED_NAME_ALLOW_UNPLANNED_TRAITS) - private Boolean allowUnplannedTraits; - - public static final String SERIALIZED_NAME_ALLOW_TRAITS_ON_VIOLATIONS = "allowTraitsOnViolations"; - @SerializedName(SERIALIZED_NAME_ALLOW_TRAITS_ON_VIOLATIONS) - private Boolean allowTraitsOnViolations; - - /** - * The common group event on violations. Config API note: equal to `commonGroupEventOnViolations`. - */ - @JsonAdapter(CommonEventOnViolationsEnum.Adapter.class) - public enum CommonEventOnViolationsEnum { - ALLOW("ALLOW"), - - BLOCK("BLOCK"), - - OMIT_TRAITS("OMIT_TRAITS"); - - private String value; - - CommonEventOnViolationsEnum(String value) { - this.value = value; - } + public static final String SERIALIZED_NAME_ALLOW_TRAITS_ON_VIOLATIONS = + "allowTraitsOnViolations"; - public String getValue() { - return value; - } + @SerializedName(SERIALIZED_NAME_ALLOW_TRAITS_ON_VIOLATIONS) + private Boolean allowTraitsOnViolations; - @Override - public String toString() { - return String.valueOf(value); - } + /** + * The common group event on violations. Config API note: equal to + * `commonGroupEventOnViolations`. + */ + @JsonAdapter(CommonEventOnViolationsEnum.Adapter.class) + public enum CommonEventOnViolationsEnum { + ALLOW("ALLOW"), - public static CommonEventOnViolationsEnum fromValue(String value) { - for (CommonEventOnViolationsEnum b : CommonEventOnViolationsEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } + BLOCK("BLOCK"), - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final CommonEventOnViolationsEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public CommonEventOnViolationsEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return CommonEventOnViolationsEnum.fromValue(value); - } - } - } + OMIT_TRAITS("OMIT_TRAITS"); - public static final String SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS = "commonEventOnViolations"; - @SerializedName(SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS) - private CommonEventOnViolationsEnum commonEventOnViolations; + private String value; - public GroupSourceSettingsV1() { - } + CommonEventOnViolationsEnum(String value) { + this.value = value; + } - public GroupSourceSettingsV1 allowUnplannedTraits(Boolean allowUnplannedTraits) { - - this.allowUnplannedTraits = allowUnplannedTraits; - return this; - } + public String getValue() { + return value; + } - /** - * Enable to allow unplanned group traits. Config API note: equal to `allowUnplannedGroupTraits`. - * @return allowUnplannedTraits - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow unplanned group traits. Config API note: equal to `allowUnplannedGroupTraits`.") + @Override + public String toString() { + return String.valueOf(value); + } - public Boolean getAllowUnplannedTraits() { - return allowUnplannedTraits; - } + public static CommonEventOnViolationsEnum fromValue(String value) { + for (CommonEventOnViolationsEnum b : CommonEventOnViolationsEnum.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 CommonEventOnViolationsEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CommonEventOnViolationsEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return CommonEventOnViolationsEnum.fromValue(value); + } + } + } - public void setAllowUnplannedTraits(Boolean allowUnplannedTraits) { - this.allowUnplannedTraits = allowUnplannedTraits; - } + public static final String SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS = + "commonEventOnViolations"; + @SerializedName(SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS) + private CommonEventOnViolationsEnum commonEventOnViolations; - public GroupSourceSettingsV1 allowTraitsOnViolations(Boolean allowTraitsOnViolations) { - - this.allowTraitsOnViolations = allowTraitsOnViolations; - return this; - } + public GroupSourceSettingsV1() {} - /** - * Enable to allow group traits on violations. Config API note: equal to `allowGroupTraitsOnViolations`. - * @return allowTraitsOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow group traits on violations. Config API note: equal to `allowGroupTraitsOnViolations`.") + public GroupSourceSettingsV1 allowUnplannedTraits(Boolean allowUnplannedTraits) { - public Boolean getAllowTraitsOnViolations() { - return allowTraitsOnViolations; - } + this.allowUnplannedTraits = allowUnplannedTraits; + return this; + } + /** + * Enable to allow unplanned group traits. Config API note: equal to + * `allowUnplannedGroupTraits`. + * + * @return allowUnplannedTraits + */ + @javax.annotation.Nullable + public Boolean getAllowUnplannedTraits() { + return allowUnplannedTraits; + } - public void setAllowTraitsOnViolations(Boolean allowTraitsOnViolations) { - this.allowTraitsOnViolations = allowTraitsOnViolations; - } + public void setAllowUnplannedTraits(Boolean allowUnplannedTraits) { + this.allowUnplannedTraits = allowUnplannedTraits; + } + public GroupSourceSettingsV1 allowTraitsOnViolations(Boolean allowTraitsOnViolations) { - public GroupSourceSettingsV1 commonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { - - this.commonEventOnViolations = commonEventOnViolations; - return this; - } + this.allowTraitsOnViolations = allowTraitsOnViolations; + return this; + } - /** - * The common group event on violations. Config API note: equal to `commonGroupEventOnViolations`. - * @return commonEventOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The common group event on violations. Config API note: equal to `commonGroupEventOnViolations`.") + /** + * Enable to allow group traits on violations. Config API note: equal to + * `allowGroupTraitsOnViolations`. + * + * @return allowTraitsOnViolations + */ + @javax.annotation.Nullable + public Boolean getAllowTraitsOnViolations() { + return allowTraitsOnViolations; + } - public CommonEventOnViolationsEnum getCommonEventOnViolations() { - return commonEventOnViolations; - } + public void setAllowTraitsOnViolations(Boolean allowTraitsOnViolations) { + this.allowTraitsOnViolations = allowTraitsOnViolations; + } + public GroupSourceSettingsV1 commonEventOnViolations( + CommonEventOnViolationsEnum commonEventOnViolations) { - public void setCommonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { - this.commonEventOnViolations = commonEventOnViolations; - } + this.commonEventOnViolations = commonEventOnViolations; + return this; + } + /** + * The common group event on violations. Config API note: equal to + * `commonGroupEventOnViolations`. + * + * @return commonEventOnViolations + */ + @javax.annotation.Nullable + public CommonEventOnViolationsEnum getCommonEventOnViolations() { + return commonEventOnViolations; + } + public void setCommonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { + this.commonEventOnViolations = commonEventOnViolations; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GroupSourceSettingsV1 groupSourceSettingsV1 = (GroupSourceSettingsV1) o; + return Objects.equals(this.allowUnplannedTraits, groupSourceSettingsV1.allowUnplannedTraits) + && Objects.equals( + this.allowTraitsOnViolations, groupSourceSettingsV1.allowTraitsOnViolations) + && Objects.equals( + this.commonEventOnViolations, + groupSourceSettingsV1.commonEventOnViolations); + } + + @Override + public int hashCode() { + return Objects.hash(allowUnplannedTraits, allowTraitsOnViolations, commonEventOnViolations); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GroupSourceSettingsV1 {\n"); + sb.append(" allowUnplannedTraits: ") + .append(toIndentedString(allowUnplannedTraits)) + .append("\n"); + sb.append(" allowTraitsOnViolations: ") + .append(toIndentedString(allowTraitsOnViolations)) + .append("\n"); + sb.append(" commonEventOnViolations: ") + .append(toIndentedString(commonEventOnViolations)) + .append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - GroupSourceSettingsV1 groupSourceSettingsV1 = (GroupSourceSettingsV1) o; - return Objects.equals(this.allowUnplannedTraits, groupSourceSettingsV1.allowUnplannedTraits) && - Objects.equals(this.allowTraitsOnViolations, groupSourceSettingsV1.allowTraitsOnViolations) && - Objects.equals(this.commonEventOnViolations, groupSourceSettingsV1.commonEventOnViolations); - } - - @Override - public int hashCode() { - return Objects.hash(allowUnplannedTraits, allowTraitsOnViolations, commonEventOnViolations); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GroupSourceSettingsV1 {\n"); - sb.append(" allowUnplannedTraits: ").append(toIndentedString(allowUnplannedTraits)).append("\n"); - sb.append(" allowTraitsOnViolations: ").append(toIndentedString(allowTraitsOnViolations)).append("\n"); - sb.append(" commonEventOnViolations: ").append(toIndentedString(commonEventOnViolations)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("allowUnplannedTraits"); + openapiFields.add("allowTraitsOnViolations"); + openapiFields.add("commonEventOnViolations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("allowUnplannedTraits"); - openapiFields.add("allowTraitsOnViolations"); - openapiFields.add("commonEventOnViolations"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to GroupSourceSettingsV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!GroupSourceSettingsV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in GroupSourceSettingsV1 is not found in the empty JSON string", GroupSourceSettingsV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GroupSourceSettingsV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GroupSourceSettingsV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GroupSourceSettingsV1 is not found in" + + " the empty JSON string", + GroupSourceSettingsV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!GroupSourceSettingsV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GroupSourceSettingsV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GroupSourceSettingsV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GroupSourceSettingsV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("commonEventOnViolations") != null + && !jsonObj.get("commonEventOnViolations").isJsonNull()) + && !jsonObj.get("commonEventOnViolations").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `commonEventOnViolations` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("commonEventOnViolations").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GroupSourceSettingsV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GroupSourceSettingsV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GroupSourceSettingsV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GroupSourceSettingsV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GroupSourceSettingsV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - if ((jsonObj.get("commonEventOnViolations") != null && !jsonObj.get("commonEventOnViolations").isJsonNull()) && !jsonObj.get("commonEventOnViolations").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `commonEventOnViolations` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commonEventOnViolations").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GroupSourceSettingsV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GroupSourceSettingsV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GroupSourceSettingsV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GroupSourceSettingsV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public GroupSourceSettingsV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of GroupSourceSettingsV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of GroupSourceSettingsV1 - * @throws IOException if the JSON string is invalid with respect to GroupSourceSettingsV1 - */ - public static GroupSourceSettingsV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GroupSourceSettingsV1.class); - } - - /** - * Convert an instance of GroupSourceSettingsV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of GroupSourceSettingsV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of GroupSourceSettingsV1 + * @throws IOException if the JSON string is invalid with respect to GroupSourceSettingsV1 + */ + public static GroupSourceSettingsV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GroupSourceSettingsV1.class); + } + + /** + * Convert an instance of GroupSourceSettingsV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GroupSubscriptionStatus.java b/src/main/java/com/segment/publicapi/models/GroupSubscriptionStatus.java new file mode 100644 index 00000000..2daf7606 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GroupSubscriptionStatus.java @@ -0,0 +1,293 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GroupSubscriptionStatus */ +public class GroupSubscriptionStatus { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + /** The user subscribed, unsubscribed, or on initial status. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + DID_NOT_SUBSCRIBE("DID_NOT_SUBSCRIBE"), + + SUBSCRIBED("SUBSCRIBED"), + + UNSUBSCRIBED("UNSUBSCRIBED"); + + 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 GroupSubscriptionStatus() {} + + public GroupSubscriptionStatus name(String name) { + + this.name = name; + return this; + } + + /** + * Name of the group. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public GroupSubscriptionStatus status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The user subscribed, unsubscribed, or on initial 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; + } + GroupSubscriptionStatus groupSubscriptionStatus = (GroupSubscriptionStatus) o; + return Objects.equals(this.name, groupSubscriptionStatus.name) + && Objects.equals(this.status, groupSubscriptionStatus.status); + } + + @Override + public int hashCode() { + return Objects.hash(name, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GroupSubscriptionStatus {\n"); + sb.append(" name: ").append(toIndentedString(name)).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("name"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + 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 GroupSubscriptionStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GroupSubscriptionStatus.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GroupSubscriptionStatus is not found" + + " in the empty JSON string", + GroupSubscriptionStatus.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GroupSubscriptionStatus.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GroupSubscriptionStatus` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GroupSubscriptionStatus.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!GroupSubscriptionStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GroupSubscriptionStatus' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GroupSubscriptionStatus.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GroupSubscriptionStatus value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GroupSubscriptionStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GroupSubscriptionStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of GroupSubscriptionStatus + * @throws IOException if the JSON string is invalid with respect to GroupSubscriptionStatus + */ + public static GroupSubscriptionStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GroupSubscriptionStatus.class); + } + + /** + * Convert an instance of GroupSubscriptionStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/GroupSubscriptionStatusResponse.java b/src/main/java/com/segment/publicapi/models/GroupSubscriptionStatusResponse.java new file mode 100644 index 00000000..29e21aee --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/GroupSubscriptionStatusResponse.java @@ -0,0 +1,370 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** GroupSubscriptionStatusResponse */ +public class GroupSubscriptionStatusResponse { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + /** The user subscribed, unsubscribed, or on initial status. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + DID_NOT_SUBSCRIBE("DID_NOT_SUBSCRIBE"), + + SUBSCRIBED("SUBSCRIBED"), + + UNSUBSCRIBED("UNSUBSCRIBED"); + + 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_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private String updatedAt; + + public GroupSubscriptionStatusResponse() {} + + public GroupSubscriptionStatusResponse name(String name) { + + this.name = name; + return this; + } + + /** + * Name of the group. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public GroupSubscriptionStatusResponse status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The user subscribed, unsubscribed, or on initial status. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public GroupSubscriptionStatusResponse id(String id) { + + this.id = id; + return this; + } + + /** + * The group id. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public GroupSubscriptionStatusResponse updatedAt(String updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp of this subscription status's last change. + * + * @return updatedAt + */ + @javax.annotation.Nullable + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GroupSubscriptionStatusResponse groupSubscriptionStatusResponse = + (GroupSubscriptionStatusResponse) o; + return Objects.equals(this.name, groupSubscriptionStatusResponse.name) + && Objects.equals(this.status, groupSubscriptionStatusResponse.status) + && Objects.equals(this.id, groupSubscriptionStatusResponse.id) + && Objects.equals(this.updatedAt, groupSubscriptionStatusResponse.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(name, status, id, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GroupSubscriptionStatusResponse {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).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("name"); + openapiFields.add("status"); + openapiFields.add("id"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("status"); + 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 + * GroupSubscriptionStatusResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GroupSubscriptionStatusResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in GroupSubscriptionStatusResponse is not" + + " found in the empty JSON string", + GroupSubscriptionStatusResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GroupSubscriptionStatusResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `GroupSubscriptionStatusResponse` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GroupSubscriptionStatusResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("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("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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GroupSubscriptionStatusResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GroupSubscriptionStatusResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(GroupSubscriptionStatusResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GroupSubscriptionStatusResponse value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GroupSubscriptionStatusResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of GroupSubscriptionStatusResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GroupSubscriptionStatusResponse + * @throws IOException if the JSON string is invalid with respect to + * GroupSubscriptionStatusResponse + */ + public static GroupSubscriptionStatusResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GroupSubscriptionStatusResponse.class); + } + + /** + * Convert an instance of GroupSubscriptionStatusResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/HandleWebhookInput.java b/src/main/java/com/segment/publicapi/models/HandleWebhookInput.java new file mode 100644 index 00000000..3522ab1a --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/HandleWebhookInput.java @@ -0,0 +1,315 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Function webhook input. */ +public class HandleWebhookInput { + public static final String SERIALIZED_NAME_W = "w"; + + @SerializedName(SERIALIZED_NAME_W) + private String w; + + public static final String SERIALIZED_NAME_N = "n"; + + @SerializedName(SERIALIZED_NAME_N) + private String n; + + public static final String SERIALIZED_NAME_T = "t"; + + @SerializedName(SERIALIZED_NAME_T) + private String t; + + public static final String SERIALIZED_NAME_S = "s"; + + @SerializedName(SERIALIZED_NAME_S) + private String s; + + public HandleWebhookInput() {} + + public HandleWebhookInput w(String w) { + + this.w = w; + return this; + } + + /** + * The Workspace id. + * + * @return w + */ + @javax.annotation.Nonnull + public String getW() { + return w; + } + + public void setW(String w) { + this.w = w; + } + + public HandleWebhookInput n(String n) { + + this.n = n; + return this; + } + + /** + * The webhook nonce. + * + * @return n + */ + @javax.annotation.Nonnull + public String getN() { + return n; + } + + public void setN(String n) { + this.n = n; + } + + public HandleWebhookInput t(String t) { + + this.t = t; + return this; + } + + /** + * The webhook timestamp. + * + * @return t + */ + @javax.annotation.Nonnull + public String getT() { + return t; + } + + public void setT(String t) { + this.t = t; + } + + public HandleWebhookInput s(String s) { + + this.s = s; + return this; + } + + /** + * The webhook signature. + * + * @return s + */ + @javax.annotation.Nonnull + public String getS() { + return s; + } + + public void setS(String s) { + this.s = s; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HandleWebhookInput handleWebhookInput = (HandleWebhookInput) o; + return Objects.equals(this.w, handleWebhookInput.w) + && Objects.equals(this.n, handleWebhookInput.n) + && Objects.equals(this.t, handleWebhookInput.t) + && Objects.equals(this.s, handleWebhookInput.s); + } + + @Override + public int hashCode() { + return Objects.hash(w, n, t, s); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HandleWebhookInput {\n"); + sb.append(" w: ").append(toIndentedString(w)).append("\n"); + sb.append(" n: ").append(toIndentedString(n)).append("\n"); + sb.append(" t: ").append(toIndentedString(t)).append("\n"); + sb.append(" s: ").append(toIndentedString(s)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("w"); + openapiFields.add("n"); + openapiFields.add("t"); + openapiFields.add("s"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("w"); + openapiRequiredFields.add("n"); + openapiRequiredFields.add("t"); + openapiRequiredFields.add("s"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HandleWebhookInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HandleWebhookInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in HandleWebhookInput is not found in the" + + " empty JSON string", + HandleWebhookInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!HandleWebhookInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `HandleWebhookInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : HandleWebhookInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("w").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `w` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("w").toString())); + } + if (!jsonObj.get("n").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `n` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("n").toString())); + } + if (!jsonObj.get("t").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `t` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("t").toString())); + } + if (!jsonObj.get("s").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `s` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("s").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HandleWebhookInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HandleWebhookInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(HandleWebhookInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, HandleWebhookInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public HandleWebhookInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of HandleWebhookInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of HandleWebhookInput + * @throws IOException if the JSON string is invalid with respect to HandleWebhookInput + */ + public static HandleWebhookInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HandleWebhookInput.class); + } + + /** + * Convert an instance of HandleWebhookInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/HandleWebhookOutput.java b/src/main/java/com/segment/publicapi/models/HandleWebhookOutput.java new file mode 100644 index 00000000..60a79564 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/HandleWebhookOutput.java @@ -0,0 +1,230 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Function webhook output status. */ +public class HandleWebhookOutput { + public static final String SERIALIZED_NAME_STATUS_CODE = "statusCode"; + + @SerializedName(SERIALIZED_NAME_STATUS_CODE) + private BigDecimal statusCode; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + + @SerializedName(SERIALIZED_NAME_SUCCESS) + private Boolean success; + + public HandleWebhookOutput() {} + + public HandleWebhookOutput statusCode(BigDecimal statusCode) { + + this.statusCode = statusCode; + return this; + } + + /** + * The http status code. + * + * @return statusCode + */ + @javax.annotation.Nonnull + public BigDecimal getStatusCode() { + return statusCode; + } + + public void setStatusCode(BigDecimal statusCode) { + this.statusCode = statusCode; + } + + public HandleWebhookOutput success(Boolean success) { + + this.success = success; + return this; + } + + /** + * The status of the operation. + * + * @return success + */ + @javax.annotation.Nonnull + public Boolean getSuccess() { + return success; + } + + public void setSuccess(Boolean success) { + this.success = success; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HandleWebhookOutput handleWebhookOutput = (HandleWebhookOutput) o; + return Objects.equals(this.statusCode, handleWebhookOutput.statusCode) + && Objects.equals(this.success, handleWebhookOutput.success); + } + + @Override + public int hashCode() { + return Objects.hash(statusCode, success); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HandleWebhookOutput {\n"); + sb.append(" statusCode: ").append(toIndentedString(statusCode)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("statusCode"); + openapiFields.add("success"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("statusCode"); + openapiRequiredFields.add("success"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HandleWebhookOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HandleWebhookOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in HandleWebhookOutput is not found in" + + " the empty JSON string", + HandleWebhookOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!HandleWebhookOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `HandleWebhookOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : HandleWebhookOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!HandleWebhookOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HandleWebhookOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(HandleWebhookOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, HandleWebhookOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public HandleWebhookOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of HandleWebhookOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of HandleWebhookOutput + * @throws IOException if the JSON string is invalid with respect to HandleWebhookOutput + */ + public static HandleWebhookOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HandleWebhookOutput.class); + } + + /** + * Convert an instance of HandleWebhookOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/HashPropertiesConfiguration.java b/src/main/java/com/segment/publicapi/models/HashPropertiesConfiguration.java new file mode 100644 index 00000000..8f8cfaee --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/HashPropertiesConfiguration.java @@ -0,0 +1,383 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** HashPropertiesConfiguration */ +public class HashPropertiesConfiguration { + public static final String SERIALIZED_NAME_ALGORITHM = "algorithm"; + + @SerializedName(SERIALIZED_NAME_ALGORITHM) + private String algorithm; + + public static final String SERIALIZED_NAME_KEY = "key"; + + @SerializedName(SERIALIZED_NAME_KEY) + private String key; + + /** Optional encoding to use for the hashing. */ + @JsonAdapter(EncodingEnum.Adapter.class) + public enum EncodingEnum { + BASE16("BASE16"), + + BASE64("BASE64"), + + BASE64URL("BASE64URL"), + + HEX("HEX"); + + private String value; + + EncodingEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EncodingEnum fromValue(String value) { + for (EncodingEnum b : EncodingEnum.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 EncodingEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EncodingEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EncodingEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ENCODING = "encoding"; + + @SerializedName(SERIALIZED_NAME_ENCODING) + private EncodingEnum encoding; + + public static final String SERIALIZED_NAME_PATHS = "paths"; + + @SerializedName(SERIALIZED_NAME_PATHS) + private List paths = new ArrayList<>(); + + public HashPropertiesConfiguration() {} + + public HashPropertiesConfiguration algorithm(String algorithm) { + + this.algorithm = algorithm; + return this; + } + + /** + * Which algorithm to use to hash to properties. + * + * @return algorithm + */ + @javax.annotation.Nonnull + public String getAlgorithm() { + return algorithm; + } + + public void setAlgorithm(String algorithm) { + this.algorithm = algorithm; + } + + public HashPropertiesConfiguration key(String key) { + + this.key = key; + return this; + } + + /** + * Optional key to hash with. + * + * @return key + */ + @javax.annotation.Nullable + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public HashPropertiesConfiguration encoding(EncodingEnum encoding) { + + this.encoding = encoding; + return this; + } + + /** + * Optional encoding to use for the hashing. + * + * @return encoding + */ + @javax.annotation.Nullable + public EncodingEnum getEncoding() { + return encoding; + } + + public void setEncoding(EncodingEnum encoding) { + this.encoding = encoding; + } + + public HashPropertiesConfiguration paths(List paths) { + + this.paths = paths; + return this; + } + + public HashPropertiesConfiguration addPathsItem(String pathsItem) { + if (this.paths == null) { + this.paths = new ArrayList<>(); + } + this.paths.add(pathsItem); + return this; + } + + /** + * The paths to the properties to be hashed. + * + * @return paths + */ + @javax.annotation.Nonnull + public List getPaths() { + return paths; + } + + public void setPaths(List paths) { + this.paths = paths; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HashPropertiesConfiguration hashPropertiesConfiguration = (HashPropertiesConfiguration) o; + return Objects.equals(this.algorithm, hashPropertiesConfiguration.algorithm) + && Objects.equals(this.key, hashPropertiesConfiguration.key) + && Objects.equals(this.encoding, hashPropertiesConfiguration.encoding) + && Objects.equals(this.paths, hashPropertiesConfiguration.paths); + } + + @Override + public int hashCode() { + return Objects.hash(algorithm, key, encoding, paths); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HashPropertiesConfiguration {\n"); + sb.append(" algorithm: ").append(toIndentedString(algorithm)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" encoding: ").append(toIndentedString(encoding)).append("\n"); + sb.append(" paths: ").append(toIndentedString(paths)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("algorithm"); + openapiFields.add("key"); + openapiFields.add("encoding"); + openapiFields.add("paths"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("algorithm"); + openapiRequiredFields.add("paths"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * HashPropertiesConfiguration + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HashPropertiesConfiguration.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in HashPropertiesConfiguration is not" + + " found in the empty JSON string", + HashPropertiesConfiguration.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!HashPropertiesConfiguration.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `HashPropertiesConfiguration` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : HashPropertiesConfiguration.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("algorithm").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `algorithm` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("algorithm").toString())); + } + if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) + && !jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `key` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("key").toString())); + } + if ((jsonObj.get("encoding") != null && !jsonObj.get("encoding").isJsonNull()) + && !jsonObj.get("encoding").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `encoding` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("encoding").toString())); + } + // ensure the required json array is present + if (jsonObj.get("paths") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("paths").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `paths` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("paths").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HashPropertiesConfiguration.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HashPropertiesConfiguration' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(HashPropertiesConfiguration.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, HashPropertiesConfiguration value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public HashPropertiesConfiguration read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of HashPropertiesConfiguration given an JSON string + * + * @param jsonString JSON string + * @return An instance of HashPropertiesConfiguration + * @throws IOException if the JSON string is invalid with respect to HashPropertiesConfiguration + */ + public static HashPropertiesConfiguration fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HashPropertiesConfiguration.class); + } + + /** + * Convert an instance of HashPropertiesConfiguration to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Identify.java b/src/main/java/com/segment/publicapi/models/Identify.java deleted file mode 100644 index 99e29546..00000000 --- a/src/main/java/com/segment/publicapi/models/Identify.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * Identify settings. - */ -@ApiModel(description = "Identify settings.") - -public class Identify { - public static final String SERIALIZED_NAME_ALLOW_UNPLANNED_TRAITS = "allowUnplannedTraits"; - @SerializedName(SERIALIZED_NAME_ALLOW_UNPLANNED_TRAITS) - private Boolean allowUnplannedTraits; - - public static final String SERIALIZED_NAME_ALLOW_TRAITS_ON_VIOLATIONS = "allowTraitsOnViolations"; - @SerializedName(SERIALIZED_NAME_ALLOW_TRAITS_ON_VIOLATIONS) - private Boolean allowTraitsOnViolations; - - /** - * The common identify event on violations. Config API note: equal to `commonIdentifyEventOnViolations`. - */ - @JsonAdapter(CommonEventOnViolationsEnum.Adapter.class) - public enum CommonEventOnViolationsEnum { - ALLOW("ALLOW"), - - BLOCK("BLOCK"), - - OMIT_TRAITS("OMIT_TRAITS"); - - private String value; - - CommonEventOnViolationsEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static CommonEventOnViolationsEnum fromValue(String value) { - for (CommonEventOnViolationsEnum b : CommonEventOnViolationsEnum.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 CommonEventOnViolationsEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public CommonEventOnViolationsEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return CommonEventOnViolationsEnum.fromValue(value); - } - } - } - - public static final String SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS = "commonEventOnViolations"; - @SerializedName(SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS) - private CommonEventOnViolationsEnum commonEventOnViolations; - - public Identify() { - } - - public Identify allowUnplannedTraits(Boolean allowUnplannedTraits) { - - this.allowUnplannedTraits = allowUnplannedTraits; - return this; - } - - /** - * Enable to allow unplanned identify traits. Config API note: equal to `allowUnplannedIdentifyTraits`. - * @return allowUnplannedTraits - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow unplanned identify traits. Config API note: equal to `allowUnplannedIdentifyTraits`.") - - public Boolean getAllowUnplannedTraits() { - return allowUnplannedTraits; - } - - - public void setAllowUnplannedTraits(Boolean allowUnplannedTraits) { - this.allowUnplannedTraits = allowUnplannedTraits; - } - - - public Identify allowTraitsOnViolations(Boolean allowTraitsOnViolations) { - - this.allowTraitsOnViolations = allowTraitsOnViolations; - return this; - } - - /** - * Enable to allow identify traits on violations. Config API note: equal to `allowIdentifyTraitsOnViolations`. - * @return allowTraitsOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow identify traits on violations. Config API note: equal to `allowIdentifyTraitsOnViolations`.") - - public Boolean getAllowTraitsOnViolations() { - return allowTraitsOnViolations; - } - - - public void setAllowTraitsOnViolations(Boolean allowTraitsOnViolations) { - this.allowTraitsOnViolations = allowTraitsOnViolations; - } - - - public Identify commonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { - - this.commonEventOnViolations = commonEventOnViolations; - return this; - } - - /** - * The common identify event on violations. Config API note: equal to `commonIdentifyEventOnViolations`. - * @return commonEventOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The common identify event on violations. Config API note: equal to `commonIdentifyEventOnViolations`.") - - public CommonEventOnViolationsEnum getCommonEventOnViolations() { - return commonEventOnViolations; - } - - - public void setCommonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { - this.commonEventOnViolations = commonEventOnViolations; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Identify identify = (Identify) o; - return Objects.equals(this.allowUnplannedTraits, identify.allowUnplannedTraits) && - Objects.equals(this.allowTraitsOnViolations, identify.allowTraitsOnViolations) && - Objects.equals(this.commonEventOnViolations, identify.commonEventOnViolations); - } - - @Override - public int hashCode() { - return Objects.hash(allowUnplannedTraits, allowTraitsOnViolations, commonEventOnViolations); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Identify {\n"); - sb.append(" allowUnplannedTraits: ").append(toIndentedString(allowUnplannedTraits)).append("\n"); - sb.append(" allowTraitsOnViolations: ").append(toIndentedString(allowTraitsOnViolations)).append("\n"); - sb.append(" commonEventOnViolations: ").append(toIndentedString(commonEventOnViolations)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("allowUnplannedTraits"); - openapiFields.add("allowTraitsOnViolations"); - openapiFields.add("commonEventOnViolations"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Identify - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Identify.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Identify is not found in the empty JSON string", Identify.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Identify.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Identify` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - if ((jsonObj.get("commonEventOnViolations") != null && !jsonObj.get("commonEventOnViolations").isJsonNull()) && !jsonObj.get("commonEventOnViolations").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `commonEventOnViolations` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commonEventOnViolations").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Identify.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Identify' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Identify.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Identify value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Identify read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Identify given an JSON string - * - * @param jsonString JSON string - * @return An instance of Identify - * @throws IOException if the JSON string is invalid with respect to Identify - */ - public static Identify fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Identify.class); - } - - /** - * Convert an instance of Identify to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/IdentifySourceSettingsV1.java b/src/main/java/com/segment/publicapi/models/IdentifySourceSettingsV1.java index f1db10da..fee26d09 100644 --- a/src/main/java/com/segment/publicapi/models/IdentifySourceSettingsV1.java +++ b/src/main/java/com/segment/publicapi/models/IdentifySourceSettingsV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,308 +9,318 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** IdentifySourceSettingsV1 */ +public class IdentifySourceSettingsV1 { + public static final String SERIALIZED_NAME_ALLOW_UNPLANNED_TRAITS = "allowUnplannedTraits"; -/** - * IdentifySourceSettingsV1 - */ + @SerializedName(SERIALIZED_NAME_ALLOW_UNPLANNED_TRAITS) + private Boolean allowUnplannedTraits; -public class IdentifySourceSettingsV1 { - public static final String SERIALIZED_NAME_ALLOW_UNPLANNED_TRAITS = "allowUnplannedTraits"; - @SerializedName(SERIALIZED_NAME_ALLOW_UNPLANNED_TRAITS) - private Boolean allowUnplannedTraits; - - public static final String SERIALIZED_NAME_ALLOW_TRAITS_ON_VIOLATIONS = "allowTraitsOnViolations"; - @SerializedName(SERIALIZED_NAME_ALLOW_TRAITS_ON_VIOLATIONS) - private Boolean allowTraitsOnViolations; - - /** - * The common identify event on violations. Config API note: equal to `commonIdentifyEventOnViolations`. - */ - @JsonAdapter(CommonEventOnViolationsEnum.Adapter.class) - public enum CommonEventOnViolationsEnum { - ALLOW("ALLOW"), - - BLOCK("BLOCK"), - - OMIT_TRAITS("OMIT_TRAITS"); - - private String value; - - CommonEventOnViolationsEnum(String value) { - this.value = value; - } + public static final String SERIALIZED_NAME_ALLOW_TRAITS_ON_VIOLATIONS = + "allowTraitsOnViolations"; - public String getValue() { - return value; - } + @SerializedName(SERIALIZED_NAME_ALLOW_TRAITS_ON_VIOLATIONS) + private Boolean allowTraitsOnViolations; - @Override - public String toString() { - return String.valueOf(value); - } + /** + * The common identify event on violations. Config API note: equal to + * `commonIdentifyEventOnViolations`. + */ + @JsonAdapter(CommonEventOnViolationsEnum.Adapter.class) + public enum CommonEventOnViolationsEnum { + ALLOW("ALLOW"), - public static CommonEventOnViolationsEnum fromValue(String value) { - for (CommonEventOnViolationsEnum b : CommonEventOnViolationsEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } + BLOCK("BLOCK"), - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final CommonEventOnViolationsEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public CommonEventOnViolationsEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return CommonEventOnViolationsEnum.fromValue(value); - } - } - } + OMIT_TRAITS("OMIT_TRAITS"); - public static final String SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS = "commonEventOnViolations"; - @SerializedName(SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS) - private CommonEventOnViolationsEnum commonEventOnViolations; + private String value; - public IdentifySourceSettingsV1() { - } + CommonEventOnViolationsEnum(String value) { + this.value = value; + } - public IdentifySourceSettingsV1 allowUnplannedTraits(Boolean allowUnplannedTraits) { - - this.allowUnplannedTraits = allowUnplannedTraits; - return this; - } + public String getValue() { + return value; + } - /** - * Enable to allow unplanned identify traits. Config API note: equal to `allowUnplannedIdentifyTraits`. - * @return allowUnplannedTraits - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow unplanned identify traits. Config API note: equal to `allowUnplannedIdentifyTraits`.") + @Override + public String toString() { + return String.valueOf(value); + } - public Boolean getAllowUnplannedTraits() { - return allowUnplannedTraits; - } + public static CommonEventOnViolationsEnum fromValue(String value) { + for (CommonEventOnViolationsEnum b : CommonEventOnViolationsEnum.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 CommonEventOnViolationsEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CommonEventOnViolationsEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return CommonEventOnViolationsEnum.fromValue(value); + } + } + } - public void setAllowUnplannedTraits(Boolean allowUnplannedTraits) { - this.allowUnplannedTraits = allowUnplannedTraits; - } + public static final String SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS = + "commonEventOnViolations"; + @SerializedName(SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS) + private CommonEventOnViolationsEnum commonEventOnViolations; - public IdentifySourceSettingsV1 allowTraitsOnViolations(Boolean allowTraitsOnViolations) { - - this.allowTraitsOnViolations = allowTraitsOnViolations; - return this; - } + public IdentifySourceSettingsV1() {} - /** - * Enable to allow identify traits on violations. Config API note: equal to `allowIdentifyTraitsOnViolations`. - * @return allowTraitsOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow identify traits on violations. Config API note: equal to `allowIdentifyTraitsOnViolations`.") + public IdentifySourceSettingsV1 allowUnplannedTraits(Boolean allowUnplannedTraits) { - public Boolean getAllowTraitsOnViolations() { - return allowTraitsOnViolations; - } + this.allowUnplannedTraits = allowUnplannedTraits; + return this; + } + /** + * Enable to allow unplanned identify traits. Config API note: equal to + * `allowUnplannedIdentifyTraits`. + * + * @return allowUnplannedTraits + */ + @javax.annotation.Nullable + public Boolean getAllowUnplannedTraits() { + return allowUnplannedTraits; + } - public void setAllowTraitsOnViolations(Boolean allowTraitsOnViolations) { - this.allowTraitsOnViolations = allowTraitsOnViolations; - } + public void setAllowUnplannedTraits(Boolean allowUnplannedTraits) { + this.allowUnplannedTraits = allowUnplannedTraits; + } + public IdentifySourceSettingsV1 allowTraitsOnViolations(Boolean allowTraitsOnViolations) { - public IdentifySourceSettingsV1 commonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { - - this.commonEventOnViolations = commonEventOnViolations; - return this; - } + this.allowTraitsOnViolations = allowTraitsOnViolations; + return this; + } - /** - * The common identify event on violations. Config API note: equal to `commonIdentifyEventOnViolations`. - * @return commonEventOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The common identify event on violations. Config API note: equal to `commonIdentifyEventOnViolations`.") + /** + * Enable to allow identify traits on violations. Config API note: equal to + * `allowIdentifyTraitsOnViolations`. + * + * @return allowTraitsOnViolations + */ + @javax.annotation.Nullable + public Boolean getAllowTraitsOnViolations() { + return allowTraitsOnViolations; + } - public CommonEventOnViolationsEnum getCommonEventOnViolations() { - return commonEventOnViolations; - } + public void setAllowTraitsOnViolations(Boolean allowTraitsOnViolations) { + this.allowTraitsOnViolations = allowTraitsOnViolations; + } + public IdentifySourceSettingsV1 commonEventOnViolations( + CommonEventOnViolationsEnum commonEventOnViolations) { - public void setCommonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { - this.commonEventOnViolations = commonEventOnViolations; - } + this.commonEventOnViolations = commonEventOnViolations; + return this; + } + /** + * The common identify event on violations. Config API note: equal to + * `commonIdentifyEventOnViolations`. + * + * @return commonEventOnViolations + */ + @javax.annotation.Nullable + public CommonEventOnViolationsEnum getCommonEventOnViolations() { + return commonEventOnViolations; + } + public void setCommonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { + this.commonEventOnViolations = commonEventOnViolations; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IdentifySourceSettingsV1 identifySourceSettingsV1 = (IdentifySourceSettingsV1) o; + return Objects.equals( + this.allowUnplannedTraits, identifySourceSettingsV1.allowUnplannedTraits) + && Objects.equals( + this.allowTraitsOnViolations, + identifySourceSettingsV1.allowTraitsOnViolations) + && Objects.equals( + this.commonEventOnViolations, + identifySourceSettingsV1.commonEventOnViolations); + } + + @Override + public int hashCode() { + return Objects.hash(allowUnplannedTraits, allowTraitsOnViolations, commonEventOnViolations); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IdentifySourceSettingsV1 {\n"); + sb.append(" allowUnplannedTraits: ") + .append(toIndentedString(allowUnplannedTraits)) + .append("\n"); + sb.append(" allowTraitsOnViolations: ") + .append(toIndentedString(allowTraitsOnViolations)) + .append("\n"); + sb.append(" commonEventOnViolations: ") + .append(toIndentedString(commonEventOnViolations)) + .append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - IdentifySourceSettingsV1 identifySourceSettingsV1 = (IdentifySourceSettingsV1) o; - return Objects.equals(this.allowUnplannedTraits, identifySourceSettingsV1.allowUnplannedTraits) && - Objects.equals(this.allowTraitsOnViolations, identifySourceSettingsV1.allowTraitsOnViolations) && - Objects.equals(this.commonEventOnViolations, identifySourceSettingsV1.commonEventOnViolations); - } - - @Override - public int hashCode() { - return Objects.hash(allowUnplannedTraits, allowTraitsOnViolations, commonEventOnViolations); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class IdentifySourceSettingsV1 {\n"); - sb.append(" allowUnplannedTraits: ").append(toIndentedString(allowUnplannedTraits)).append("\n"); - sb.append(" allowTraitsOnViolations: ").append(toIndentedString(allowTraitsOnViolations)).append("\n"); - sb.append(" commonEventOnViolations: ").append(toIndentedString(commonEventOnViolations)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("allowUnplannedTraits"); + openapiFields.add("allowTraitsOnViolations"); + openapiFields.add("commonEventOnViolations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("allowUnplannedTraits"); - openapiFields.add("allowTraitsOnViolations"); - openapiFields.add("commonEventOnViolations"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to IdentifySourceSettingsV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!IdentifySourceSettingsV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in IdentifySourceSettingsV1 is not found in the empty JSON string", IdentifySourceSettingsV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IdentifySourceSettingsV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IdentifySourceSettingsV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in IdentifySourceSettingsV1 is not found" + + " in the empty JSON string", + IdentifySourceSettingsV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!IdentifySourceSettingsV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IdentifySourceSettingsV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IdentifySourceSettingsV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `IdentifySourceSettingsV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("commonEventOnViolations") != null + && !jsonObj.get("commonEventOnViolations").isJsonNull()) + && !jsonObj.get("commonEventOnViolations").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `commonEventOnViolations` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("commonEventOnViolations").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IdentifySourceSettingsV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IdentifySourceSettingsV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(IdentifySourceSettingsV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, IdentifySourceSettingsV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IdentifySourceSettingsV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - if ((jsonObj.get("commonEventOnViolations") != null && !jsonObj.get("commonEventOnViolations").isJsonNull()) && !jsonObj.get("commonEventOnViolations").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `commonEventOnViolations` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commonEventOnViolations").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!IdentifySourceSettingsV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'IdentifySourceSettingsV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(IdentifySourceSettingsV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, IdentifySourceSettingsV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public IdentifySourceSettingsV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of IdentifySourceSettingsV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of IdentifySourceSettingsV1 - * @throws IOException if the JSON string is invalid with respect to IdentifySourceSettingsV1 - */ - public static IdentifySourceSettingsV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, IdentifySourceSettingsV1.class); - } - - /** - * Convert an instance of IdentifySourceSettingsV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of IdentifySourceSettingsV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of IdentifySourceSettingsV1 + * @throws IOException if the JSON string is invalid with respect to IdentifySourceSettingsV1 + */ + public static IdentifySourceSettingsV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IdentifySourceSettingsV1.class); + } + + /** + * Convert an instance of IdentifySourceSettingsV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Input.java b/src/main/java/com/segment/publicapi/models/Input.java deleted file mode 100644 index 2d4678a6..00000000 --- a/src/main/java/com/segment/publicapi/models/Input.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * A set of valid Destination input params required for updating. - */ -@ApiModel(description = "A set of valid Destination input params required for updating.") - -public class Input { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_TRIGGER = "trigger"; - @SerializedName(SERIALIZED_NAME_TRIGGER) - private String trigger; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; - - public Input() { - } - - public Input name(String name) { - - this.name = name; - return this; - } - - /** - * The user-defined name for the subscription. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The user-defined name for the subscription.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Input trigger(String trigger) { - - this.trigger = trigger; - return this; - } - - /** - * The fql statement. - * @return trigger - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The fql statement.") - - public String getTrigger() { - return trigger; - } - - - public void setTrigger(String trigger) { - this.trigger = trigger; - } - - - public Input enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Is the subscription enabled. - * @return enabled - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Is the subscription enabled.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Input settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The fields used for configuring this action. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The fields used for configuring this action.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Input input = (Input) o; - return Objects.equals(this.name, input.name) && - Objects.equals(this.trigger, input.trigger) && - Objects.equals(this.enabled, input.enabled) && - Objects.equals(this.settings, input.settings); - } - - @Override - public int hashCode() { - return Objects.hash(name, trigger, enabled, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Input {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("trigger"); - openapiFields.add("enabled"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Input is not found in the empty JSON string", Input.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Input` properties. JSON: %s", entry.getKey(), jsonObj.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("trigger") != null && !jsonObj.get("trigger").isJsonNull()) && !jsonObj.get("trigger").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `trigger` to be a primitive type in the JSON string but got `%s`", jsonObj.get("trigger").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of Input - * @throws IOException if the JSON string is invalid with respect to Input - */ - public static Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Input.class); - } - - /** - * Convert an instance of Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/InsertFunctionInstanceAlpha.java b/src/main/java/com/segment/publicapi/models/InsertFunctionInstanceAlpha.java new file mode 100644 index 00000000..ab7f23eb --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/InsertFunctionInstanceAlpha.java @@ -0,0 +1,506 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** InsertFunctionInstanceAlpha */ +public class InsertFunctionInstanceAlpha { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_INTEGRATION_ID = "integrationId"; + + @SerializedName(SERIALIZED_NAME_INTEGRATION_ID) + private String integrationId; + + public static final String SERIALIZED_NAME_CLASS_ID = "classId"; + + @SerializedName(SERIALIZED_NAME_CLASS_ID) + private String classId; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private String updatedAt; + + public static final String SERIALIZED_NAME_SETTINGS = "settings"; + + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings = new HashMap<>(); + + public static final String SERIALIZED_NAME_ENCRYPTED_SETTINGS = "encryptedSettings"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTED_SETTINGS) + private Map encryptedSettings = new HashMap<>(); + + public InsertFunctionInstanceAlpha() {} + + public InsertFunctionInstanceAlpha 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 InsertFunctionInstanceAlpha 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 InsertFunctionInstanceAlpha integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * Get integrationId + * + * @return integrationId + */ + @javax.annotation.Nonnull + public String getIntegrationId() { + return integrationId; + } + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + public InsertFunctionInstanceAlpha classId(String classId) { + + this.classId = classId; + return this; + } + + /** + * Get classId + * + * @return classId + */ + @javax.annotation.Nonnull + public String getClassId() { + return classId; + } + + public void setClassId(String classId) { + this.classId = classId; + } + + public InsertFunctionInstanceAlpha enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Get enabled + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public InsertFunctionInstanceAlpha createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public InsertFunctionInstanceAlpha updatedAt(String updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * + * @return updatedAt + */ + @javax.annotation.Nonnull + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + + public InsertFunctionInstanceAlpha settings(Map settings) { + + this.settings = settings; + return this; + } + + public InsertFunctionInstanceAlpha putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + + /** + * Get settings + * + * @return settings + */ + @javax.annotation.Nonnull + public Map getSettings() { + return settings; + } + + public void setSettings(Map settings) { + this.settings = settings; + } + + public InsertFunctionInstanceAlpha encryptedSettings(Map encryptedSettings) { + + this.encryptedSettings = encryptedSettings; + return this; + } + + public InsertFunctionInstanceAlpha putEncryptedSettingsItem( + String key, Object encryptedSettingsItem) { + if (this.encryptedSettings == null) { + this.encryptedSettings = new HashMap<>(); + } + this.encryptedSettings.put(key, encryptedSettingsItem); + return this; + } + + /** + * Get encryptedSettings + * + * @return encryptedSettings + */ + @javax.annotation.Nonnull + public Map getEncryptedSettings() { + return encryptedSettings; + } + + public void setEncryptedSettings(Map encryptedSettings) { + this.encryptedSettings = encryptedSettings; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InsertFunctionInstanceAlpha insertFunctionInstanceAlpha = (InsertFunctionInstanceAlpha) o; + return Objects.equals(this.id, insertFunctionInstanceAlpha.id) + && Objects.equals(this.name, insertFunctionInstanceAlpha.name) + && Objects.equals(this.integrationId, insertFunctionInstanceAlpha.integrationId) + && Objects.equals(this.classId, insertFunctionInstanceAlpha.classId) + && Objects.equals(this.enabled, insertFunctionInstanceAlpha.enabled) + && Objects.equals(this.createdAt, insertFunctionInstanceAlpha.createdAt) + && Objects.equals(this.updatedAt, insertFunctionInstanceAlpha.updatedAt) + && Objects.equals(this.settings, insertFunctionInstanceAlpha.settings) + && Objects.equals( + this.encryptedSettings, insertFunctionInstanceAlpha.encryptedSettings); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + name, + integrationId, + classId, + enabled, + createdAt, + updatedAt, + settings, + encryptedSettings); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InsertFunctionInstanceAlpha {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" classId: ").append(toIndentedString(classId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" encryptedSettings: ") + .append(toIndentedString(encryptedSettings)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("name"); + openapiFields.add("integrationId"); + openapiFields.add("classId"); + openapiFields.add("enabled"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("settings"); + openapiFields.add("encryptedSettings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("integrationId"); + openapiRequiredFields.add("classId"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + openapiRequiredFields.add("settings"); + openapiRequiredFields.add("encryptedSettings"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * InsertFunctionInstanceAlpha + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InsertFunctionInstanceAlpha.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in InsertFunctionInstanceAlpha is not" + + " found in the empty JSON string", + InsertFunctionInstanceAlpha.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!InsertFunctionInstanceAlpha.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `InsertFunctionInstanceAlpha` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InsertFunctionInstanceAlpha.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("integrationId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `integrationId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("integrationId").toString())); + } + if (!jsonObj.get("classId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `classId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("classId").toString())); + } + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdAt").toString())); + } + if (!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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InsertFunctionInstanceAlpha.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InsertFunctionInstanceAlpha' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(InsertFunctionInstanceAlpha.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, InsertFunctionInstanceAlpha value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InsertFunctionInstanceAlpha read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of InsertFunctionInstanceAlpha given an JSON string + * + * @param jsonString JSON string + * @return An instance of InsertFunctionInstanceAlpha + * @throws IOException if the JSON string is invalid with respect to InsertFunctionInstanceAlpha + */ + public static InsertFunctionInstanceAlpha fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InsertFunctionInstanceAlpha.class); + } + + /** + * Convert an instance of InsertFunctionInstanceAlpha to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/IntegrationOptionBeta.java b/src/main/java/com/segment/publicapi/models/IntegrationOptionBeta.java index 48500e04..b5b3cc12 100644 --- a/src/main/java/com/segment/publicapi/models/IntegrationOptionBeta.java +++ b/src/main/java/com/segment/publicapi/models/IntegrationOptionBeta.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,381 +9,387 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.Arrays; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; - -import com.segment.publicapi.JSON; +import org.openapitools.jackson.nullable.JsonNullable; /** - * Describes an Integration option field required to set up a Segment Integration such as Sources, Destinations, or warehouses. + * Describes an Integration option field required to set up a Segment Integration such as Sources, + * Destinations, or warehouses. */ -@ApiModel(description = "Describes an Integration option field required to set up a Segment Integration such as Sources, Destinations, or warehouses.") - public class IntegrationOptionBeta { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - private String type; - - public static final String SERIALIZED_NAME_REQUIRED = "required"; - @SerializedName(SERIALIZED_NAME_REQUIRED) - private Boolean required; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; - @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) - private Object defaultValue = null; + public static final String SERIALIZED_NAME_TYPE = "type"; - public static final String SERIALIZED_NAME_LABEL = "label"; - @SerializedName(SERIALIZED_NAME_LABEL) - private String label; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; - public IntegrationOptionBeta() { - } + public static final String SERIALIZED_NAME_REQUIRED = "required"; - public IntegrationOptionBeta name(String name) { - - this.name = name; - return this; - } + @SerializedName(SERIALIZED_NAME_REQUIRED) + private Boolean required; - /** - * The name identifying this option in the context of a Segment Integration. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name identifying this option in the context of a Segment Integration.") + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - public String getName() { - return name; - } + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; - public void setName(String name) { - this.name = name; - } + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private Object defaultValue = null; + public static final String SERIALIZED_NAME_LABEL = "label"; - public IntegrationOptionBeta type(String type) { - - this.type = type; - return this; - } + @SerializedName(SERIALIZED_NAME_LABEL) + private String label; - /** - * Defines the type for this option in the schema. Types are most commonly strings, but may also represent other primitive types, such as booleans, and numbers, as well as complex types, such as objects and arrays. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Defines the type for this option in the schema. Types are most commonly strings, but may also represent other primitive types, such as booleans, and numbers, as well as complex types, such as objects and arrays.") + public IntegrationOptionBeta() {} - public String getType() { - return type; - } - - - public void setType(String type) { - this.type = type; - } + public IntegrationOptionBeta name(String name) { + this.name = name; + return this; + } - public IntegrationOptionBeta required(Boolean required) { - - this.required = required; - return this; - } + /** + * The name identifying this option in the context of a Segment Integration. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - /** - * Whether this is a required option when setting up the Integration. - * @return required - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Whether this is a required option when setting up the Integration.") + public void setName(String name) { + this.name = name; + } - public Boolean getRequired() { - return required; - } + public IntegrationOptionBeta type(String type) { + this.type = type; + return this; + } - public void setRequired(Boolean required) { - this.required = required; - } + /** + * Defines the type for this option in the schema. Types are most commonly strings, but may also + * represent other primitive types, such as booleans, and numbers, as well as complex types, + * such as objects and arrays. + * + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } - public IntegrationOptionBeta description(String description) { - - this.description = description; - return this; - } + public IntegrationOptionBeta required(Boolean required) { - /** - * An optional short text description of the field. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An optional short text description of the field.") + this.required = required; + return this; + } - public String getDescription() { - return description; - } + /** + * Whether this is a required option when setting up the Integration. + * + * @return required + */ + @javax.annotation.Nonnull + public Boolean getRequired() { + return required; + } + public void setRequired(Boolean required) { + this.required = required; + } - public void setDescription(String description) { - this.description = description; - } + public IntegrationOptionBeta description(String description) { + this.description = description; + return this; + } - public IntegrationOptionBeta defaultValue(Object defaultValue) { - - this.defaultValue = defaultValue; - return this; - } + /** + * An optional short text description of the field. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } - /** - * An optional default value for the field. - * @return defaultValue - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An optional default value for the field.") + public void setDescription(String description) { + this.description = description; + } - public Object getDefaultValue() { - return defaultValue; - } + public IntegrationOptionBeta defaultValue(Object defaultValue) { + this.defaultValue = defaultValue; + return this; + } - public void setDefaultValue(Object defaultValue) { - this.defaultValue = defaultValue; - } + /** + * An optional default value for the field. + * + * @return defaultValue + */ + @javax.annotation.Nullable + public Object getDefaultValue() { + return defaultValue; + } + public void setDefaultValue(Object defaultValue) { + this.defaultValue = defaultValue; + } - public IntegrationOptionBeta label(String label) { - - this.label = label; - return this; - } + public IntegrationOptionBeta label(String label) { - /** - * An optional label for this field. - * @return label - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An optional label for this field.") + this.label = label; + return this; + } - public String getLabel() { - return label; - } + /** + * An optional label for this field. + * + * @return label + */ + @javax.annotation.Nullable + public String getLabel() { + return label; + } + public void setLabel(String label) { + this.label = label; + } - public void setLabel(String label) { - this.label = label; - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegrationOptionBeta integrationOptionBeta = (IntegrationOptionBeta) o; + return Objects.equals(this.name, integrationOptionBeta.name) + && Objects.equals(this.type, integrationOptionBeta.type) + && Objects.equals(this.required, integrationOptionBeta.required) + && Objects.equals(this.description, integrationOptionBeta.description) + && Objects.equals(this.defaultValue, integrationOptionBeta.defaultValue) + && Objects.equals(this.label, integrationOptionBeta.label); + } + 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(name, type, required, description, defaultValue, label); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationOptionBeta {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append("}"); + return sb.toString(); } - IntegrationOptionBeta integrationOptionBeta = (IntegrationOptionBeta) o; - return Objects.equals(this.name, integrationOptionBeta.name) && - Objects.equals(this.type, integrationOptionBeta.type) && - Objects.equals(this.required, integrationOptionBeta.required) && - Objects.equals(this.description, integrationOptionBeta.description) && - Objects.equals(this.defaultValue, integrationOptionBeta.defaultValue) && - Objects.equals(this.label, integrationOptionBeta.label); - } - - 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(name, type, required, description, defaultValue, label); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class IntegrationOptionBeta {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" required: ").append(toIndentedString(required)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); - sb.append(" label: ").append(toIndentedString(label)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("required"); + openapiFields.add("description"); + openapiFields.add("defaultValue"); + openapiFields.add("label"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("required"); } - return o.toString().replace("\n", "\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("required"); - openapiFields.add("description"); - openapiFields.add("defaultValue"); - openapiFields.add("label"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("type"); - openapiRequiredFields.add("required"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to IntegrationOptionBeta - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!IntegrationOptionBeta.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in IntegrationOptionBeta is not found in the empty JSON string", IntegrationOptionBeta.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IntegrationOptionBeta + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IntegrationOptionBeta.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in IntegrationOptionBeta is not found in" + + " the empty JSON string", + IntegrationOptionBeta.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!IntegrationOptionBeta.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IntegrationOptionBeta` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IntegrationOptionBeta.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `IntegrationOptionBeta` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : IntegrationOptionBeta.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IntegrationOptionBeta.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("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("label") != null && !jsonObj.get("label").isJsonNull()) + && !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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IntegrationOptionBeta.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IntegrationOptionBeta' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(IntegrationOptionBeta.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, IntegrationOptionBeta value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IntegrationOptionBeta read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("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("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("label") != null && !jsonObj.get("label").isJsonNull()) && !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())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!IntegrationOptionBeta.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'IntegrationOptionBeta' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(IntegrationOptionBeta.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, IntegrationOptionBeta value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public IntegrationOptionBeta read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of IntegrationOptionBeta given an JSON string - * - * @param jsonString JSON string - * @return An instance of IntegrationOptionBeta - * @throws IOException if the JSON string is invalid with respect to IntegrationOptionBeta - */ - public static IntegrationOptionBeta fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, IntegrationOptionBeta.class); - } - - /** - * Convert an instance of IntegrationOptionBeta to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of IntegrationOptionBeta given an JSON string + * + * @param jsonString JSON string + * @return An instance of IntegrationOptionBeta + * @throws IOException if the JSON string is invalid with respect to IntegrationOptionBeta + */ + public static IntegrationOptionBeta fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IntegrationOptionBeta.class); + } + + /** + * Convert an instance of IntegrationOptionBeta to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/InvitePermissionV1.java b/src/main/java/com/segment/publicapi/models/InvitePermissionV1.java index 20598e16..1b9fb57e 100644 --- a/src/main/java/com/segment/publicapi/models/InvitePermissionV1.java +++ b/src/main/java/com/segment/publicapi/models/InvitePermissionV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,306 +9,312 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.AllowedLabelBeta; -import com.segment.publicapi.models.ResourceV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Defines a permission to apply to the user in an invite. */ +public class InvitePermissionV1 { + public static final String SERIALIZED_NAME_ROLE_ID = "roleId"; -/** - * Defines a permission to apply to the user in an invite. - */ -@ApiModel(description = "Defines a permission to apply to the user in an invite.") + @SerializedName(SERIALIZED_NAME_ROLE_ID) + private String roleId; -public class InvitePermissionV1 { - public static final String SERIALIZED_NAME_ROLE_ID = "roleId"; - @SerializedName(SERIALIZED_NAME_ROLE_ID) - private String roleId; + public static final String SERIALIZED_NAME_RESOURCES = "resources"; - public static final String SERIALIZED_NAME_RESOURCES = "resources"; - @SerializedName(SERIALIZED_NAME_RESOURCES) - private List resources = null; + @SerializedName(SERIALIZED_NAME_RESOURCES) + private List resources; - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = null; + public static final String SERIALIZED_NAME_LABELS = "labels"; - public InvitePermissionV1() { - } + @SerializedName(SERIALIZED_NAME_LABELS) + private List labels; - public InvitePermissionV1 roleId(String roleId) { - - this.roleId = roleId; - return this; - } + public InvitePermissionV1() {} - /** - * The id of the role. - * @return roleId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the role.") + public InvitePermissionV1 roleId(String roleId) { - public String getRoleId() { - return roleId; - } + this.roleId = roleId; + return this; + } + /** + * The id of the role. + * + * @return roleId + */ + @javax.annotation.Nonnull + public String getRoleId() { + return roleId; + } - public void setRoleId(String roleId) { - this.roleId = roleId; - } + public void setRoleId(String roleId) { + this.roleId = roleId; + } + public InvitePermissionV1 resources(List resources) { - public InvitePermissionV1 resources(List resources) { - - this.resources = resources; - return this; - } + this.resources = resources; + return this; + } - public InvitePermissionV1 addResourcesItem(ResourceV1 resourcesItem) { - if (this.resources == null) { - this.resources = new ArrayList<>(); + public InvitePermissionV1 addResourcesItem(ResourceV1 resourcesItem) { + if (this.resources == null) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; } - this.resources.add(resourcesItem); - return this; - } - /** - * The resources to grant the invited users access to. - * @return resources - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The resources to grant the invited users access to.") + /** + * The resources to grant the invited users access to. + * + * @return resources + */ + @javax.annotation.Nullable + public List getResources() { + return resources; + } - public List getResources() { - return resources; - } + public void setResources(List resources) { + this.resources = resources; + } + public InvitePermissionV1 labels(List labels) { - public void setResources(List resources) { - this.resources = resources; - } + this.labels = labels; + return this; + } + public InvitePermissionV1 addLabelsItem(AllowedLabelBeta labelsItem) { + if (this.labels == null) { + this.labels = new ArrayList<>(); + } + this.labels.add(labelsItem); + return this; + } - public InvitePermissionV1 labels(List labels) { - - this.labels = labels; - return this; - } + /** + * The labels that determine which resources to grant users access to. + * + * @return labels + */ + @javax.annotation.Nullable + public List getLabels() { + return labels; + } - public InvitePermissionV1 addLabelsItem(AllowedLabelBeta labelsItem) { - if (this.labels == null) { - this.labels = new ArrayList<>(); + public void setLabels(List labels) { + this.labels = labels; } - this.labels.add(labelsItem); - return this; - } - /** - * The labels that determine which resources to grant users access to. - * @return labels - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The labels that determine which resources to grant users access to.") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InvitePermissionV1 invitePermissionV1 = (InvitePermissionV1) o; + return Objects.equals(this.roleId, invitePermissionV1.roleId) + && Objects.equals(this.resources, invitePermissionV1.resources) + && Objects.equals(this.labels, invitePermissionV1.labels); + } - public List getLabels() { - return labels; - } + @Override + public int hashCode() { + return Objects.hash(roleId, resources, labels); + } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InvitePermissionV1 {\n"); + sb.append(" roleId: ").append(toIndentedString(roleId)).append("\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public void setLabels(List labels) { - this.labels = labels; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("roleId"); + openapiFields.add("resources"); + openapiFields.add("labels"); - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InvitePermissionV1 invitePermissionV1 = (InvitePermissionV1) o; - return Objects.equals(this.roleId, invitePermissionV1.roleId) && - Objects.equals(this.resources, invitePermissionV1.resources) && - Objects.equals(this.labels, invitePermissionV1.labels); - } - - @Override - public int hashCode() { - return Objects.hash(roleId, resources, labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InvitePermissionV1 {\n"); - sb.append(" roleId: ").append(toIndentedString(roleId)).append("\n"); - sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("roleId"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("roleId"); - openapiFields.add("resources"); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("roleId"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to InvitePermissionV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!InvitePermissionV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in InvitePermissionV1 is not found in the empty JSON string", InvitePermissionV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InvitePermissionV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InvitePermissionV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in InvitePermissionV1 is not found in the" + + " empty JSON string", + InvitePermissionV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!InvitePermissionV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InvitePermissionV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!InvitePermissionV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `InvitePermissionV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : InvitePermissionV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InvitePermissionV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("roleId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `roleId` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("roleId").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++) { + ResourceV1.validateJsonElement(jsonArrayresources.get(i)); + } + ; + } } - } - if (!jsonObj.get("roleId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `roleId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("roleId").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())); - } + if (jsonObj.get("labels") != null && !jsonObj.get("labels").isJsonNull()) { + JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); + if (jsonArraylabels != null) { + // ensure the json data is an array + if (!jsonObj.get("labels").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `labels` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("labels").toString())); + } + + // validate the optional field `labels` (array) + for (int i = 0; i < jsonArraylabels.size(); i++) { + AllowedLabelBeta.validateJsonElement(jsonArraylabels.get(i)); + } + ; + } } - } - if (jsonObj.get("labels") != null && !jsonObj.get("labels").isJsonNull()) { - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - if (jsonArraylabels != null) { - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InvitePermissionV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InvitePermissionV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(InvitePermissionV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, InvitePermissionV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InvitePermissionV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!InvitePermissionV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'InvitePermissionV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(InvitePermissionV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, InvitePermissionV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public InvitePermissionV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + /** + * Create an instance of InvitePermissionV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of InvitePermissionV1 + * @throws IOException if the JSON string is invalid with respect to InvitePermissionV1 + */ + public static InvitePermissionV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InvitePermissionV1.class); } - } - - /** - * Create an instance of InvitePermissionV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of InvitePermissionV1 - * @throws IOException if the JSON string is invalid with respect to InvitePermissionV1 - */ - public static InvitePermissionV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, InvitePermissionV1.class); - } - - /** - * Convert an instance of InvitePermissionV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of InvitePermissionV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/InviteV1.java b/src/main/java/com/segment/publicapi/models/InviteV1.java index cd2aacee..0cfca05b 100644 --- a/src/main/java/com/segment/publicapi/models/InviteV1.java +++ b/src/main/java/com/segment/publicapi/models/InviteV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,258 +9,256 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.InvitePermissionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Defines an invitation to join a Workspace. - */ -@ApiModel(description = "Defines an invitation to join a Workspace.") - +/** Defines an invitation to join a Workspace. */ public class InviteV1 { - public static final String SERIALIZED_NAME_EMAIL = "email"; - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; + public static final String SERIALIZED_NAME_EMAIL = "email"; - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions = null; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; - public InviteV1() { - } + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - public InviteV1 email(String email) { - - this.email = email; - return this; - } + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions; - /** - * The invited user's email to attach the permissions to. - * @return email - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The invited user's email to attach the permissions to.") + public InviteV1() {} - public String getEmail() { - return email; - } + public InviteV1 email(String email) { + this.email = email; + return this; + } - public void setEmail(String email) { - this.email = email; - } + /** + * The invited user's email to attach the permissions to. + * + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } - public InviteV1 permissions(List permissions) { - - this.permissions = permissions; - return this; - } + public InviteV1 permissions(List permissions) { - public InviteV1 addPermissionsItem(InvitePermissionV1 permissionsItem) { - if (this.permissions == null) { - this.permissions = new ArrayList<>(); + this.permissions = permissions; + return this; } - this.permissions.add(permissionsItem); - return this; - } - - /** - * The permissions to attach to the invited user. - * @return permissions - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The permissions to attach to the invited user.") - public List getPermissions() { - return permissions; - } + public InviteV1 addPermissionsItem(InvitePermissionV1 permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); + } + this.permissions.add(permissionsItem); + return this; + } + /** + * The permissions to attach to the invited user. + * + * @return permissions + */ + @javax.annotation.Nullable + public List getPermissions() { + return permissions; + } - public void setPermissions(List permissions) { - this.permissions = permissions; - } + public void setPermissions(List permissions) { + this.permissions = permissions; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InviteV1 inviteV1 = (InviteV1) o; + return Objects.equals(this.email, inviteV1.email) + && Objects.equals(this.permissions, inviteV1.permissions); + } + @Override + public int hashCode() { + return Objects.hash(email, permissions); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InviteV1 {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - InviteV1 inviteV1 = (InviteV1) o; - return Objects.equals(this.email, inviteV1.email) && - Objects.equals(this.permissions, inviteV1.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(email, permissions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InviteV1 {\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("permissions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("email"); } - return o.toString().replace("\n", "\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("permissions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("email"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to InviteV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!InviteV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in InviteV1 is not found in the empty JSON string", InviteV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InviteV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InviteV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in InviteV1 is not found in the empty" + + " JSON string", + InviteV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!InviteV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InviteV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!InviteV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `InviteV1`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : InviteV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InviteV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } } - } - 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("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { - JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - if (jsonArraypermissions != null) { - // ensure the json data is an array - if (!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())); - } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + 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("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { + JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); + if (jsonArraypermissions != null) { + // ensure the json data is an array + if (!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())); + } + + // validate the optional field `permissions` (array) + for (int i = 0; i < jsonArraypermissions.size(); i++) { + InvitePermissionV1.validateJsonElement(jsonArraypermissions.get(i)); + } + ; + } + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!InviteV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'InviteV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(InviteV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, InviteV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public InviteV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InviteV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InviteV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(InviteV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, InviteV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InviteV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of InviteV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of InviteV1 + * @throws IOException if the JSON string is invalid with respect to InviteV1 + */ + public static InviteV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InviteV1.class); } - } - - /** - * Create an instance of InviteV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of InviteV1 - * @throws IOException if the JSON string is invalid with respect to InviteV1 - */ - public static InviteV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, InviteV1.class); - } - - /** - * Convert an instance of InviteV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of InviteV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Label.java b/src/main/java/com/segment/publicapi/models/Label.java deleted file mode 100644 index a1e90429..00000000 --- a/src/main/java/com/segment/publicapi/models/Label.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The new label to create in the Workspace. - */ -@ApiModel(description = "The new label to create in the Workspace.") - -public class Label { - public static final String SERIALIZED_NAME_KEY = "key"; - @SerializedName(SERIALIZED_NAME_KEY) - private String key; - - public static final String SERIALIZED_NAME_VALUE = "value"; - @SerializedName(SERIALIZED_NAME_VALUE) - private String value; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public Label() { - } - - public Label key(String key) { - - this.key = key; - return this; - } - - /** - * The key that represents the name of this label. - * @return key - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The key that represents the name of this label.") - - public String getKey() { - return key; - } - - - public void setKey(String key) { - this.key = key; - } - - - public Label value(String value) { - - this.value = value; - return this; - } - - /** - * The value associated with the key of this label. - * @return value - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The value associated with the key of this label.") - - public String getValue() { - return value; - } - - - public void setValue(String value) { - this.value = value; - } - - - public Label description(String description) { - - this.description = description; - return this; - } - - /** - * An optional description of the purpose of this label. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An optional description of the purpose of this label.") - - 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; - } - Label label = (Label) o; - return Objects.equals(this.key, label.key) && - Objects.equals(this.value, label.value) && - Objects.equals(this.description, label.description); - } - - @Override - public int hashCode() { - return Objects.hash(key, value, description); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Label {\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).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("key"); - openapiFields.add("value"); - openapiFields.add("description"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("key"); - openapiRequiredFields.add("value"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Label - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Label.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Label is not found in the empty JSON string", Label.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Label.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Label` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Label.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); - } - } - if (!jsonObj.get("key").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").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())); - } - 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 (!Label.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Label' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter

It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof ReverseEtlPeriodicScheduleConfig) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ReverseEtlSpecificTimeScheduleConfig) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ReverseEtlCronScheduleConfig) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ReverseEtlDbtCloudScheduleConfig) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be ReverseEtlCronScheduleConfig," + + " ReverseEtlDbtCloudScheduleConfig, ReverseEtlPeriodicScheduleConfig," + + " ReverseEtlSpecificTimeScheduleConfig"); + } + + /** + * Get the actual instance, which can be the following: ReverseEtlCronScheduleConfig, + * ReverseEtlDbtCloudScheduleConfig, ReverseEtlPeriodicScheduleConfig, + * ReverseEtlSpecificTimeScheduleConfig + * + * @return The actual instance (ReverseEtlCronScheduleConfig, ReverseEtlDbtCloudScheduleConfig, + * ReverseEtlPeriodicScheduleConfig, ReverseEtlSpecificTimeScheduleConfig) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ReverseEtlPeriodicScheduleConfig`. If the actual instance is not + * `ReverseEtlPeriodicScheduleConfig`, the ClassCastException will be thrown. + * + * @return The actual instance of `ReverseEtlPeriodicScheduleConfig` + * @throws ClassCastException if the instance is not `ReverseEtlPeriodicScheduleConfig` + */ + public ReverseEtlPeriodicScheduleConfig getReverseEtlPeriodicScheduleConfig() + throws ClassCastException { + return (ReverseEtlPeriodicScheduleConfig) super.getActualInstance(); + } + + /** + * Get the actual instance of `ReverseEtlSpecificTimeScheduleConfig`. If the actual instance is + * not `ReverseEtlSpecificTimeScheduleConfig`, the ClassCastException will be thrown. + * + * @return The actual instance of `ReverseEtlSpecificTimeScheduleConfig` + * @throws ClassCastException if the instance is not `ReverseEtlSpecificTimeScheduleConfig` + */ + public ReverseEtlSpecificTimeScheduleConfig getReverseEtlSpecificTimeScheduleConfig() + throws ClassCastException { + return (ReverseEtlSpecificTimeScheduleConfig) super.getActualInstance(); + } + + /** + * Get the actual instance of `ReverseEtlCronScheduleConfig`. If the actual instance is not + * `ReverseEtlCronScheduleConfig`, the ClassCastException will be thrown. + * + * @return The actual instance of `ReverseEtlCronScheduleConfig` + * @throws ClassCastException if the instance is not `ReverseEtlCronScheduleConfig` + */ + public ReverseEtlCronScheduleConfig getReverseEtlCronScheduleConfig() + throws ClassCastException { + return (ReverseEtlCronScheduleConfig) super.getActualInstance(); + } + + /** + * Get the actual instance of `ReverseEtlDbtCloudScheduleConfig`. If the actual instance is not + * `ReverseEtlDbtCloudScheduleConfig`, the ClassCastException will be thrown. + * + * @return The actual instance of `ReverseEtlDbtCloudScheduleConfig` + * @throws ClassCastException if the instance is not `ReverseEtlDbtCloudScheduleConfig` + */ + public ReverseEtlDbtCloudScheduleConfig getReverseEtlDbtCloudScheduleConfig() + throws ClassCastException { + return (ReverseEtlDbtCloudScheduleConfig) 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 ReverseEtlScheduleConfig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with ReverseEtlPeriodicScheduleConfig + try { + ReverseEtlPeriodicScheduleConfig.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for ReverseEtlPeriodicScheduleConfig failed with" + + " `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with ReverseEtlSpecificTimeScheduleConfig + try { + ReverseEtlSpecificTimeScheduleConfig.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for ReverseEtlSpecificTimeScheduleConfig failed with" + + " `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with ReverseEtlCronScheduleConfig + try { + ReverseEtlCronScheduleConfig.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for ReverseEtlCronScheduleConfig failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with ReverseEtlDbtCloudScheduleConfig + try { + ReverseEtlDbtCloudScheduleConfig.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add( + String.format( + "Deserialization for ReverseEtlDbtCloudScheduleConfig failed with" + + " `%s`.", + e.getMessage())); + // continue to the next one + } + throw new IOException( + String.format( + "The JSON string is invalid for ReverseEtlScheduleConfig with anyOf" + + " schemas: ReverseEtlCronScheduleConfig," + + " ReverseEtlDbtCloudScheduleConfig, ReverseEtlPeriodicScheduleConfig," + + " ReverseEtlSpecificTimeScheduleConfig. no class match the result," + + " expected at least 1. Detailed failure message for anyOf schemas:" + + " %s. JSON: %s", + errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of ReverseEtlScheduleConfig given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReverseEtlScheduleConfig + * @throws IOException if the JSON string is invalid with respect to ReverseEtlScheduleConfig + */ + public static ReverseEtlScheduleConfig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReverseEtlScheduleConfig.class); + } + + /** + * Convert an instance of ReverseEtlScheduleConfig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/ReverseEtlScheduleDefinition.java b/src/main/java/com/segment/publicapi/models/ReverseEtlScheduleDefinition.java new file mode 100644 index 00000000..f8705f0e --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/ReverseEtlScheduleDefinition.java @@ -0,0 +1,318 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Defines a configuration object used for scheduling, which can vary depending on the configured + * strategy. + */ +public class ReverseEtlScheduleDefinition { + /** Strategy supports: Periodic, Specific Days, Manual, CRON and DBT_CLOUD. */ + @JsonAdapter(StrategyEnum.Adapter.class) + public enum StrategyEnum { + CRON("CRON"), + + DBT_CLOUD("DBT_CLOUD"), + + MANUAL("MANUAL"), + + PERIODIC("PERIODIC"), + + SPECIFIC_DAYS("SPECIFIC_DAYS"); + + private String value; + + StrategyEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StrategyEnum fromValue(String value) { + for (StrategyEnum b : StrategyEnum.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 StrategyEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StrategyEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StrategyEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STRATEGY = "strategy"; + + @SerializedName(SERIALIZED_NAME_STRATEGY) + private StrategyEnum strategy; + + public static final String SERIALIZED_NAME_CONFIG = "config"; + + @SerializedName(SERIALIZED_NAME_CONFIG) + private Config1 config; + + public ReverseEtlScheduleDefinition() {} + + public ReverseEtlScheduleDefinition strategy(StrategyEnum strategy) { + + this.strategy = strategy; + return this; + } + + /** + * Strategy supports: Periodic, Specific Days, Manual, CRON and DBT_CLOUD. + * + * @return strategy + */ + @javax.annotation.Nonnull + public StrategyEnum getStrategy() { + return strategy; + } + + public void setStrategy(StrategyEnum strategy) { + this.strategy = strategy; + } + + public ReverseEtlScheduleDefinition config(Config1 config) { + + this.config = config; + return this; + } + + /** + * Get config + * + * @return config + */ + @javax.annotation.Nullable + public Config1 getConfig() { + return config; + } + + public void setConfig(Config1 config) { + this.config = config; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReverseEtlScheduleDefinition reverseEtlScheduleDefinition = + (ReverseEtlScheduleDefinition) o; + return Objects.equals(this.strategy, reverseEtlScheduleDefinition.strategy) + && Objects.equals(this.config, reverseEtlScheduleDefinition.config); + } + + 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(strategy, config); + } + + 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 ReverseEtlScheduleDefinition {\n"); + sb.append(" strategy: ").append(toIndentedString(strategy)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("strategy"); + openapiFields.add("config"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("strategy"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ReverseEtlScheduleDefinition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReverseEtlScheduleDefinition.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ReverseEtlScheduleDefinition is not" + + " found in the empty JSON string", + ReverseEtlScheduleDefinition.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReverseEtlScheduleDefinition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ReverseEtlScheduleDefinition` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReverseEtlScheduleDefinition.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("strategy").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `strategy` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("strategy").toString())); + } + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + Config1.validateJsonElement(jsonObj.get("config")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReverseEtlScheduleDefinition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReverseEtlScheduleDefinition' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ReverseEtlScheduleDefinition.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ReverseEtlScheduleDefinition value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReverseEtlScheduleDefinition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ReverseEtlScheduleDefinition given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReverseEtlScheduleDefinition + * @throws IOException if the JSON string is invalid with respect to + * ReverseEtlScheduleDefinition + */ + public static ReverseEtlScheduleDefinition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReverseEtlScheduleDefinition.class); + } + + /** + * Convert an instance of ReverseEtlScheduleDefinition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/ReverseEtlSpecificTimeScheduleConfig.java b/src/main/java/com/segment/publicapi/models/ReverseEtlSpecificTimeScheduleConfig.java new file mode 100644 index 00000000..0641b8a3 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/ReverseEtlSpecificTimeScheduleConfig.java @@ -0,0 +1,321 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * Definition for specific day and time schedule. Days is list of numbered day of the week and hours + * is a list of hour of the day. The corresponding Timezone is also input as string. + */ +public class ReverseEtlSpecificTimeScheduleConfig { + public static final String SERIALIZED_NAME_DAYS = "days"; + + @SerializedName(SERIALIZED_NAME_DAYS) + private List days = new ArrayList<>(); + + public static final String SERIALIZED_NAME_HOURS = "hours"; + + @SerializedName(SERIALIZED_NAME_HOURS) + private List hours = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TIMEZONE = "timezone"; + + @SerializedName(SERIALIZED_NAME_TIMEZONE) + private String timezone; + + public ReverseEtlSpecificTimeScheduleConfig() {} + + public ReverseEtlSpecificTimeScheduleConfig days(List days) { + + this.days = days; + return this; + } + + public ReverseEtlSpecificTimeScheduleConfig addDaysItem(BigDecimal daysItem) { + if (this.days == null) { + this.days = new ArrayList<>(); + } + this.days.add(daysItem); + return this; + } + + /** + * Days of the week. + * + * @return days + */ + @javax.annotation.Nonnull + public List getDays() { + return days; + } + + public void setDays(List days) { + this.days = days; + } + + public ReverseEtlSpecificTimeScheduleConfig hours(List hours) { + + this.hours = hours; + return this; + } + + public ReverseEtlSpecificTimeScheduleConfig addHoursItem(BigDecimal hoursItem) { + if (this.hours == null) { + this.hours = new ArrayList<>(); + } + this.hours.add(hoursItem); + return this; + } + + /** + * Hours of the day. + * + * @return hours + */ + @javax.annotation.Nonnull + public List getHours() { + return hours; + } + + public void setHours(List hours) { + this.hours = hours; + } + + public ReverseEtlSpecificTimeScheduleConfig timezone(String timezone) { + + this.timezone = timezone; + return this; + } + + /** + * Timezone for the specified times. + * + * @return timezone + */ + @javax.annotation.Nonnull + public String getTimezone() { + return timezone; + } + + public void setTimezone(String timezone) { + this.timezone = timezone; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReverseEtlSpecificTimeScheduleConfig reverseEtlSpecificTimeScheduleConfig = + (ReverseEtlSpecificTimeScheduleConfig) o; + return Objects.equals(this.days, reverseEtlSpecificTimeScheduleConfig.days) + && Objects.equals(this.hours, reverseEtlSpecificTimeScheduleConfig.hours) + && Objects.equals(this.timezone, reverseEtlSpecificTimeScheduleConfig.timezone); + } + + @Override + public int hashCode() { + return Objects.hash(days, hours, timezone); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReverseEtlSpecificTimeScheduleConfig {\n"); + sb.append(" days: ").append(toIndentedString(days)).append("\n"); + sb.append(" hours: ").append(toIndentedString(hours)).append("\n"); + sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("days"); + openapiFields.add("hours"); + openapiFields.add("timezone"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("days"); + openapiRequiredFields.add("hours"); + openapiRequiredFields.add("timezone"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ReverseEtlSpecificTimeScheduleConfig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReverseEtlSpecificTimeScheduleConfig.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in ReverseEtlSpecificTimeScheduleConfig" + + " is not found in the empty JSON string", + ReverseEtlSpecificTimeScheduleConfig.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReverseEtlSpecificTimeScheduleConfig.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `ReverseEtlSpecificTimeScheduleConfig` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReverseEtlSpecificTimeScheduleConfig.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 required json array is present + if (jsonObj.get("days") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("days").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `days` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("days").toString())); + } + // ensure the required json array is present + if (jsonObj.get("hours") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("hours").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `hours` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("hours").toString())); + } + if (!jsonObj.get("timezone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `timezone` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("timezone").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReverseEtlSpecificTimeScheduleConfig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReverseEtlSpecificTimeScheduleConfig' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ReverseEtlSpecificTimeScheduleConfig.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, ReverseEtlSpecificTimeScheduleConfig value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReverseEtlSpecificTimeScheduleConfig read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of ReverseEtlSpecificTimeScheduleConfig given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReverseEtlSpecificTimeScheduleConfig + * @throws IOException if the JSON string is invalid with respect to + * ReverseEtlSpecificTimeScheduleConfig + */ + public static ReverseEtlSpecificTimeScheduleConfig fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, ReverseEtlSpecificTimeScheduleConfig.class); + } + + /** + * Convert an instance of ReverseEtlSpecificTimeScheduleConfig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/RoleV1.java b/src/main/java/com/segment/publicapi/models/RoleV1.java index b204a23e..8dc7287f 100644 --- a/src/main/java/com/segment/publicapi/models/RoleV1.java +++ b/src/main/java/com/segment/publicapi/models/RoleV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,276 +9,270 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Represents a role. - */ -@ApiModel(description = "Represents a role.") - +/** Represents a role. */ public class RoleV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_ID = "id"; - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + @SerializedName(SERIALIZED_NAME_ID) + private String id; - public RoleV1() { - } + public static final String SERIALIZED_NAME_NAME = "name"; - public RoleV1 id(String id) { - - this.id = id; - return this; - } + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - /** - * The unique identifier of the role. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier of the role.") + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - public String getId() { - return id; - } + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + public RoleV1() {} - public void setId(String id) { - this.id = id; - } + public RoleV1 id(String id) { + this.id = id; + return this; + } - public RoleV1 name(String name) { - - this.name = name; - return this; - } - - /** - * The human-readable name of the role. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The human-readable name of the role.") + /** + * The unique identifier of the role. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - public String getName() { - return name; - } + public void setId(String id) { + this.id = id; + } + public RoleV1 name(String name) { - public void setName(String name) { - this.name = name; - } + this.name = name; + return this; + } + /** + * The human-readable name of the role. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public RoleV1 description(String description) { - - this.description = description; - return this; - } + public void setName(String name) { + this.name = name; + } - /** - * The human-readable description of the role. - * @return description - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The human-readable description of the role.") + public RoleV1 description(String description) { - public String getDescription() { - return description; - } + this.description = description; + return this; + } + /** + * The human-readable description of the role. + * + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = 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; + } + RoleV1 roleV1 = (RoleV1) o; + return Objects.equals(this.id, roleV1.id) + && Objects.equals(this.name, roleV1.name) + && Objects.equals(this.description, roleV1.description); + } + @Override + public int hashCode() { + return Objects.hash(id, name, description); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RoleV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - RoleV1 roleV1 = (RoleV1) o; - return Objects.equals(this.id, roleV1.id) && - Objects.equals(this.name, roleV1.name) && - Objects.equals(this.description, roleV1.description); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, description); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RoleV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).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"; + + 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("name"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("description"); } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("description"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("description"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to RoleV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!RoleV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in RoleV1 is not found in the empty JSON string", RoleV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RoleV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RoleV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in RoleV1 is not found in the empty JSON" + + " string", + RoleV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!RoleV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RoleV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RoleV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `RoleV1`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : RoleV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RoleV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("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("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("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("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 (!RoleV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'RoleV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(RoleV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, RoleV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public RoleV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of RoleV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of RoleV1 - * @throws IOException if the JSON string is invalid with respect to RoleV1 - */ - public static RoleV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, RoleV1.class); - } - - /** - * Convert an instance of RoleV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RoleV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RoleV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RoleV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RoleV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RoleV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of RoleV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of RoleV1 + * @throws IOException if the JSON string is invalid with respect to RoleV1 + */ + public static RoleV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RoleV1.class); + } + + /** + * Convert an instance of RoleV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/RuleInputV1.java b/src/main/java/com/segment/publicapi/models/RuleInputV1.java new file mode 100644 index 00000000..5aa9eb2a --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/RuleInputV1.java @@ -0,0 +1,356 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Represents a rule to add to a Tracking Plan. */ +public class RuleInputV1 { + /** The type for this Tracking Plan rule. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + COMMON("COMMON"), + + GROUP("GROUP"), + + IDENTIFY("IDENTIFY"), + + PAGE("PAGE"), + + SCREEN("SCREEN"), + + TRACK("TRACK"); + + 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_KEY = "key"; + + @SerializedName(SERIALIZED_NAME_KEY) + private String key; + + public static final String SERIALIZED_NAME_JSON_SCHEMA = "jsonSchema"; + + @SerializedName(SERIALIZED_NAME_JSON_SCHEMA) + private Object jsonSchema = null; + + public static final String SERIALIZED_NAME_VERSION = "version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + private BigDecimal version; + + public RuleInputV1() {} + + public RuleInputV1 type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * The type for this Tracking Plan rule. + * + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + public RuleInputV1 key(String key) { + + this.key = key; + return this; + } + + /** + * Key to this rule (free-form string like 'Button clicked'). + * + * @return key + */ + @javax.annotation.Nullable + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public RuleInputV1 jsonSchema(Object jsonSchema) { + + this.jsonSchema = jsonSchema; + return this; + } + + /** + * JSON Schema of this rule. + * + * @return jsonSchema + */ + @javax.annotation.Nullable + public Object getJsonSchema() { + return jsonSchema; + } + + public void setJsonSchema(Object jsonSchema) { + this.jsonSchema = jsonSchema; + } + + public RuleInputV1 version(BigDecimal version) { + + this.version = version; + return this; + } + + /** + * Version of this rule. + * + * @return version + */ + @javax.annotation.Nonnull + public BigDecimal getVersion() { + return version; + } + + public void setVersion(BigDecimal version) { + this.version = version; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RuleInputV1 ruleInputV1 = (RuleInputV1) o; + return Objects.equals(this.type, ruleInputV1.type) + && Objects.equals(this.key, ruleInputV1.key) + && Objects.equals(this.jsonSchema, ruleInputV1.jsonSchema) + && Objects.equals(this.version, ruleInputV1.version); + } + + @Override + public int hashCode() { + return Objects.hash(type, key, jsonSchema, version); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleInputV1 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" jsonSchema: ").append(toIndentedString(jsonSchema)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("key"); + openapiFields.add("jsonSchema"); + openapiFields.add("version"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("jsonSchema"); + openapiRequiredFields.add("version"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RuleInputV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RuleInputV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in RuleInputV1 is not found in the empty" + + " JSON string", + RuleInputV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RuleInputV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `RuleInputV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RuleInputV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("key") != null && !jsonObj.get("key").isJsonNull()) + && !jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `key` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("key").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RuleInputV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RuleInputV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RuleInputV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RuleInputV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RuleInputV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of RuleInputV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of RuleInputV1 + * @throws IOException if the JSON string is invalid with respect to RuleInputV1 + */ + public static RuleInputV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RuleInputV1.class); + } + + /** + * Convert an instance of RuleInputV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/RuleV1.java b/src/main/java/com/segment/publicapi/models/RuleV1.java index 3f5a21a6..ca8e754d 100644 --- a/src/main/java/com/segment/publicapi/models/RuleV1.java +++ b/src/main/java/com/segment/publicapi/models/RuleV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,458 +9,456 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Represents a rule from a Tracking Plan. - */ -@ApiModel(description = "Represents a rule from a Tracking Plan.") - +/** Represents a rule from a Tracking Plan. */ public class RuleV1 { - /** - * The type for this Tracking Plan rule. - */ - @JsonAdapter(TypeEnum.Adapter.class) - public enum TypeEnum { - COMMON("COMMON"), - - GROUP("GROUP"), - - IDENTIFY("IDENTIFY"), - - PAGE("PAGE"), - - SCREEN("SCREEN"), - - TRACK("TRACK"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } + /** The type for this Tracking Plan rule. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + COMMON("COMMON"), - public String getValue() { - return value; - } + GROUP("GROUP"), - @Override - public String toString() { - return String.valueOf(value); - } + IDENTIFY("IDENTIFY"), - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } + PAGE("PAGE"), - 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); - } - } - } + SCREEN("SCREEN"), - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - private TypeEnum type; + TRACK("TRACK"); - public static final String SERIALIZED_NAME_KEY = "key"; - @SerializedName(SERIALIZED_NAME_KEY) - private String key; + private String value; - public static final String SERIALIZED_NAME_JSON_SCHEMA = "jsonSchema"; - @SerializedName(SERIALIZED_NAME_JSON_SCHEMA) - private Object jsonSchema = null; + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } - public static final String SERIALIZED_NAME_VERSION = "version"; - @SerializedName(SERIALIZED_NAME_VERSION) - private BigDecimal version; + @Override + public String toString() { + return String.valueOf(value); + } - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; + 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 final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private String updatedAt; + 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_DEPRECATED_AT = "deprecatedAt"; - @SerializedName(SERIALIZED_NAME_DEPRECATED_AT) - private String deprecatedAt; + public static final String SERIALIZED_NAME_TYPE = "type"; - public RuleV1() { - } + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; - public RuleV1 type(TypeEnum type) { - - this.type = type; - return this; - } + public static final String SERIALIZED_NAME_KEY = "key"; - /** - * The type for this Tracking Plan rule. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type for this Tracking Plan rule.") + @SerializedName(SERIALIZED_NAME_KEY) + private String key; - public TypeEnum getType() { - return type; - } + public static final String SERIALIZED_NAME_JSON_SCHEMA = "jsonSchema"; + @SerializedName(SERIALIZED_NAME_JSON_SCHEMA) + private Object jsonSchema = null; - public void setType(TypeEnum type) { - this.type = type; - } + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private BigDecimal version; - public RuleV1 key(String key) { - - this.key = key; - return this; - } + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - /** - * Key to this rule (free-form string like 'Button clicked'). - * @return key - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Key to this rule (free-form string like 'Button clicked').") + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; - public String getKey() { - return key; - } + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private String updatedAt; - public void setKey(String key) { - this.key = key; - } + public static final String SERIALIZED_NAME_DEPRECATED_AT = "deprecatedAt"; + @SerializedName(SERIALIZED_NAME_DEPRECATED_AT) + private String deprecatedAt; - public RuleV1 jsonSchema(Object jsonSchema) { - - this.jsonSchema = jsonSchema; - return this; - } + public RuleV1() {} - /** - * JSON Schema of this rule. - * @return jsonSchema - **/ - @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "JSON Schema of this rule.") + public RuleV1 type(TypeEnum type) { - public Object getJsonSchema() { - return jsonSchema; - } + this.type = type; + return this; + } + /** + * The type for this Tracking Plan rule. + * + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } - public void setJsonSchema(Object jsonSchema) { - this.jsonSchema = jsonSchema; - } + public void setType(TypeEnum type) { + this.type = type; + } + public RuleV1 key(String key) { - public RuleV1 version(BigDecimal version) { - - this.version = version; - return this; - } + this.key = key; + return this; + } - /** - * Version of this rule. - * @return version - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Version of this rule.") + /** + * Key to this rule (free-form string like 'Button clicked'). + * + * @return key + */ + @javax.annotation.Nullable + public String getKey() { + return key; + } - public BigDecimal getVersion() { - return version; - } + public void setKey(String key) { + this.key = key; + } + public RuleV1 jsonSchema(Object jsonSchema) { - public void setVersion(BigDecimal version) { - this.version = version; - } + this.jsonSchema = jsonSchema; + return this; + } + /** + * JSON Schema of this rule. + * + * @return jsonSchema + */ + @javax.annotation.Nullable + public Object getJsonSchema() { + return jsonSchema; + } - public RuleV1 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } + public void setJsonSchema(Object jsonSchema) { + this.jsonSchema = jsonSchema; + } - /** - * The timestamp of this rule's creation. - * @return createdAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The timestamp of this rule's creation.") + public RuleV1 version(BigDecimal version) { - public String getCreatedAt() { - return createdAt; - } + this.version = version; + return this; + } + /** + * Version of this rule. + * + * @return version + */ + @javax.annotation.Nonnull + public BigDecimal getVersion() { + return version; + } - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } + public void setVersion(BigDecimal version) { + this.version = version; + } + public RuleV1 createdAt(String createdAt) { - public RuleV1 updatedAt(String updatedAt) { - - this.updatedAt = updatedAt; - return this; - } + this.createdAt = createdAt; + return this; + } - /** - * The timestamp of this rule's last change. - * @return updatedAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The timestamp of this rule's last change.") + /** + * The timestamp of this rule's creation. + * + * @return createdAt + */ + @javax.annotation.Nullable + public String getCreatedAt() { + return createdAt; + } - public String getUpdatedAt() { - return updatedAt; - } + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + public RuleV1 updatedAt(String updatedAt) { - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } + this.updatedAt = updatedAt; + return this; + } + /** + * The timestamp of this rule's last change. + * + * @return updatedAt + */ + @javax.annotation.Nullable + public String getUpdatedAt() { + return updatedAt; + } - public RuleV1 deprecatedAt(String deprecatedAt) { - - this.deprecatedAt = deprecatedAt; - return this; - } + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } - /** - * The timestamp of this rule's deprecation. - * @return deprecatedAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The timestamp of this rule's deprecation.") + public RuleV1 deprecatedAt(String deprecatedAt) { - public String getDeprecatedAt() { - return deprecatedAt; - } + this.deprecatedAt = deprecatedAt; + return this; + } + /** + * The timestamp of this rule's deprecation. + * + * @return deprecatedAt + */ + @javax.annotation.Nullable + public String getDeprecatedAt() { + return deprecatedAt; + } - public void setDeprecatedAt(String deprecatedAt) { - this.deprecatedAt = deprecatedAt; - } + public void setDeprecatedAt(String deprecatedAt) { + this.deprecatedAt = deprecatedAt; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RuleV1 ruleV1 = (RuleV1) o; + return Objects.equals(this.type, ruleV1.type) + && Objects.equals(this.key, ruleV1.key) + && Objects.equals(this.jsonSchema, ruleV1.jsonSchema) + && Objects.equals(this.version, ruleV1.version) + && Objects.equals(this.createdAt, ruleV1.createdAt) + && Objects.equals(this.updatedAt, ruleV1.updatedAt) + && Objects.equals(this.deprecatedAt, ruleV1.deprecatedAt); + } + @Override + public int hashCode() { + return Objects.hash(type, key, jsonSchema, version, createdAt, updatedAt, deprecatedAt); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleV1 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" jsonSchema: ").append(toIndentedString(jsonSchema)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" deprecatedAt: ").append(toIndentedString(deprecatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - RuleV1 ruleV1 = (RuleV1) o; - return Objects.equals(this.type, ruleV1.type) && - Objects.equals(this.key, ruleV1.key) && - Objects.equals(this.jsonSchema, ruleV1.jsonSchema) && - Objects.equals(this.version, ruleV1.version) && - Objects.equals(this.createdAt, ruleV1.createdAt) && - Objects.equals(this.updatedAt, ruleV1.updatedAt) && - Objects.equals(this.deprecatedAt, ruleV1.deprecatedAt); - } - - @Override - public int hashCode() { - return Objects.hash(type, key, jsonSchema, version, createdAt, updatedAt, deprecatedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RuleV1 {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" jsonSchema: ").append(toIndentedString(jsonSchema)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); - sb.append(" deprecatedAt: ").append(toIndentedString(deprecatedAt)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("key"); + openapiFields.add("jsonSchema"); + openapiFields.add("version"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("deprecatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("jsonSchema"); + openapiRequiredFields.add("version"); } - return o.toString().replace("\n", "\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("key"); - openapiFields.add("jsonSchema"); - openapiFields.add("version"); - openapiFields.add("createdAt"); - openapiFields.add("updatedAt"); - openapiFields.add("deprecatedAt"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("type"); - openapiRequiredFields.add("jsonSchema"); - openapiRequiredFields.add("version"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to RuleV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!RuleV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in RuleV1 is not found in the empty JSON string", RuleV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RuleV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RuleV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in RuleV1 is not found in the empty JSON" + + " string", + RuleV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!RuleV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RuleV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RuleV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `RuleV1`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : RuleV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RuleV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("key") != null && !jsonObj.get("key").isJsonNull()) + && !jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `key` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("key").toString())); + } + if ((jsonObj.get("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) + && !jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdAt").toString())); + } + 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("deprecatedAt") != null && !jsonObj.get("deprecatedAt").isJsonNull()) + && !jsonObj.get("deprecatedAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `deprecatedAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("deprecatedAt").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("key") != null && !jsonObj.get("key").isJsonNull()) && !jsonObj.get("key").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); - } - if ((jsonObj.get("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) && !jsonObj.get("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - 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("deprecatedAt") != null && !jsonObj.get("deprecatedAt").isJsonNull()) && !jsonObj.get("deprecatedAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `deprecatedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deprecatedAt").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!RuleV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'RuleV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(RuleV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, RuleV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public RuleV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of RuleV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of RuleV1 - * @throws IOException if the JSON string is invalid with respect to RuleV1 - */ - public static RuleV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, RuleV1.class); - } - - /** - * Convert an instance of RuleV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RuleV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RuleV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RuleV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RuleV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RuleV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of RuleV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of RuleV1 + * @throws IOException if the JSON string is invalid with respect to RuleV1 + */ + public static RuleV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RuleV1.class); + } + + /** + * Convert an instance of RuleV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Schedule.java b/src/main/java/com/segment/publicapi/models/Schedule.java deleted file mode 100644 index 4c80792e..00000000 --- a/src/main/java/com/segment/publicapi/models/Schedule.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.WarehouseAdvancedSyncV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The schedule that contains the schedule overrides for the specified Warehouse, if enabled. - */ -@ApiModel(description = "The schedule that contains the schedule overrides for the specified Warehouse, if enabled.") - -public class Schedule { - public static final String SERIALIZED_NAME_TIMES = "times"; - @SerializedName(SERIALIZED_NAME_TIMES) - private List times = null; - - public static final String SERIALIZED_NAME_TIMEZONE = "timezone"; - @SerializedName(SERIALIZED_NAME_TIMEZONE) - private String timezone; - - public Schedule() { - } - - public Schedule times(List times) { - - this.times = times; - return this; - } - - public Schedule addTimesItem(WarehouseAdvancedSyncV1 timesItem) { - if (this.times == null) { - this.times = new ArrayList<>(); - } - this.times.add(timesItem); - return this; - } - - /** - * A list that contains the times when syncs should occur. - * @return times - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A list that contains the times when syncs should occur.") - - public List getTimes() { - return times; - } - - - public void setTimes(List times) { - this.times = times; - } - - - public Schedule timezone(String timezone) { - - this.timezone = timezone; - return this; - } - - /** - * A TZ-database timezone for this sync schedule. - * @return timezone - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A TZ-database timezone for this sync schedule.") - - public String getTimezone() { - return timezone; - } - - - public void setTimezone(String timezone) { - this.timezone = timezone; - } - - - - @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.times, schedule.times) && - Objects.equals(this.timezone, schedule.timezone); - } - - @Override - public int hashCode() { - return Objects.hash(times, timezone); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Schedule {\n"); - sb.append(" times: ").append(toIndentedString(times)).append("\n"); - sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("times"); - openapiFields.add("timezone"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Schedule - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Schedule.openapiRequiredFields.isEmpty()) { // has required fields but JSON object 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 = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (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(), jsonObj.toString())); - } - } - if (jsonObj.get("times") != null && !jsonObj.get("times").isJsonNull()) { - JsonArray jsonArraytimes = jsonObj.getAsJsonArray("times"); - if (jsonArraytimes != null) { - // ensure the json data is an array - if (!jsonObj.get("times").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `times` to be an array in the JSON string but got `%s`", jsonObj.get("times").toString())); - } - } - } - if ((jsonObj.get("timezone") != null && !jsonObj.get("timezone").isJsonNull()) && !jsonObj.get("timezone").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `timezone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timezone").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 { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.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/com/segment/publicapi/models/Schedule1.java b/src/main/java/com/segment/publicapi/models/Schedule1.java deleted file mode 100644 index 9572f3f2..00000000 --- a/src/main/java/com/segment/publicapi/models/Schedule1.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.WarehouseAdvancedSyncV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The full sync schedule for the Warehouse. - */ -@ApiModel(description = "The full sync schedule for the Warehouse.") - -public class Schedule1 { - public static final String SERIALIZED_NAME_TIMES = "times"; - @SerializedName(SERIALIZED_NAME_TIMES) - private List times = new ArrayList<>(); - - public static final String SERIALIZED_NAME_TIMEZONE = "timezone"; - @SerializedName(SERIALIZED_NAME_TIMEZONE) - private String timezone; - - public Schedule1() { - } - - public Schedule1 times(List times) { - - this.times = times; - return this; - } - - public Schedule1 addTimesItem(WarehouseAdvancedSyncV1 timesItem) { - this.times.add(timesItem); - return this; - } - - /** - * A list that contains the times when syncs should occur. - * @return times - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list that contains the times when syncs should occur.") - - public List getTimes() { - return times; - } - - - public void setTimes(List times) { - this.times = times; - } - - - public Schedule1 timezone(String timezone) { - - this.timezone = timezone; - return this; - } - - /** - * A TZ-database timezone for this sync schedule. - * @return timezone - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A TZ-database timezone for this sync schedule.") - - public String getTimezone() { - return timezone; - } - - - public void setTimezone(String timezone) { - this.timezone = timezone; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Schedule1 schedule1 = (Schedule1) o; - return Objects.equals(this.times, schedule1.times) && - Objects.equals(this.timezone, schedule1.timezone); - } - - @Override - public int hashCode() { - return Objects.hash(times, timezone); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Schedule1 {\n"); - sb.append(" times: ").append(toIndentedString(times)).append("\n"); - sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("times"); - openapiFields.add("timezone"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("times"); - openapiRequiredFields.add("timezone"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Schedule1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Schedule1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Schedule1 is not found in the empty JSON string", Schedule1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Schedule1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Schedule1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Schedule1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); - } - } - // ensure the json data is an array - if (!jsonObj.get("times").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `times` to be an array in the JSON string but got `%s`", jsonObj.get("times").toString())); - } - - JsonArray jsonArraytimes = jsonObj.getAsJsonArray("times"); - if (!jsonObj.get("timezone").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `timezone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timezone").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Schedule1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Schedule1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Schedule1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Schedule1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Schedule1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Schedule1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Schedule1 - * @throws IOException if the JSON string is invalid with respect to Schedule1 - */ - public static Schedule1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Schedule1.class); - } - - /** - * Convert an instance of Schedule1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Schedule2.java b/src/main/java/com/segment/publicapi/models/Schedule2.java deleted file mode 100644 index e6d9ad05..00000000 --- a/src/main/java/com/segment/publicapi/models/Schedule2.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.WarehouseAdvancedSyncV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The schedule that contains the overrides for the Warehouse, if enabled. - */ -@ApiModel(description = "The schedule that contains the overrides for the Warehouse, if enabled.") - -public class Schedule2 { - public static final String SERIALIZED_NAME_TIMES = "times"; - @SerializedName(SERIALIZED_NAME_TIMES) - private List times = null; - - public static final String SERIALIZED_NAME_TIMEZONE = "timezone"; - @SerializedName(SERIALIZED_NAME_TIMEZONE) - private String timezone; - - public Schedule2() { - } - - public Schedule2 times(List times) { - - this.times = times; - return this; - } - - public Schedule2 addTimesItem(WarehouseAdvancedSyncV1 timesItem) { - if (this.times == null) { - this.times = new ArrayList<>(); - } - this.times.add(timesItem); - return this; - } - - /** - * A list that contains the times when syncs should occur. - * @return times - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A list that contains the times when syncs should occur.") - - public List getTimes() { - return times; - } - - - public void setTimes(List times) { - this.times = times; - } - - - public Schedule2 timezone(String timezone) { - - this.timezone = timezone; - return this; - } - - /** - * A TZ-database timezone for this sync schedule. - * @return timezone - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A TZ-database timezone for this sync schedule.") - - public String getTimezone() { - return timezone; - } - - - public void setTimezone(String timezone) { - this.timezone = timezone; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Schedule2 schedule2 = (Schedule2) o; - return Objects.equals(this.times, schedule2.times) && - Objects.equals(this.timezone, schedule2.timezone); - } - - @Override - public int hashCode() { - return Objects.hash(times, timezone); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Schedule2 {\n"); - sb.append(" times: ").append(toIndentedString(times)).append("\n"); - sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("times"); - openapiFields.add("timezone"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Schedule2 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Schedule2.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Schedule2 is not found in the empty JSON string", Schedule2.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Schedule2.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Schedule2` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - if (jsonObj.get("times") != null && !jsonObj.get("times").isJsonNull()) { - JsonArray jsonArraytimes = jsonObj.getAsJsonArray("times"); - if (jsonArraytimes != null) { - // ensure the json data is an array - if (!jsonObj.get("times").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `times` to be an array in the JSON string but got `%s`", jsonObj.get("times").toString())); - } - } - } - if ((jsonObj.get("timezone") != null && !jsonObj.get("timezone").isJsonNull()) && !jsonObj.get("timezone").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `timezone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timezone").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Schedule2.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Schedule2' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Schedule2.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Schedule2 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Schedule2 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Schedule2 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Schedule2 - * @throws IOException if the JSON string is invalid with respect to Schedule2 - */ - public static Schedule2 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Schedule2.class); - } - - /** - * Convert an instance of Schedule2 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Settings.java b/src/main/java/com/segment/publicapi/models/Settings.java deleted file mode 100644 index 68356869..00000000 --- a/src/main/java/com/segment/publicapi/models/Settings.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Group; -import com.segment.publicapi.models.Identify; -import com.segment.publicapi.models.Track; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The Source settings. - */ -@ApiModel(description = "The Source settings.") - -public class Settings { - public static final String SERIALIZED_NAME_TRACK = "track"; - @SerializedName(SERIALIZED_NAME_TRACK) - private Track track; - - public static final String SERIALIZED_NAME_IDENTIFY = "identify"; - @SerializedName(SERIALIZED_NAME_IDENTIFY) - private Identify identify; - - public static final String SERIALIZED_NAME_GROUP = "group"; - @SerializedName(SERIALIZED_NAME_GROUP) - private Group group; - - public static final String SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO = "forwardingViolationsTo"; - @SerializedName(SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO) - private String forwardingViolationsTo; - - public static final String SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO = "forwardingBlockedEventsTo"; - @SerializedName(SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO) - private String forwardingBlockedEventsTo; - - public Settings() { - } - - public Settings track(Track track) { - - this.track = track; - return this; - } - - /** - * Get track - * @return track - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public Track getTrack() { - return track; - } - - - public void setTrack(Track track) { - this.track = track; - } - - - public Settings identify(Identify identify) { - - this.identify = identify; - return this; - } - - /** - * Get identify - * @return identify - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public Identify getIdentify() { - return identify; - } - - - public void setIdentify(Identify identify) { - this.identify = identify; - } - - - public Settings group(Group group) { - - this.group = group; - return this; - } - - /** - * Get group - * @return group - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public Group getGroup() { - return group; - } - - - public void setGroup(Group group) { - this.group = group; - } - - - public Settings forwardingViolationsTo(String forwardingViolationsTo) { - - this.forwardingViolationsTo = forwardingViolationsTo; - return this; - } - - /** - * SourceId to forward violations to. - * @return forwardingViolationsTo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "SourceId to forward violations to.") - - public String getForwardingViolationsTo() { - return forwardingViolationsTo; - } - - - public void setForwardingViolationsTo(String forwardingViolationsTo) { - this.forwardingViolationsTo = forwardingViolationsTo; - } - - - public Settings forwardingBlockedEventsTo(String forwardingBlockedEventsTo) { - - this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; - return this; - } - - /** - * SourceId to forward blocked events to. - * @return forwardingBlockedEventsTo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "SourceId to forward blocked events to.") - - public String getForwardingBlockedEventsTo() { - return forwardingBlockedEventsTo; - } - - - public void setForwardingBlockedEventsTo(String forwardingBlockedEventsTo) { - this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Settings settings = (Settings) o; - return Objects.equals(this.track, settings.track) && - Objects.equals(this.identify, settings.identify) && - Objects.equals(this.group, settings.group) && - Objects.equals(this.forwardingViolationsTo, settings.forwardingViolationsTo) && - Objects.equals(this.forwardingBlockedEventsTo, settings.forwardingBlockedEventsTo); - } - - @Override - public int hashCode() { - return Objects.hash(track, identify, group, forwardingViolationsTo, forwardingBlockedEventsTo); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Settings {\n"); - sb.append(" track: ").append(toIndentedString(track)).append("\n"); - sb.append(" identify: ").append(toIndentedString(identify)).append("\n"); - sb.append(" group: ").append(toIndentedString(group)).append("\n"); - sb.append(" forwardingViolationsTo: ").append(toIndentedString(forwardingViolationsTo)).append("\n"); - sb.append(" forwardingBlockedEventsTo: ").append(toIndentedString(forwardingBlockedEventsTo)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("track"); - openapiFields.add("identify"); - openapiFields.add("group"); - openapiFields.add("forwardingViolationsTo"); - openapiFields.add("forwardingBlockedEventsTo"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Settings - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Settings.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Settings is not found in the empty JSON string", Settings.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Settings.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Settings` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - if ((jsonObj.get("forwardingViolationsTo") != null && !jsonObj.get("forwardingViolationsTo").isJsonNull()) && !jsonObj.get("forwardingViolationsTo").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `forwardingViolationsTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("forwardingViolationsTo").toString())); - } - if ((jsonObj.get("forwardingBlockedEventsTo") != null && !jsonObj.get("forwardingBlockedEventsTo").isJsonNull()) && !jsonObj.get("forwardingBlockedEventsTo").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `forwardingBlockedEventsTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("forwardingBlockedEventsTo").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Settings.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Settings' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Settings.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Settings value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Settings read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Settings given an JSON string - * - * @param jsonString JSON string - * @return An instance of Settings - * @throws IOException if the JSON string is invalid with respect to Settings - */ - public static Settings fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Settings.class); - } - - /** - * Convert an instance of Settings to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Settings1.java b/src/main/java/com/segment/publicapi/models/Settings1.java deleted file mode 100644 index c8b40e87..00000000 --- a/src/main/java/com/segment/publicapi/models/Settings1.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Group; -import com.segment.publicapi.models.Identify; -import com.segment.publicapi.models.Track; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The output of Source settings. - */ -@ApiModel(description = "The output of Source settings.") - -public class Settings1 { - public static final String SERIALIZED_NAME_TRACK = "track"; - @SerializedName(SERIALIZED_NAME_TRACK) - private Track track; - - public static final String SERIALIZED_NAME_IDENTIFY = "identify"; - @SerializedName(SERIALIZED_NAME_IDENTIFY) - private Identify identify; - - public static final String SERIALIZED_NAME_GROUP = "group"; - @SerializedName(SERIALIZED_NAME_GROUP) - private Group group; - - public static final String SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO = "forwardingViolationsTo"; - @SerializedName(SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO) - private String forwardingViolationsTo; - - public static final String SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO = "forwardingBlockedEventsTo"; - @SerializedName(SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO) - private String forwardingBlockedEventsTo; - - public Settings1() { - } - - public Settings1 track(Track track) { - - this.track = track; - return this; - } - - /** - * Get track - * @return track - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public Track getTrack() { - return track; - } - - - public void setTrack(Track track) { - this.track = track; - } - - - public Settings1 identify(Identify identify) { - - this.identify = identify; - return this; - } - - /** - * Get identify - * @return identify - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public Identify getIdentify() { - return identify; - } - - - public void setIdentify(Identify identify) { - this.identify = identify; - } - - - public Settings1 group(Group group) { - - this.group = group; - return this; - } - - /** - * Get group - * @return group - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public Group getGroup() { - return group; - } - - - public void setGroup(Group group) { - this.group = group; - } - - - public Settings1 forwardingViolationsTo(String forwardingViolationsTo) { - - this.forwardingViolationsTo = forwardingViolationsTo; - return this; - } - - /** - * SourceId to forward violations to. - * @return forwardingViolationsTo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "SourceId to forward violations to.") - - public String getForwardingViolationsTo() { - return forwardingViolationsTo; - } - - - public void setForwardingViolationsTo(String forwardingViolationsTo) { - this.forwardingViolationsTo = forwardingViolationsTo; - } - - - public Settings1 forwardingBlockedEventsTo(String forwardingBlockedEventsTo) { - - this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; - return this; - } - - /** - * SourceId to forward blocked events to. - * @return forwardingBlockedEventsTo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "SourceId to forward blocked events to.") - - public String getForwardingBlockedEventsTo() { - return forwardingBlockedEventsTo; - } - - - public void setForwardingBlockedEventsTo(String forwardingBlockedEventsTo) { - this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Settings1 settings1 = (Settings1) o; - return Objects.equals(this.track, settings1.track) && - Objects.equals(this.identify, settings1.identify) && - Objects.equals(this.group, settings1.group) && - Objects.equals(this.forwardingViolationsTo, settings1.forwardingViolationsTo) && - Objects.equals(this.forwardingBlockedEventsTo, settings1.forwardingBlockedEventsTo); - } - - @Override - public int hashCode() { - return Objects.hash(track, identify, group, forwardingViolationsTo, forwardingBlockedEventsTo); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Settings1 {\n"); - sb.append(" track: ").append(toIndentedString(track)).append("\n"); - sb.append(" identify: ").append(toIndentedString(identify)).append("\n"); - sb.append(" group: ").append(toIndentedString(group)).append("\n"); - sb.append(" forwardingViolationsTo: ").append(toIndentedString(forwardingViolationsTo)).append("\n"); - sb.append(" forwardingBlockedEventsTo: ").append(toIndentedString(forwardingBlockedEventsTo)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("track"); - openapiFields.add("identify"); - openapiFields.add("group"); - openapiFields.add("forwardingViolationsTo"); - openapiFields.add("forwardingBlockedEventsTo"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Settings1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Settings1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Settings1 is not found in the empty JSON string", Settings1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Settings1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Settings1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - if ((jsonObj.get("forwardingViolationsTo") != null && !jsonObj.get("forwardingViolationsTo").isJsonNull()) && !jsonObj.get("forwardingViolationsTo").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `forwardingViolationsTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("forwardingViolationsTo").toString())); - } - if ((jsonObj.get("forwardingBlockedEventsTo") != null && !jsonObj.get("forwardingBlockedEventsTo").isJsonNull()) && !jsonObj.get("forwardingBlockedEventsTo").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `forwardingBlockedEventsTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("forwardingBlockedEventsTo").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Settings1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Settings1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Settings1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Settings1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Settings1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Settings1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Settings1 - * @throws IOException if the JSON string is invalid with respect to Settings1 - */ - public static Settings1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Settings1.class); - } - - /** - * Convert an instance of Settings1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Source.java b/src/main/java/com/segment/publicapi/models/Source.java deleted file mode 100644 index 6d6a3292..00000000 --- a/src/main/java/com/segment/publicapi/models/Source.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The Source where the events originated. - */ -@ApiModel(description = "The Source where the events originated.") - -public class Source { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public Source() { - } - - public Source id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Source where the events came from. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source where the events came from.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Source name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the Source, if applicable. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Source, if applicable.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Source slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * The slug of the Source, if applicable. - * @return slug - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The slug of the Source, if applicable.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Source source = (Source) o; - return Objects.equals(this.id, source.id) && - Objects.equals(this.name, source.name) && - Objects.equals(this.slug, source.slug); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, slug); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Source {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("slug"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Source - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Source.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Source is not found in the empty JSON string", Source.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Source.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Source` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Source.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Source.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Source' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Source.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Source value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Source read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Source given an JSON string - * - * @param jsonString JSON string - * @return An instance of Source - * @throws IOException if the JSON string is invalid with respect to Source - */ - public static Source fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Source.class); - } - - /** - * Convert an instance of Source to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Source1.java b/src/main/java/com/segment/publicapi/models/Source1.java deleted file mode 100644 index de944415..00000000 --- a/src/main/java/com/segment/publicapi/models/Source1.java +++ /dev/null @@ -1,499 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelV1; -import com.segment.publicapi.models.Metadata1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The returned Source object. - */ -@ApiModel(description = "The returned Source object.") - -public class Source1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata1 metadata; - - public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) - private String workspaceId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_WRITE_KEYS = "writeKeys"; - @SerializedName(SERIALIZED_NAME_WRITE_KEYS) - private List writeKeys = new ArrayList<>(); - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; - - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = new ArrayList<>(); - - public Source1() { - } - - public Source1 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Source. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Source1 slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * The slug used to identify the Source in the Segment app. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug used to identify the Source in the Segment app. Config API note: equal to `name`.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - public Source1 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the Source. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Source. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Source1 metadata(Metadata1 metadata) { - - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Metadata1 getMetadata() { - return metadata; - } - - - public void setMetadata(Metadata1 metadata) { - this.metadata = metadata; - } - - - public Source1 workspaceId(String workspaceId) { - - this.workspaceId = workspaceId; - return this; - } - - /** - * The id of the Workspace that owns the Source. Config API note: equal to `parent`. - * @return workspaceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Workspace that owns the Source. Config API note: equal to `parent`.") - - public String getWorkspaceId() { - return workspaceId; - } - - - public void setWorkspaceId(String workspaceId) { - this.workspaceId = workspaceId; - } - - - public Source1 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Enable to receive data from the Source. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Enable to receive data from the Source.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Source1 writeKeys(List writeKeys) { - - this.writeKeys = writeKeys; - return this; - } - - public Source1 addWriteKeysItem(String writeKeysItem) { - this.writeKeys.add(writeKeysItem); - return this; - } - - /** - * The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission. - * @return writeKeys - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission.") - - public List getWriteKeys() { - return writeKeys; - } - - - public void setWriteKeys(List writeKeys) { - this.writeKeys = writeKeys; - } - - - public Source1 settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The settings associated with the Source. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The settings associated with the Source.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - public Source1 labels(List labels) { - - this.labels = labels; - return this; - } - - public Source1 addLabelsItem(LabelV1 labelsItem) { - this.labels.add(labelsItem); - return this; - } - - /** - * A list of labels applied to the Source. - * @return labels - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of labels applied to the Source.") - - public List getLabels() { - return labels; - } - - - public void setLabels(List labels) { - this.labels = labels; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Source1 source1 = (Source1) o; - return Objects.equals(this.id, source1.id) && - Objects.equals(this.slug, source1.slug) && - Objects.equals(this.name, source1.name) && - Objects.equals(this.metadata, source1.metadata) && - Objects.equals(this.workspaceId, source1.workspaceId) && - Objects.equals(this.enabled, source1.enabled) && - Objects.equals(this.writeKeys, source1.writeKeys) && - Objects.equals(this.settings, source1.settings) && - Objects.equals(this.labels, source1.labels); - } - - @Override - public int hashCode() { - return Objects.hash(id, slug, name, metadata, workspaceId, enabled, writeKeys, settings, labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Source1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" writeKeys: ").append(toIndentedString(writeKeys)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("slug"); - openapiFields.add("name"); - openapiFields.add("metadata"); - openapiFields.add("workspaceId"); - openapiFields.add("enabled"); - openapiFields.add("writeKeys"); - openapiFields.add("settings"); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("workspaceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("writeKeys"); - openapiRequiredFields.add("labels"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Source1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Source1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Source1 is not found in the empty JSON string", Source1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Source1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Source1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Source1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("workspaceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceId").toString())); - } - // ensure the required json array is present - if (jsonObj.get("writeKeys") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("writeKeys").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `writeKeys` to be an array in the JSON string but got `%s`", jsonObj.get("writeKeys").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } - - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Source1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Source1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Source1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Source1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Source1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Source1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Source1 - * @throws IOException if the JSON string is invalid with respect to Source1 - */ - public static Source1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Source1.class); - } - - /** - * Convert an instance of Source1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Source2.java b/src/main/java/com/segment/publicapi/models/Source2.java deleted file mode 100644 index b626d3a7..00000000 --- a/src/main/java/com/segment/publicapi/models/Source2.java +++ /dev/null @@ -1,499 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelV1; -import com.segment.publicapi.models.Metadata1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The newly created Source. - */ -@ApiModel(description = "The newly created Source.") - -public class Source2 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata1 metadata; - - public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) - private String workspaceId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_WRITE_KEYS = "writeKeys"; - @SerializedName(SERIALIZED_NAME_WRITE_KEYS) - private List writeKeys = new ArrayList<>(); - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; - - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = new ArrayList<>(); - - public Source2() { - } - - public Source2 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Source. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Source2 slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * The slug used to identify the Source in the Segment app. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug used to identify the Source in the Segment app. Config API note: equal to `name`.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - public Source2 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the Source. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Source. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Source2 metadata(Metadata1 metadata) { - - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Metadata1 getMetadata() { - return metadata; - } - - - public void setMetadata(Metadata1 metadata) { - this.metadata = metadata; - } - - - public Source2 workspaceId(String workspaceId) { - - this.workspaceId = workspaceId; - return this; - } - - /** - * The id of the Workspace that owns the Source. Config API note: equal to `parent`. - * @return workspaceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Workspace that owns the Source. Config API note: equal to `parent`.") - - public String getWorkspaceId() { - return workspaceId; - } - - - public void setWorkspaceId(String workspaceId) { - this.workspaceId = workspaceId; - } - - - public Source2 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Enable to receive data from the Source. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Enable to receive data from the Source.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Source2 writeKeys(List writeKeys) { - - this.writeKeys = writeKeys; - return this; - } - - public Source2 addWriteKeysItem(String writeKeysItem) { - this.writeKeys.add(writeKeysItem); - return this; - } - - /** - * The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission. - * @return writeKeys - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission.") - - public List getWriteKeys() { - return writeKeys; - } - - - public void setWriteKeys(List writeKeys) { - this.writeKeys = writeKeys; - } - - - public Source2 settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The settings associated with the Source. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The settings associated with the Source.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - public Source2 labels(List labels) { - - this.labels = labels; - return this; - } - - public Source2 addLabelsItem(LabelV1 labelsItem) { - this.labels.add(labelsItem); - return this; - } - - /** - * A list of labels applied to the Source. - * @return labels - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of labels applied to the Source.") - - public List getLabels() { - return labels; - } - - - public void setLabels(List labels) { - this.labels = labels; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Source2 source2 = (Source2) o; - return Objects.equals(this.id, source2.id) && - Objects.equals(this.slug, source2.slug) && - Objects.equals(this.name, source2.name) && - Objects.equals(this.metadata, source2.metadata) && - Objects.equals(this.workspaceId, source2.workspaceId) && - Objects.equals(this.enabled, source2.enabled) && - Objects.equals(this.writeKeys, source2.writeKeys) && - Objects.equals(this.settings, source2.settings) && - Objects.equals(this.labels, source2.labels); - } - - @Override - public int hashCode() { - return Objects.hash(id, slug, name, metadata, workspaceId, enabled, writeKeys, settings, labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Source2 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" writeKeys: ").append(toIndentedString(writeKeys)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("slug"); - openapiFields.add("name"); - openapiFields.add("metadata"); - openapiFields.add("workspaceId"); - openapiFields.add("enabled"); - openapiFields.add("writeKeys"); - openapiFields.add("settings"); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("workspaceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("writeKeys"); - openapiRequiredFields.add("labels"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Source2 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Source2.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Source2 is not found in the empty JSON string", Source2.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Source2.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Source2` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Source2.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("workspaceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceId").toString())); - } - // ensure the required json array is present - if (jsonObj.get("writeKeys") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("writeKeys").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `writeKeys` to be an array in the JSON string but got `%s`", jsonObj.get("writeKeys").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } - - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Source2.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Source2' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Source2.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Source2 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Source2 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Source2 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Source2 - * @throws IOException if the JSON string is invalid with respect to Source2 - */ - public static Source2 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Source2.class); - } - - /** - * Convert an instance of Source2 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Source3.java b/src/main/java/com/segment/publicapi/models/Source3.java deleted file mode 100644 index 1431cfc0..00000000 --- a/src/main/java/com/segment/publicapi/models/Source3.java +++ /dev/null @@ -1,499 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelV1; -import com.segment.publicapi.models.Metadata1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The updated Source. - */ -@ApiModel(description = "The updated Source.") - -public class Source3 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata1 metadata; - - public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) - private String workspaceId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_WRITE_KEYS = "writeKeys"; - @SerializedName(SERIALIZED_NAME_WRITE_KEYS) - private List writeKeys = new ArrayList<>(); - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; - - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = new ArrayList<>(); - - public Source3() { - } - - public Source3 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Source. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Source3 slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * The slug used to identify the Source in the Segment app. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug used to identify the Source in the Segment app. Config API note: equal to `name`.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - public Source3 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the Source. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Source. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Source3 metadata(Metadata1 metadata) { - - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Metadata1 getMetadata() { - return metadata; - } - - - public void setMetadata(Metadata1 metadata) { - this.metadata = metadata; - } - - - public Source3 workspaceId(String workspaceId) { - - this.workspaceId = workspaceId; - return this; - } - - /** - * The id of the Workspace that owns the Source. Config API note: equal to `parent`. - * @return workspaceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Workspace that owns the Source. Config API note: equal to `parent`.") - - public String getWorkspaceId() { - return workspaceId; - } - - - public void setWorkspaceId(String workspaceId) { - this.workspaceId = workspaceId; - } - - - public Source3 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Enable to receive data from the Source. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Enable to receive data from the Source.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Source3 writeKeys(List writeKeys) { - - this.writeKeys = writeKeys; - return this; - } - - public Source3 addWriteKeysItem(String writeKeysItem) { - this.writeKeys.add(writeKeysItem); - return this; - } - - /** - * The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission. - * @return writeKeys - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission.") - - public List getWriteKeys() { - return writeKeys; - } - - - public void setWriteKeys(List writeKeys) { - this.writeKeys = writeKeys; - } - - - public Source3 settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The settings associated with the Source. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The settings associated with the Source.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - public Source3 labels(List labels) { - - this.labels = labels; - return this; - } - - public Source3 addLabelsItem(LabelV1 labelsItem) { - this.labels.add(labelsItem); - return this; - } - - /** - * A list of labels applied to the Source. - * @return labels - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of labels applied to the Source.") - - public List getLabels() { - return labels; - } - - - public void setLabels(List labels) { - this.labels = labels; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Source3 source3 = (Source3) o; - return Objects.equals(this.id, source3.id) && - Objects.equals(this.slug, source3.slug) && - Objects.equals(this.name, source3.name) && - Objects.equals(this.metadata, source3.metadata) && - Objects.equals(this.workspaceId, source3.workspaceId) && - Objects.equals(this.enabled, source3.enabled) && - Objects.equals(this.writeKeys, source3.writeKeys) && - Objects.equals(this.settings, source3.settings) && - Objects.equals(this.labels, source3.labels); - } - - @Override - public int hashCode() { - return Objects.hash(id, slug, name, metadata, workspaceId, enabled, writeKeys, settings, labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Source3 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" writeKeys: ").append(toIndentedString(writeKeys)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("slug"); - openapiFields.add("name"); - openapiFields.add("metadata"); - openapiFields.add("workspaceId"); - openapiFields.add("enabled"); - openapiFields.add("writeKeys"); - openapiFields.add("settings"); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("workspaceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("writeKeys"); - openapiRequiredFields.add("labels"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Source3 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Source3.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Source3 is not found in the empty JSON string", Source3.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Source3.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Source3` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Source3.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("workspaceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceId").toString())); - } - // ensure the required json array is present - if (jsonObj.get("writeKeys") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("writeKeys").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `writeKeys` to be an array in the JSON string but got `%s`", jsonObj.get("writeKeys").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } - - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Source3.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Source3' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Source3.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Source3 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Source3 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Source3 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Source3 - * @throws IOException if the JSON string is invalid with respect to Source3 - */ - public static Source3 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Source3.class); - } - - /** - * Convert an instance of Source3 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Source4.java b/src/main/java/com/segment/publicapi/models/Source4.java deleted file mode 100644 index c0c5212f..00000000 --- a/src/main/java/com/segment/publicapi/models/Source4.java +++ /dev/null @@ -1,499 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelV1; -import com.segment.publicapi.models.Metadata1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The returned Source object. - */ -@ApiModel(description = "The returned Source object.") - -public class Source4 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata1 metadata; - - public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) - private String workspaceId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_WRITE_KEYS = "writeKeys"; - @SerializedName(SERIALIZED_NAME_WRITE_KEYS) - private List writeKeys = new ArrayList<>(); - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; - - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = new ArrayList<>(); - - public Source4() { - } - - public Source4 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Source. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Source4 slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * The slug used to identify the Source in the Segment app. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug used to identify the Source in the Segment app. Config API note: equal to `name`.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - public Source4 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the Source. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Source. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Source4 metadata(Metadata1 metadata) { - - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Metadata1 getMetadata() { - return metadata; - } - - - public void setMetadata(Metadata1 metadata) { - this.metadata = metadata; - } - - - public Source4 workspaceId(String workspaceId) { - - this.workspaceId = workspaceId; - return this; - } - - /** - * The id of the Workspace that owns the Source. Config API note: equal to `parent`. - * @return workspaceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Workspace that owns the Source. Config API note: equal to `parent`.") - - public String getWorkspaceId() { - return workspaceId; - } - - - public void setWorkspaceId(String workspaceId) { - this.workspaceId = workspaceId; - } - - - public Source4 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Enable to receive data from the Source. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Enable to receive data from the Source.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Source4 writeKeys(List writeKeys) { - - this.writeKeys = writeKeys; - return this; - } - - public Source4 addWriteKeysItem(String writeKeysItem) { - this.writeKeys.add(writeKeysItem); - return this; - } - - /** - * The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission. - * @return writeKeys - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission.") - - public List getWriteKeys() { - return writeKeys; - } - - - public void setWriteKeys(List writeKeys) { - this.writeKeys = writeKeys; - } - - - public Source4 settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The settings associated with the Source. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The settings associated with the Source.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - public Source4 labels(List labels) { - - this.labels = labels; - return this; - } - - public Source4 addLabelsItem(LabelV1 labelsItem) { - this.labels.add(labelsItem); - return this; - } - - /** - * A list of labels applied to the Source. - * @return labels - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of labels applied to the Source.") - - public List getLabels() { - return labels; - } - - - public void setLabels(List labels) { - this.labels = labels; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Source4 source4 = (Source4) o; - return Objects.equals(this.id, source4.id) && - Objects.equals(this.slug, source4.slug) && - Objects.equals(this.name, source4.name) && - Objects.equals(this.metadata, source4.metadata) && - Objects.equals(this.workspaceId, source4.workspaceId) && - Objects.equals(this.enabled, source4.enabled) && - Objects.equals(this.writeKeys, source4.writeKeys) && - Objects.equals(this.settings, source4.settings) && - Objects.equals(this.labels, source4.labels); - } - - @Override - public int hashCode() { - return Objects.hash(id, slug, name, metadata, workspaceId, enabled, writeKeys, settings, labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Source4 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" writeKeys: ").append(toIndentedString(writeKeys)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("slug"); - openapiFields.add("name"); - openapiFields.add("metadata"); - openapiFields.add("workspaceId"); - openapiFields.add("enabled"); - openapiFields.add("writeKeys"); - openapiFields.add("settings"); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("workspaceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("writeKeys"); - openapiRequiredFields.add("labels"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Source4 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Source4.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Source4 is not found in the empty JSON string", Source4.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Source4.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Source4` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Source4.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("workspaceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceId").toString())); - } - // ensure the required json array is present - if (jsonObj.get("writeKeys") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("writeKeys").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `writeKeys` to be an array in the JSON string but got `%s`", jsonObj.get("writeKeys").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } - - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Source4.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Source4' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Source4.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Source4 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Source4 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Source4 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Source4 - * @throws IOException if the JSON string is invalid with respect to Source4 - */ - public static Source4 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Source4.class); - } - - /** - * Convert an instance of Source4 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Source5.java b/src/main/java/com/segment/publicapi/models/Source5.java deleted file mode 100644 index fa549078..00000000 --- a/src/main/java/com/segment/publicapi/models/Source5.java +++ /dev/null @@ -1,499 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelV1; -import com.segment.publicapi.models.Metadata1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The newly created Source. - */ -@ApiModel(description = "The newly created Source.") - -public class Source5 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata1 metadata; - - public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) - private String workspaceId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_WRITE_KEYS = "writeKeys"; - @SerializedName(SERIALIZED_NAME_WRITE_KEYS) - private List writeKeys = new ArrayList<>(); - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; - - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = new ArrayList<>(); - - public Source5() { - } - - public Source5 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Source. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Source5 slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * The slug used to identify the Source in the Segment app. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug used to identify the Source in the Segment app. Config API note: equal to `name`.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - public Source5 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the Source. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Source. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Source5 metadata(Metadata1 metadata) { - - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Metadata1 getMetadata() { - return metadata; - } - - - public void setMetadata(Metadata1 metadata) { - this.metadata = metadata; - } - - - public Source5 workspaceId(String workspaceId) { - - this.workspaceId = workspaceId; - return this; - } - - /** - * The id of the Workspace that owns the Source. Config API note: equal to `parent`. - * @return workspaceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Workspace that owns the Source. Config API note: equal to `parent`.") - - public String getWorkspaceId() { - return workspaceId; - } - - - public void setWorkspaceId(String workspaceId) { - this.workspaceId = workspaceId; - } - - - public Source5 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Enable to receive data from the Source. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Enable to receive data from the Source.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Source5 writeKeys(List writeKeys) { - - this.writeKeys = writeKeys; - return this; - } - - public Source5 addWriteKeysItem(String writeKeysItem) { - this.writeKeys.add(writeKeysItem); - return this; - } - - /** - * The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission. - * @return writeKeys - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission.") - - public List getWriteKeys() { - return writeKeys; - } - - - public void setWriteKeys(List writeKeys) { - this.writeKeys = writeKeys; - } - - - public Source5 settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The settings associated with the Source. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The settings associated with the Source.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - public Source5 labels(List labels) { - - this.labels = labels; - return this; - } - - public Source5 addLabelsItem(LabelV1 labelsItem) { - this.labels.add(labelsItem); - return this; - } - - /** - * A list of labels applied to the Source. - * @return labels - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of labels applied to the Source.") - - public List getLabels() { - return labels; - } - - - public void setLabels(List labels) { - this.labels = labels; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Source5 source5 = (Source5) o; - return Objects.equals(this.id, source5.id) && - Objects.equals(this.slug, source5.slug) && - Objects.equals(this.name, source5.name) && - Objects.equals(this.metadata, source5.metadata) && - Objects.equals(this.workspaceId, source5.workspaceId) && - Objects.equals(this.enabled, source5.enabled) && - Objects.equals(this.writeKeys, source5.writeKeys) && - Objects.equals(this.settings, source5.settings) && - Objects.equals(this.labels, source5.labels); - } - - @Override - public int hashCode() { - return Objects.hash(id, slug, name, metadata, workspaceId, enabled, writeKeys, settings, labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Source5 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" writeKeys: ").append(toIndentedString(writeKeys)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("slug"); - openapiFields.add("name"); - openapiFields.add("metadata"); - openapiFields.add("workspaceId"); - openapiFields.add("enabled"); - openapiFields.add("writeKeys"); - openapiFields.add("settings"); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("workspaceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("writeKeys"); - openapiRequiredFields.add("labels"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Source5 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Source5.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Source5 is not found in the empty JSON string", Source5.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Source5.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Source5` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Source5.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("workspaceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceId").toString())); - } - // ensure the required json array is present - if (jsonObj.get("writeKeys") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("writeKeys").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `writeKeys` to be an array in the JSON string but got `%s`", jsonObj.get("writeKeys").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } - - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Source5.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Source5' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Source5.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Source5 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Source5 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Source5 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Source5 - * @throws IOException if the JSON string is invalid with respect to Source5 - */ - public static Source5 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Source5.class); - } - - /** - * Convert an instance of Source5 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Source6.java b/src/main/java/com/segment/publicapi/models/Source6.java deleted file mode 100644 index 87566c71..00000000 --- a/src/main/java/com/segment/publicapi/models/Source6.java +++ /dev/null @@ -1,499 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelV1; -import com.segment.publicapi.models.Metadata1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The updated Source. - */ -@ApiModel(description = "The updated Source.") - -public class Source6 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata1 metadata; - - public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) - private String workspaceId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_WRITE_KEYS = "writeKeys"; - @SerializedName(SERIALIZED_NAME_WRITE_KEYS) - private List writeKeys = new ArrayList<>(); - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; - - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = new ArrayList<>(); - - public Source6() { - } - - public Source6 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Source. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Source6 slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * The slug used to identify the Source in the Segment app. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug used to identify the Source in the Segment app. Config API note: equal to `name`.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - public Source6 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the Source. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Source. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Source6 metadata(Metadata1 metadata) { - - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Metadata1 getMetadata() { - return metadata; - } - - - public void setMetadata(Metadata1 metadata) { - this.metadata = metadata; - } - - - public Source6 workspaceId(String workspaceId) { - - this.workspaceId = workspaceId; - return this; - } - - /** - * The id of the Workspace that owns the Source. Config API note: equal to `parent`. - * @return workspaceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Workspace that owns the Source. Config API note: equal to `parent`.") - - public String getWorkspaceId() { - return workspaceId; - } - - - public void setWorkspaceId(String workspaceId) { - this.workspaceId = workspaceId; - } - - - public Source6 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Enable to receive data from the Source. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Enable to receive data from the Source.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Source6 writeKeys(List writeKeys) { - - this.writeKeys = writeKeys; - return this; - } - - public Source6 addWriteKeysItem(String writeKeysItem) { - this.writeKeys.add(writeKeysItem); - return this; - } - - /** - * The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission. - * @return writeKeys - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission.") - - public List getWriteKeys() { - return writeKeys; - } - - - public void setWriteKeys(List writeKeys) { - this.writeKeys = writeKeys; - } - - - public Source6 settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The settings associated with the Source. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The settings associated with the Source.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - public Source6 labels(List labels) { - - this.labels = labels; - return this; - } - - public Source6 addLabelsItem(LabelV1 labelsItem) { - this.labels.add(labelsItem); - return this; - } - - /** - * A list of labels applied to the Source. - * @return labels - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of labels applied to the Source.") - - public List getLabels() { - return labels; - } - - - public void setLabels(List labels) { - this.labels = labels; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Source6 source6 = (Source6) o; - return Objects.equals(this.id, source6.id) && - Objects.equals(this.slug, source6.slug) && - Objects.equals(this.name, source6.name) && - Objects.equals(this.metadata, source6.metadata) && - Objects.equals(this.workspaceId, source6.workspaceId) && - Objects.equals(this.enabled, source6.enabled) && - Objects.equals(this.writeKeys, source6.writeKeys) && - Objects.equals(this.settings, source6.settings) && - Objects.equals(this.labels, source6.labels); - } - - @Override - public int hashCode() { - return Objects.hash(id, slug, name, metadata, workspaceId, enabled, writeKeys, settings, labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Source6 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" writeKeys: ").append(toIndentedString(writeKeys)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("slug"); - openapiFields.add("name"); - openapiFields.add("metadata"); - openapiFields.add("workspaceId"); - openapiFields.add("enabled"); - openapiFields.add("writeKeys"); - openapiFields.add("settings"); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("workspaceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("writeKeys"); - openapiRequiredFields.add("labels"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Source6 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Source6.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Source6 is not found in the empty JSON string", Source6.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Source6.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Source6` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Source6.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("workspaceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceId").toString())); - } - // ensure the required json array is present - if (jsonObj.get("writeKeys") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("writeKeys").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `writeKeys` to be an array in the JSON string but got `%s`", jsonObj.get("writeKeys").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } - - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Source6.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Source6' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Source6.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Source6 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Source6 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Source6 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Source6 - * @throws IOException if the JSON string is invalid with respect to Source6 - */ - public static Source6 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Source6.class); - } - - /** - * Convert an instance of Source6 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/SourceAPICallSnapshotV1.java b/src/main/java/com/segment/publicapi/models/SourceAPICallSnapshotV1.java index 30fc2d50..1fe7917f 100644 --- a/src/main/java/com/segment/publicapi/models/SourceAPICallSnapshotV1.java +++ b/src/main/java/com/segment/publicapi/models/SourceAPICallSnapshotV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,276 +9,272 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * A snapshot of the number of API calls for a given Source in a Workspace. - */ -@ApiModel(description = "A snapshot of the number of API calls for a given Source in a Workspace.") - +/** A snapshot of the number of API calls for a given Source in a Workspace. */ public class SourceAPICallSnapshotV1 { - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_API_CALLS = "apiCalls"; - @SerializedName(SERIALIZED_NAME_API_CALLS) - private String apiCalls; + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; - @SerializedName(SERIALIZED_NAME_TIMESTAMP) - private String timestamp; + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; - public SourceAPICallSnapshotV1() { - } + public static final String SERIALIZED_NAME_API_CALLS = "apiCalls"; - public SourceAPICallSnapshotV1 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + @SerializedName(SERIALIZED_NAME_API_CALLS) + private String apiCalls; - /** - * The Source id. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source id.") + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; - public String getSourceId() { - return sourceId; - } + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + private String timestamp; + public SourceAPICallSnapshotV1() {} - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + public SourceAPICallSnapshotV1 sourceId(String sourceId) { + this.sourceId = sourceId; + return this; + } - public SourceAPICallSnapshotV1 apiCalls(String apiCalls) { - - this.apiCalls = apiCalls; - return this; - } - - /** - * A bigint of the number of API calls in this snapshot. - * @return apiCalls - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A bigint of the number of API calls in this snapshot.") + /** + * The Source id. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } - public String getApiCalls() { - return apiCalls; - } + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + public SourceAPICallSnapshotV1 apiCalls(String apiCalls) { - public void setApiCalls(String apiCalls) { - this.apiCalls = apiCalls; - } + this.apiCalls = apiCalls; + return this; + } + /** + * A bigint of the number of API calls in this snapshot. + * + * @return apiCalls + */ + @javax.annotation.Nonnull + public String getApiCalls() { + return apiCalls; + } - public SourceAPICallSnapshotV1 timestamp(String timestamp) { - - this.timestamp = timestamp; - return this; - } + public void setApiCalls(String apiCalls) { + this.apiCalls = apiCalls; + } - /** - * Timestamp of this snapshot within the billing cycle in the ISO-8601 format. - * @return timestamp - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Timestamp of this snapshot within the billing cycle in the ISO-8601 format.") + public SourceAPICallSnapshotV1 timestamp(String timestamp) { - public String getTimestamp() { - return timestamp; - } + this.timestamp = timestamp; + return this; + } + /** + * Timestamp of this snapshot within the billing cycle in the ISO-8601 format. + * + * @return timestamp + */ + @javax.annotation.Nonnull + public String getTimestamp() { + return timestamp; + } - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SourceAPICallSnapshotV1 sourceAPICallSnapshotV1 = (SourceAPICallSnapshotV1) o; + return Objects.equals(this.sourceId, sourceAPICallSnapshotV1.sourceId) + && Objects.equals(this.apiCalls, sourceAPICallSnapshotV1.apiCalls) + && Objects.equals(this.timestamp, sourceAPICallSnapshotV1.timestamp); + } + @Override + public int hashCode() { + return Objects.hash(sourceId, apiCalls, timestamp); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SourceAPICallSnapshotV1 {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" apiCalls: ").append(toIndentedString(apiCalls)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - SourceAPICallSnapshotV1 sourceAPICallSnapshotV1 = (SourceAPICallSnapshotV1) o; - return Objects.equals(this.sourceId, sourceAPICallSnapshotV1.sourceId) && - Objects.equals(this.apiCalls, sourceAPICallSnapshotV1.apiCalls) && - Objects.equals(this.timestamp, sourceAPICallSnapshotV1.timestamp); - } - - @Override - public int hashCode() { - return Objects.hash(sourceId, apiCalls, timestamp); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SourceAPICallSnapshotV1 {\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" apiCalls: ").append(toIndentedString(apiCalls)).append("\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + openapiFields.add("apiCalls"); + openapiFields.add("timestamp"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("apiCalls"); + openapiRequiredFields.add("timestamp"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourceId"); - openapiFields.add("apiCalls"); - openapiFields.add("timestamp"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("apiCalls"); - openapiRequiredFields.add("timestamp"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SourceAPICallSnapshotV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SourceAPICallSnapshotV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SourceAPICallSnapshotV1 is not found in the empty JSON string", SourceAPICallSnapshotV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SourceAPICallSnapshotV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SourceAPICallSnapshotV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SourceAPICallSnapshotV1 is not found" + + " in the empty JSON string", + SourceAPICallSnapshotV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SourceAPICallSnapshotV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SourceAPICallSnapshotV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SourceAPICallSnapshotV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SourceAPICallSnapshotV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SourceAPICallSnapshotV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SourceAPICallSnapshotV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if (!jsonObj.get("apiCalls").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `apiCalls` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("apiCalls").toString())); + } + if (!jsonObj.get("timestamp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `timestamp` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("timestamp").toString())); } - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("apiCalls").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `apiCalls` to be a primitive type in the JSON string but got `%s`", jsonObj.get("apiCalls").toString())); - } - if (!jsonObj.get("timestamp").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `timestamp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timestamp").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SourceAPICallSnapshotV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SourceAPICallSnapshotV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SourceAPICallSnapshotV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SourceAPICallSnapshotV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SourceAPICallSnapshotV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of SourceAPICallSnapshotV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of SourceAPICallSnapshotV1 - * @throws IOException if the JSON string is invalid with respect to SourceAPICallSnapshotV1 - */ - public static SourceAPICallSnapshotV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SourceAPICallSnapshotV1.class); - } - - /** - * Convert an instance of SourceAPICallSnapshotV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SourceAPICallSnapshotV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SourceAPICallSnapshotV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SourceAPICallSnapshotV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SourceAPICallSnapshotV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SourceAPICallSnapshotV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SourceAPICallSnapshotV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SourceAPICallSnapshotV1 + * @throws IOException if the JSON string is invalid with respect to SourceAPICallSnapshotV1 + */ + public static SourceAPICallSnapshotV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SourceAPICallSnapshotV1.class); + } + + /** + * Convert an instance of SourceAPICallSnapshotV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/SourceAlpha.java b/src/main/java/com/segment/publicapi/models/SourceAlpha.java index f30ba353..b1f85ddd 100644 --- a/src/main/java/com/segment/publicapi/models/SourceAlpha.java +++ b/src/main/java/com/segment/publicapi/models/SourceAlpha.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,490 +9,511 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelV1; -import com.segment.publicapi.models.Metadata1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Defines a data Source for Segment data. */ +public class SourceAlpha { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * Defines a data Source for Segment data. - */ -@ApiModel(description = "Defines a data Source for Segment data.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class SourceAlpha { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + public static final String SERIALIZED_NAME_SLUG = "slug"; + + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata1 metadata; + public static final String SERIALIZED_NAME_METADATA = "metadata"; - public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) - private String workspaceId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_WRITE_KEYS = "writeKeys"; - @SerializedName(SERIALIZED_NAME_WRITE_KEYS) - private List writeKeys = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_METADATA) + private SourceMetadataV1 metadata; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; + public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) + private String workspaceId; - public SourceAlpha() { - } + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public SourceAlpha id(String id) { - - this.id = id; - return this; - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - /** - * The id of the Source. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source. Config API note: analogous to `name`.") + public static final String SERIALIZED_NAME_WRITE_KEYS = "writeKeys"; - public String getId() { - return id; - } + @SerializedName(SERIALIZED_NAME_WRITE_KEYS) + private List writeKeys = new ArrayList<>(); + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - public void setId(String id) { - this.id = id; - } + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; + public static final String SERIALIZED_NAME_LABELS = "labels"; - public SourceAlpha slug(String slug) { - - this.slug = slug; - return this; - } + @SerializedName(SERIALIZED_NAME_LABELS) + private List labels = new ArrayList<>(); - /** - * The slug used to identify the Source in the Segment app. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug used to identify the Source in the Segment app. Config API note: equal to `name`.") + public SourceAlpha() {} - public String getSlug() { - return slug; - } + public SourceAlpha id(String id) { + this.id = id; + return this; + } - public void setSlug(String slug) { - this.slug = slug; - } + /** + * The id of the Source. Config API note: analogous to `name`. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } - public SourceAlpha name(String name) { - - this.name = name; - return this; - } + public SourceAlpha slug(String slug) { - /** - * The name of the Source. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Source. Config API note: equal to `displayName`.") + this.slug = slug; + return this; + } - public String getName() { - return name; - } + /** + * The slug used to identify the Source in the Segment app. Config API note: equal to + * `name`. + * + * @return slug + */ + @javax.annotation.Nonnull + public String getSlug() { + return slug; + } + public void setSlug(String slug) { + this.slug = slug; + } - public void setName(String name) { - this.name = name; - } + public SourceAlpha name(String name) { + this.name = name; + return this; + } - public SourceAlpha metadata(Metadata1 metadata) { - - this.metadata = metadata; - return this; - } + /** + * The name of the Source. Config API note: equal to `displayName`. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public void setName(String name) { + this.name = name; + } - public Metadata1 getMetadata() { - return metadata; - } + public SourceAlpha metadata(SourceMetadataV1 metadata) { + this.metadata = metadata; + return this; + } - public void setMetadata(Metadata1 metadata) { - this.metadata = metadata; - } + /** + * Get metadata + * + * @return metadata + */ + @javax.annotation.Nonnull + public SourceMetadataV1 getMetadata() { + return metadata; + } + public void setMetadata(SourceMetadataV1 metadata) { + this.metadata = metadata; + } - public SourceAlpha workspaceId(String workspaceId) { - - this.workspaceId = workspaceId; - return this; - } + public SourceAlpha workspaceId(String workspaceId) { - /** - * The id of the Workspace that owns the Source. Config API note: equal to `parent`. - * @return workspaceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Workspace that owns the Source. Config API note: equal to `parent`.") + this.workspaceId = workspaceId; + return this; + } - public String getWorkspaceId() { - return workspaceId; - } + /** + * The id of the Workspace that owns the Source. Config API note: equal to `parent`. + * + * @return workspaceId + */ + @javax.annotation.Nonnull + public String getWorkspaceId() { + return workspaceId; + } + + public void setWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + } + public SourceAlpha enabled(Boolean enabled) { - public void setWorkspaceId(String workspaceId) { - this.workspaceId = workspaceId; - } + this.enabled = enabled; + return this; + } + + /** + * Enable to receive data from the Source. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public SourceAlpha enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public SourceAlpha writeKeys(List writeKeys) { - /** - * Enable to receive data from the Source. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Enable to receive data from the Source.") + this.writeKeys = writeKeys; + return this; + } - public Boolean getEnabled() { - return enabled; - } + public SourceAlpha addWriteKeysItem(String writeKeysItem) { + if (this.writeKeys == null) { + this.writeKeys = new ArrayList<>(); + } + this.writeKeys.add(writeKeysItem); + return this; + } + /** + * The write keys used to send data from the Source. This field is left empty when the current + * token does not have the 'source admin' permission. + * + * @return writeKeys + */ + @javax.annotation.Nonnull + public List getWriteKeys() { + return writeKeys; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public void setWriteKeys(List writeKeys) { + this.writeKeys = writeKeys; + } + public SourceAlpha settings(Map settings) { - public SourceAlpha writeKeys(List writeKeys) { - - this.writeKeys = writeKeys; - return this; - } + this.settings = settings; + return this; + } - public SourceAlpha addWriteKeysItem(String writeKeysItem) { - this.writeKeys.add(writeKeysItem); - return this; - } - - /** - * The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission. - * @return writeKeys - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission.") - - public List getWriteKeys() { - return writeKeys; - } - - - public void setWriteKeys(List writeKeys) { - this.writeKeys = writeKeys; - } - - - public SourceAlpha settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The settings associated with the Source. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The settings associated with the Source.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - public SourceAlpha labels(List labels) { - - this.labels = labels; - return this; - } - - public SourceAlpha addLabelsItem(LabelV1 labelsItem) { - this.labels.add(labelsItem); - return this; - } - - /** - * A list of labels applied to the Source. - * @return labels - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of labels applied to the Source.") - - public List getLabels() { - return labels; - } - - - public void setLabels(List labels) { - this.labels = labels; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SourceAlpha sourceAlpha = (SourceAlpha) o; - return Objects.equals(this.id, sourceAlpha.id) && - Objects.equals(this.slug, sourceAlpha.slug) && - Objects.equals(this.name, sourceAlpha.name) && - Objects.equals(this.metadata, sourceAlpha.metadata) && - Objects.equals(this.workspaceId, sourceAlpha.workspaceId) && - Objects.equals(this.enabled, sourceAlpha.enabled) && - Objects.equals(this.writeKeys, sourceAlpha.writeKeys) && - Objects.equals(this.settings, sourceAlpha.settings) && - Objects.equals(this.labels, sourceAlpha.labels); - } - - @Override - public int hashCode() { - return Objects.hash(id, slug, name, metadata, workspaceId, enabled, writeKeys, settings, labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SourceAlpha {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" writeKeys: ").append(toIndentedString(writeKeys)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("slug"); - openapiFields.add("name"); - openapiFields.add("metadata"); - openapiFields.add("workspaceId"); - openapiFields.add("enabled"); - openapiFields.add("writeKeys"); - openapiFields.add("settings"); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("workspaceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("writeKeys"); - openapiRequiredFields.add("labels"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SourceAlpha - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SourceAlpha.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SourceAlpha is not found in the empty JSON string", SourceAlpha.openapiRequiredFields.toString())); + public SourceAlpha putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); } - } + this.settings.put(key, settingsItem); + return this; + } + + /** + * A key-value object that contains instance-specific settings for a Source. The + * `options` field in the Source metadata defines the schema of this object. + * + * @return settings + */ + @javax.annotation.Nullable + public Map getSettings() { + return settings; + } + + public void setSettings(Map settings) { + this.settings = settings; + } + + public SourceAlpha labels(List labels) { - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SourceAlpha.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SourceAlpha` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + this.labels = labels; + return this; + } + + public SourceAlpha addLabelsItem(LabelV1 labelsItem) { + if (this.labels == null) { + this.labels = new ArrayList<>(); } - } + this.labels.add(labelsItem); + return this; + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SourceAlpha.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + /** + * A list of labels applied to the Source. + * + * @return labels + */ + @javax.annotation.Nonnull + public List getLabels() { + return labels; + } + + public void setLabels(List labels) { + this.labels = labels; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } - } - 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("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("workspaceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceId").toString())); - } - // ensure the required json array is present - if (jsonObj.get("writeKeys") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("writeKeys").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `writeKeys` to be an array in the JSON string but got `%s`", jsonObj.get("writeKeys").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } - - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") + SourceAlpha sourceAlpha = (SourceAlpha) o; + return Objects.equals(this.id, sourceAlpha.id) + && Objects.equals(this.slug, sourceAlpha.slug) + && Objects.equals(this.name, sourceAlpha.name) + && Objects.equals(this.metadata, sourceAlpha.metadata) + && Objects.equals(this.workspaceId, sourceAlpha.workspaceId) + && Objects.equals(this.enabled, sourceAlpha.enabled) + && Objects.equals(this.writeKeys, sourceAlpha.writeKeys) + && Objects.equals(this.settings, sourceAlpha.settings) + && Objects.equals(this.labels, sourceAlpha.labels); + } + @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SourceAlpha.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SourceAlpha' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SourceAlpha.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SourceAlpha value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SourceAlpha read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of SourceAlpha given an JSON string - * - * @param jsonString JSON string - * @return An instance of SourceAlpha - * @throws IOException if the JSON string is invalid with respect to SourceAlpha - */ - public static SourceAlpha fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SourceAlpha.class); - } - - /** - * Convert an instance of SourceAlpha to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public int hashCode() { + return Objects.hash( + id, slug, name, metadata, workspaceId, enabled, writeKeys, settings, labels); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SourceAlpha {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" writeKeys: ").append(toIndentedString(writeKeys)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("slug"); + openapiFields.add("name"); + openapiFields.add("metadata"); + openapiFields.add("workspaceId"); + openapiFields.add("enabled"); + openapiFields.add("writeKeys"); + openapiFields.add("settings"); + openapiFields.add("labels"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("slug"); + openapiRequiredFields.add("metadata"); + openapiRequiredFields.add("workspaceId"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("writeKeys"); + openapiRequiredFields.add("labels"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SourceAlpha + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SourceAlpha.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SourceAlpha is not found in the empty" + + " JSON string", + SourceAlpha.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SourceAlpha.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SourceAlpha` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SourceAlpha.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").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 required field `metadata` + SourceMetadataV1.validateJsonElement(jsonObj.get("metadata")); + if (!jsonObj.get("workspaceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `workspaceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("workspaceId").toString())); + } + // ensure the required json array is present + if (jsonObj.get("writeKeys") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("writeKeys").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `writeKeys` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("writeKeys").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("labels").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `labels` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("labels").toString())); + } + + JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); + // validate the required field `labels` (array) + for (int i = 0; i < jsonArraylabels.size(); i++) { + LabelV1.validateJsonElement(jsonArraylabels.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SourceAlpha.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SourceAlpha' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SourceAlpha.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SourceAlpha value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SourceAlpha read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SourceAlpha given an JSON string + * + * @param jsonString JSON string + * @return An instance of SourceAlpha + * @throws IOException if the JSON string is invalid with respect to SourceAlpha + */ + public static SourceAlpha fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SourceAlpha.class); + } + + /** + * Convert an instance of SourceAlpha to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/SourceEventVolumeDatapointV1.java b/src/main/java/com/segment/publicapi/models/SourceEventVolumeDatapointV1.java index dfb249f1..9023904a 100644 --- a/src/main/java/com/segment/publicapi/models/SourceEventVolumeDatapointV1.java +++ b/src/main/java/com/segment/publicapi/models/SourceEventVolumeDatapointV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,240 +9,239 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - /** - * SourceEventVolumeDatapoint represents an individual timestamp/event count pair corresponding to a window of time designated by the granularity. + * SourceEventVolumeDatapoint represents an individual timestamp/event count pair corresponding to a + * window of time designated by the granularity. */ -@ApiModel(description = "SourceEventVolumeDatapoint represents an individual timestamp/event count pair corresponding to a window of time designated by the granularity.") - public class SourceEventVolumeDatapointV1 { - public static final String SERIALIZED_NAME_TIME = "time"; - @SerializedName(SERIALIZED_NAME_TIME) - private String time; + public static final String SERIALIZED_NAME_TIME = "time"; - public static final String SERIALIZED_NAME_COUNT = "count"; - @SerializedName(SERIALIZED_NAME_COUNT) - private BigDecimal count; + @SerializedName(SERIALIZED_NAME_TIME) + private String time; - public SourceEventVolumeDatapointV1() { - } + public static final String SERIALIZED_NAME_COUNT = "count"; - public SourceEventVolumeDatapointV1 time(String time) { - - this.time = time; - return this; - } + @SerializedName(SERIALIZED_NAME_COUNT) + private BigDecimal count; - /** - * The timestamp that corresponds to the beginning of the window given by the requested granularity. - * @return time - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The timestamp that corresponds to the beginning of the window given by the requested granularity.") + public SourceEventVolumeDatapointV1() {} - public String getTime() { - return time; - } + public SourceEventVolumeDatapointV1 time(String time) { + this.time = time; + return this; + } - public void setTime(String time) { - this.time = time; - } - + /** + * The timestamp that corresponds to the beginning of the window given by the requested + * granularity. + * + * @return time + */ + @javax.annotation.Nonnull + public String getTime() { + return time; + } - public SourceEventVolumeDatapointV1 count(BigDecimal count) { - - this.count = count; - return this; - } + public void setTime(String time) { + this.time = time; + } - /** - * The number of valid events Segment received in the given window, after the events completed the validation process. - * @return count - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The number of valid events Segment received in the given window, after the events completed the validation process.") + public SourceEventVolumeDatapointV1 count(BigDecimal count) { - public BigDecimal getCount() { - return count; - } + this.count = count; + return this; + } + /** + * The number of valid events Segment received in the given window, after the events completed + * the validation process. + * + * @return count + */ + @javax.annotation.Nonnull + public BigDecimal getCount() { + return count; + } - public void setCount(BigDecimal count) { - this.count = count; - } + public void setCount(BigDecimal count) { + this.count = count; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SourceEventVolumeDatapointV1 sourceEventVolumeDatapointV1 = + (SourceEventVolumeDatapointV1) o; + return Objects.equals(this.time, sourceEventVolumeDatapointV1.time) + && Objects.equals(this.count, sourceEventVolumeDatapointV1.count); + } + @Override + public int hashCode() { + return Objects.hash(time, count); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SourceEventVolumeDatapointV1 {\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - SourceEventVolumeDatapointV1 sourceEventVolumeDatapointV1 = (SourceEventVolumeDatapointV1) o; - return Objects.equals(this.time, sourceEventVolumeDatapointV1.time) && - Objects.equals(this.count, sourceEventVolumeDatapointV1.count); - } - - @Override - public int hashCode() { - return Objects.hash(time, count); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SourceEventVolumeDatapointV1 {\n"); - sb.append(" time: ").append(toIndentedString(time)).append("\n"); - sb.append(" count: ").append(toIndentedString(count)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("time"); + openapiFields.add("count"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("count"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("time"); - openapiFields.add("count"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("time"); - openapiRequiredFields.add("count"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SourceEventVolumeDatapointV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SourceEventVolumeDatapointV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SourceEventVolumeDatapointV1 is not found in the empty JSON string", SourceEventVolumeDatapointV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * SourceEventVolumeDatapointV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SourceEventVolumeDatapointV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SourceEventVolumeDatapointV1 is not" + + " found in the empty JSON string", + SourceEventVolumeDatapointV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SourceEventVolumeDatapointV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SourceEventVolumeDatapointV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SourceEventVolumeDatapointV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SourceEventVolumeDatapointV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SourceEventVolumeDatapointV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SourceEventVolumeDatapointV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("time").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `time` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("time").toString())); } - } - if (!jsonObj.get("time").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `time` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SourceEventVolumeDatapointV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SourceEventVolumeDatapointV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SourceEventVolumeDatapointV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SourceEventVolumeDatapointV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SourceEventVolumeDatapointV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of SourceEventVolumeDatapointV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of SourceEventVolumeDatapointV1 - * @throws IOException if the JSON string is invalid with respect to SourceEventVolumeDatapointV1 - */ - public static SourceEventVolumeDatapointV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SourceEventVolumeDatapointV1.class); - } - - /** - * Convert an instance of SourceEventVolumeDatapointV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SourceEventVolumeDatapointV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SourceEventVolumeDatapointV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(SourceEventVolumeDatapointV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SourceEventVolumeDatapointV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SourceEventVolumeDatapointV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SourceEventVolumeDatapointV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SourceEventVolumeDatapointV1 + * @throws IOException if the JSON string is invalid with respect to + * SourceEventVolumeDatapointV1 + */ + public static SourceEventVolumeDatapointV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SourceEventVolumeDatapointV1.class); + } + + /** + * Convert an instance of SourceEventVolumeDatapointV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/SourceEventVolumeV1.java b/src/main/java/com/segment/publicapi/models/SourceEventVolumeV1.java index 5a9ff0a8..ecc0864b 100644 --- a/src/main/java/com/segment/publicapi/models/SourceEventVolumeV1.java +++ b/src/main/java/com/segment/publicapi/models/SourceEventVolumeV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,349 +9,355 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.segment.publicapi.models.Source; -import com.segment.publicapi.models.SourceEventVolumeDatapointV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - /** - * SourceEventVolume represents a time series of event volume for a Workspace broken down by the dimensions which the customer specifies (optional parameters). + * SourceEventVolume represents a time series of event volume for a Workspace broken down by the + * dimensions which the customer specifies (optional parameters). */ -@ApiModel(description = "SourceEventVolume represents a time series of event volume for a Workspace broken down by the dimensions which the customer specifies (optional parameters).") - public class SourceEventVolumeV1 { - public static final String SERIALIZED_NAME_SOURCE = "source"; - @SerializedName(SERIALIZED_NAME_SOURCE) - private Source source; - - public static final String SERIALIZED_NAME_EVENT_NAME = "eventName"; - @SerializedName(SERIALIZED_NAME_EVENT_NAME) - private String eventName; - - public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; - @SerializedName(SERIALIZED_NAME_EVENT_TYPE) - private String eventType; - - public static final String SERIALIZED_NAME_TOTAL = "total"; - @SerializedName(SERIALIZED_NAME_TOTAL) - private BigDecimal total; + public static final String SERIALIZED_NAME_SOURCE = "source"; - public static final String SERIALIZED_NAME_SERIES = "series"; - @SerializedName(SERIALIZED_NAME_SERIES) - private List series = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_SOURCE) + private EventSourceV1 source; - public SourceEventVolumeV1() { - } + public static final String SERIALIZED_NAME_EVENT_NAME = "eventName"; - public SourceEventVolumeV1 source(Source source) { - - this.source = source; - return this; - } + @SerializedName(SERIALIZED_NAME_EVENT_NAME) + private String eventName; - /** - * Get source - * @return source - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Source getSource() { - return source; - } + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; - public void setSource(Source source) { - this.source = source; - } + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + private BigDecimal total; - public SourceEventVolumeV1 eventName(String eventName) { - - this.eventName = eventName; - return this; - } + public static final String SERIALIZED_NAME_SERIES = "series"; - /** - * The name of the event, if applicable. - * @return eventName - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the event, if applicable.") + @SerializedName(SERIALIZED_NAME_SERIES) + private List series = new ArrayList<>(); - public String getEventName() { - return eventName; - } + public SourceEventVolumeV1() {} + public SourceEventVolumeV1 source(EventSourceV1 source) { - public void setEventName(String eventName) { - this.eventName = eventName; - } + this.source = source; + return this; + } + /** + * Get source + * + * @return source + */ + @javax.annotation.Nullable + public EventSourceV1 getSource() { + return source; + } - public SourceEventVolumeV1 eventType(String eventType) { - - this.eventType = eventType; - return this; - } + public void setSource(EventSourceV1 source) { + this.source = source; + } - /** - * The event type, if applicable. - * @return eventType - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The event type, if applicable.") + public SourceEventVolumeV1 eventName(String eventName) { - public String getEventType() { - return eventType; - } + this.eventName = eventName; + return this; + } + /** + * The name of the event, if applicable. + * + * @return eventName + */ + @javax.annotation.Nullable + public String getEventName() { + return eventName; + } - public void setEventType(String eventType) { - this.eventType = eventType; - } + public void setEventName(String eventName) { + this.eventName = eventName; + } + public SourceEventVolumeV1 eventType(String eventType) { - public SourceEventVolumeV1 total(BigDecimal total) { - - this.total = total; - return this; - } + this.eventType = eventType; + return this; + } - /** - * The total count for all events in the requested time frame. - * @return total - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The total count for all events in the requested time frame.") + /** + * The event type, if applicable. + * + * @return eventType + */ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } - public BigDecimal getTotal() { - return total; - } + public void setEventType(String eventType) { + this.eventType = eventType; + } + public SourceEventVolumeV1 total(BigDecimal total) { - public void setTotal(BigDecimal total) { - this.total = total; - } + this.total = total; + return this; + } + /** + * The total count for all events in the requested time frame. + * + * @return total + */ + @javax.annotation.Nonnull + public BigDecimal getTotal() { + return total; + } - public SourceEventVolumeV1 series(List series) { - - this.series = series; - return this; - } + public void setTotal(BigDecimal total) { + this.total = total; + } - public SourceEventVolumeV1 addSeriesItem(SourceEventVolumeDatapointV1 seriesItem) { - this.series.add(seriesItem); - return this; - } + public SourceEventVolumeV1 series(List series) { - /** - * A list of the event counts broken down by the requested granularity. - * @return series - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of the event counts broken down by the requested granularity.") + this.series = series; + return this; + } - public List getSeries() { - return series; - } + public SourceEventVolumeV1 addSeriesItem(SourceEventVolumeDatapointV1 seriesItem) { + if (this.series == null) { + this.series = new ArrayList<>(); + } + this.series.add(seriesItem); + return this; + } + /** + * A list of the event counts broken down by the requested granularity. + * + * @return series + */ + @javax.annotation.Nonnull + public List getSeries() { + return series; + } - public void setSeries(List series) { - this.series = series; - } + public void setSeries(List series) { + this.series = series; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SourceEventVolumeV1 sourceEventVolumeV1 = (SourceEventVolumeV1) o; + return Objects.equals(this.source, sourceEventVolumeV1.source) + && Objects.equals(this.eventName, sourceEventVolumeV1.eventName) + && Objects.equals(this.eventType, sourceEventVolumeV1.eventType) + && Objects.equals(this.total, sourceEventVolumeV1.total) + && Objects.equals(this.series, sourceEventVolumeV1.series); + } + @Override + public int hashCode() { + return Objects.hash(source, eventName, eventType, total, series); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SourceEventVolumeV1 {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" eventName: ").append(toIndentedString(eventName)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" series: ").append(toIndentedString(series)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - SourceEventVolumeV1 sourceEventVolumeV1 = (SourceEventVolumeV1) o; - return Objects.equals(this.source, sourceEventVolumeV1.source) && - Objects.equals(this.eventName, sourceEventVolumeV1.eventName) && - Objects.equals(this.eventType, sourceEventVolumeV1.eventType) && - Objects.equals(this.total, sourceEventVolumeV1.total) && - Objects.equals(this.series, sourceEventVolumeV1.series); - } - - @Override - public int hashCode() { - return Objects.hash(source, eventName, eventType, total, series); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SourceEventVolumeV1 {\n"); - sb.append(" source: ").append(toIndentedString(source)).append("\n"); - sb.append(" eventName: ").append(toIndentedString(eventName)).append("\n"); - sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); - sb.append(" total: ").append(toIndentedString(total)).append("\n"); - sb.append(" series: ").append(toIndentedString(series)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("eventName"); + openapiFields.add("eventType"); + openapiFields.add("total"); + openapiFields.add("series"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("series"); } - return o.toString().replace("\n", "\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("eventName"); - openapiFields.add("eventType"); - openapiFields.add("total"); - openapiFields.add("series"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("source"); - openapiRequiredFields.add("total"); - openapiRequiredFields.add("series"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SourceEventVolumeV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SourceEventVolumeV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SourceEventVolumeV1 is not found in the empty JSON string", SourceEventVolumeV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SourceEventVolumeV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SourceEventVolumeV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SourceEventVolumeV1 is not found in" + + " the empty JSON string", + SourceEventVolumeV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SourceEventVolumeV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SourceEventVolumeV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SourceEventVolumeV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SourceEventVolumeV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SourceEventVolumeV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SourceEventVolumeV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + EventSourceV1.validateJsonElement(jsonObj.get("source")); + } + if ((jsonObj.get("eventName") != null && !jsonObj.get("eventName").isJsonNull()) + && !jsonObj.get("eventName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("eventName").toString())); + } + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) + && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `eventType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("eventType").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("series").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `series` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("series").toString())); + } + + JsonArray jsonArrayseries = jsonObj.getAsJsonArray("series"); + // validate the required field `series` (array) + for (int i = 0; i < jsonArrayseries.size(); i++) { + SourceEventVolumeDatapointV1.validateJsonElement(jsonArrayseries.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SourceEventVolumeV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SourceEventVolumeV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SourceEventVolumeV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SourceEventVolumeV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SourceEventVolumeV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - if ((jsonObj.get("eventName") != null && !jsonObj.get("eventName").isJsonNull()) && !jsonObj.get("eventName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `eventName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventName").toString())); - } - if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("series").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `series` to be an array in the JSON string but got `%s`", jsonObj.get("series").toString())); - } - - JsonArray jsonArrayseries = jsonObj.getAsJsonArray("series"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SourceEventVolumeV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SourceEventVolumeV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SourceEventVolumeV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SourceEventVolumeV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SourceEventVolumeV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of SourceEventVolumeV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of SourceEventVolumeV1 - * @throws IOException if the JSON string is invalid with respect to SourceEventVolumeV1 - */ - public static SourceEventVolumeV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SourceEventVolumeV1.class); - } - - /** - * Convert an instance of SourceEventVolumeV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of SourceEventVolumeV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SourceEventVolumeV1 + * @throws IOException if the JSON string is invalid with respect to SourceEventVolumeV1 + */ + public static SourceEventVolumeV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SourceEventVolumeV1.class); + } + + /** + * Convert an instance of SourceEventVolumeV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/SourceMetadata.java b/src/main/java/com/segment/publicapi/models/SourceMetadata.java deleted file mode 100644 index 648525d8..00000000 --- a/src/main/java/com/segment/publicapi/models/SourceMetadata.java +++ /dev/null @@ -1,469 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.IntegrationOptionBeta; -import com.segment.publicapi.models.Logos1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The catalog item matched by id. - */ -@ApiModel(description = "The catalog item matched by id.") - -public class SourceMetadata { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_LOGOS = "logos"; - @SerializedName(SERIALIZED_NAME_LOGOS) - private Logos1 logos; - - public static final String SERIALIZED_NAME_OPTIONS = "options"; - @SerializedName(SERIALIZED_NAME_OPTIONS) - private List options = new ArrayList<>(); - - public static final String SERIALIZED_NAME_CATEGORIES = "categories"; - @SerializedName(SERIALIZED_NAME_CATEGORIES) - private List categories = new ArrayList<>(); - - public static final String SERIALIZED_NAME_IS_CLOUD_EVENT_SOURCE = "isCloudEventSource"; - @SerializedName(SERIALIZED_NAME_IS_CLOUD_EVENT_SOURCE) - private Boolean isCloudEventSource; - - public SourceMetadata() { - } - - public SourceMetadata id(String id) { - - this.id = id; - return this; - } - - /** - * The id for this Source metadata in the Segment catalog. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id for this Source metadata in the Segment catalog. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public SourceMetadata name(String name) { - - this.name = name; - return this; - } - - /** - * The user-friendly name of this Source. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The user-friendly name of this Source. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public SourceMetadata slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * The slug that identifies this Source in the Segment app. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug that identifies this Source in the Segment app. Config API note: equal to `name`.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - public SourceMetadata description(String description) { - - this.description = description; - return this; - } - - /** - * The description of this Source. - * @return description - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The description of this Source.") - - public String getDescription() { - return description; - } - - - public void setDescription(String description) { - this.description = description; - } - - - public SourceMetadata logos(Logos1 logos) { - - this.logos = logos; - return this; - } - - /** - * Get logos - * @return logos - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Logos1 getLogos() { - return logos; - } - - - public void setLogos(Logos1 logos) { - this.logos = logos; - } - - - public SourceMetadata options(List options) { - - this.options = options; - return this; - } - - public SourceMetadata addOptionsItem(IntegrationOptionBeta optionsItem) { - this.options.add(optionsItem); - return this; - } - - /** - * Options for this Source. - * @return options - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Options for this Source.") - - public List getOptions() { - return options; - } - - - public void setOptions(List options) { - this.options = options; - } - - - public SourceMetadata categories(List categories) { - - this.categories = categories; - return this; - } - - public SourceMetadata addCategoriesItem(String categoriesItem) { - this.categories.add(categoriesItem); - return this; - } - - /** - * A list of categories this Source belongs to. - * @return categories - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of categories this Source belongs to.") - - public List getCategories() { - return categories; - } - - - public void setCategories(List categories) { - this.categories = categories; - } - - - public SourceMetadata isCloudEventSource(Boolean isCloudEventSource) { - - this.isCloudEventSource = isCloudEventSource; - return this; - } - - /** - * True if this is a Cloud Event Source. - * @return isCloudEventSource - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "True if this is a Cloud Event Source.") - - public Boolean getIsCloudEventSource() { - return isCloudEventSource; - } - - - public void setIsCloudEventSource(Boolean isCloudEventSource) { - this.isCloudEventSource = isCloudEventSource; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SourceMetadata sourceMetadata = (SourceMetadata) o; - return Objects.equals(this.id, sourceMetadata.id) && - Objects.equals(this.name, sourceMetadata.name) && - Objects.equals(this.slug, sourceMetadata.slug) && - Objects.equals(this.description, sourceMetadata.description) && - Objects.equals(this.logos, sourceMetadata.logos) && - Objects.equals(this.options, sourceMetadata.options) && - Objects.equals(this.categories, sourceMetadata.categories) && - Objects.equals(this.isCloudEventSource, sourceMetadata.isCloudEventSource); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, slug, description, logos, options, categories, isCloudEventSource); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SourceMetadata {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" logos: ").append(toIndentedString(logos)).append("\n"); - sb.append(" options: ").append(toIndentedString(options)).append("\n"); - sb.append(" categories: ").append(toIndentedString(categories)).append("\n"); - sb.append(" isCloudEventSource: ").append(toIndentedString(isCloudEventSource)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("slug"); - openapiFields.add("description"); - openapiFields.add("logos"); - openapiFields.add("options"); - openapiFields.add("categories"); - openapiFields.add("isCloudEventSource"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("description"); - openapiRequiredFields.add("logos"); - openapiRequiredFields.add("options"); - openapiRequiredFields.add("categories"); - openapiRequiredFields.add("isCloudEventSource"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SourceMetadata - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SourceMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SourceMetadata is not found in the empty JSON string", SourceMetadata.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SourceMetadata.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SourceMetadata` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SourceMetadata.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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())); - } - // ensure the json data is an array - if (!jsonObj.get("options").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `options` to be an array in the JSON string but got `%s`", jsonObj.get("options").toString())); - } - - JsonArray jsonArrayoptions = jsonObj.getAsJsonArray("options"); - // ensure the required json array is present - if (jsonObj.get("categories") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("categories").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `categories` to be an array in the JSON string but got `%s`", jsonObj.get("categories").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SourceMetadata.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SourceMetadata' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SourceMetadata.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SourceMetadata value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SourceMetadata read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of SourceMetadata given an JSON string - * - * @param jsonString JSON string - * @return An instance of SourceMetadata - * @throws IOException if the JSON string is invalid with respect to SourceMetadata - */ - public static SourceMetadata fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SourceMetadata.class); - } - - /** - * Convert an instance of SourceMetadata to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/SourceMetadataV1.java b/src/main/java/com/segment/publicapi/models/SourceMetadataV1.java index 3ae26477..806fee65 100644 --- a/src/main/java/com/segment/publicapi/models/SourceMetadataV1.java +++ b/src/main/java/com/segment/publicapi/models/SourceMetadataV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,460 +9,606 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.segment.publicapi.models.IntegrationOptionBeta; -import com.segment.publicapi.models.Logos1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** A website, server library, mobile SDK, or cloud application which can send data into Segment. */ +public class SourceMetadataV1 { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * A website, server library, mobile SDK, or cloud application which can send data into Segment. - */ -@ApiModel(description = "A website, server library, mobile SDK, or cloud application which can send data into Segment.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class SourceMetadataV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_SLUG = "slug"; + + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_LOGOS = "logos"; + + @SerializedName(SERIALIZED_NAME_LOGOS) + private LogosBeta logos; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + + @SerializedName(SERIALIZED_NAME_OPTIONS) + private List options = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CATEGORIES = "categories"; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + @SerializedName(SERIALIZED_NAME_CATEGORIES) + private List categories = new ArrayList<>(); - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; + public static final String SERIALIZED_NAME_IS_CLOUD_EVENT_SOURCE = "isCloudEventSource"; - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_LOGOS = "logos"; - @SerializedName(SERIALIZED_NAME_LOGOS) - private Logos1 logos; - - public static final String SERIALIZED_NAME_OPTIONS = "options"; - @SerializedName(SERIALIZED_NAME_OPTIONS) - private List options = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_IS_CLOUD_EVENT_SOURCE) + private Boolean isCloudEventSource; - public static final String SERIALIZED_NAME_CATEGORIES = "categories"; - @SerializedName(SERIALIZED_NAME_CATEGORIES) - private List categories = new ArrayList<>(); + /** Support status of the Source. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + DEPRECATED("DEPRECATED"), - public static final String SERIALIZED_NAME_IS_CLOUD_EVENT_SOURCE = "isCloudEventSource"; - @SerializedName(SERIALIZED_NAME_IS_CLOUD_EVENT_SOURCE) - private Boolean isCloudEventSource; + PRIVATE_BETA("PRIVATE_BETA"), - public SourceMetadataV1() { - } + PRIVATE_BUILDING("PRIVATE_BUILDING"), - public SourceMetadataV1 id(String id) { - - this.id = id; - return this; - } + PRIVATE_SUBMITTED("PRIVATE_SUBMITTED"), - /** - * The id for this Source metadata in the Segment catalog. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id for this Source metadata in the Segment catalog. Config API note: analogous to `name`.") + PUBLIC("PUBLIC"), - public String getId() { - return id; - } + PUBLIC_BETA("PUBLIC_BETA"), + UNAVAILABLE("UNAVAILABLE"); - public void setId(String id) { - this.id = id; - } + private String value; + StatusEnum(String value) { + this.value = value; + } - public SourceMetadataV1 name(String name) { - - this.name = name; - return this; - } + public String getValue() { + return value; + } - /** - * The user-friendly name of this Source. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The user-friendly name of this Source. Config API note: equal to `displayName`.") + @Override + public String toString() { + return String.valueOf(value); + } - public String getName() { - return name; - } + 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 void setName(String name) { - this.name = name; - } + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public SourceMetadataV1 slug(String slug) { - - this.slug = slug; - return this; - } + public static final String SERIALIZED_NAME_PARTNER_OWNED = "partnerOwned"; - /** - * The slug that identifies this Source in the Segment app. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug that identifies this Source in the Segment app. Config API note: equal to `name`.") + @SerializedName(SERIALIZED_NAME_PARTNER_OWNED) + private Boolean partnerOwned; - public String getSlug() { - return slug; - } + public SourceMetadataV1() {} + public SourceMetadataV1 id(String id) { - public void setSlug(String slug) { - this.slug = slug; - } + this.id = id; + return this; + } + /** + * The id for this Source metadata in the Segment catalog. Config API note: analogous to + * `name`. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - public SourceMetadataV1 description(String description) { - - this.description = description; - return this; - } + public void setId(String id) { + this.id = id; + } - /** - * The description of this Source. - * @return description - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The description of this Source.") + public SourceMetadataV1 name(String name) { - public String getDescription() { - return description; - } + this.name = name; + return this; + } + /** + * The user-friendly name of this Source. Config API note: equal to `displayName`. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public void setDescription(String description) { - this.description = description; - } + public void setName(String name) { + this.name = name; + } + public SourceMetadataV1 slug(String slug) { - public SourceMetadataV1 logos(Logos1 logos) { - - this.logos = logos; - return this; - } + this.slug = slug; + return this; + } - /** - * Get logos - * @return logos - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + /** + * The slug that identifies this Source in the Segment app. Config API note: equal to + * `name`. + * + * @return slug + */ + @javax.annotation.Nonnull + public String getSlug() { + return slug; + } - public Logos1 getLogos() { - return logos; - } + public void setSlug(String slug) { + this.slug = slug; + } + public SourceMetadataV1 description(String description) { - public void setLogos(Logos1 logos) { - this.logos = logos; - } + this.description = description; + return this; + } + /** + * The description of this Source. + * + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } - public SourceMetadataV1 options(List options) { - - this.options = options; - return this; - } + public void setDescription(String description) { + this.description = description; + } + + public SourceMetadataV1 logos(LogosBeta logos) { + + this.logos = logos; + return this; + } + + /** + * Get logos + * + * @return logos + */ + @javax.annotation.Nonnull + public LogosBeta getLogos() { + return logos; + } + + public void setLogos(LogosBeta logos) { + this.logos = logos; + } - public SourceMetadataV1 addOptionsItem(IntegrationOptionBeta optionsItem) { - this.options.add(optionsItem); - return this; - } - - /** - * Options for this Source. - * @return options - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Options for this Source.") - - public List getOptions() { - return options; - } - - - public void setOptions(List options) { - this.options = options; - } - - - public SourceMetadataV1 categories(List categories) { - - this.categories = categories; - return this; - } - - public SourceMetadataV1 addCategoriesItem(String categoriesItem) { - this.categories.add(categoriesItem); - return this; - } - - /** - * A list of categories this Source belongs to. - * @return categories - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of categories this Source belongs to.") - - public List getCategories() { - return categories; - } - - - public void setCategories(List categories) { - this.categories = categories; - } - - - public SourceMetadataV1 isCloudEventSource(Boolean isCloudEventSource) { - - this.isCloudEventSource = isCloudEventSource; - return this; - } - - /** - * True if this is a Cloud Event Source. - * @return isCloudEventSource - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "True if this is a Cloud Event Source.") - - public Boolean getIsCloudEventSource() { - return isCloudEventSource; - } - - - public void setIsCloudEventSource(Boolean isCloudEventSource) { - this.isCloudEventSource = isCloudEventSource; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SourceMetadataV1 sourceMetadataV1 = (SourceMetadataV1) o; - return Objects.equals(this.id, sourceMetadataV1.id) && - Objects.equals(this.name, sourceMetadataV1.name) && - Objects.equals(this.slug, sourceMetadataV1.slug) && - Objects.equals(this.description, sourceMetadataV1.description) && - Objects.equals(this.logos, sourceMetadataV1.logos) && - Objects.equals(this.options, sourceMetadataV1.options) && - Objects.equals(this.categories, sourceMetadataV1.categories) && - Objects.equals(this.isCloudEventSource, sourceMetadataV1.isCloudEventSource); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, slug, description, logos, options, categories, isCloudEventSource); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SourceMetadataV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" logos: ").append(toIndentedString(logos)).append("\n"); - sb.append(" options: ").append(toIndentedString(options)).append("\n"); - sb.append(" categories: ").append(toIndentedString(categories)).append("\n"); - sb.append(" isCloudEventSource: ").append(toIndentedString(isCloudEventSource)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("slug"); - openapiFields.add("description"); - openapiFields.add("logos"); - openapiFields.add("options"); - openapiFields.add("categories"); - openapiFields.add("isCloudEventSource"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("description"); - openapiRequiredFields.add("logos"); - openapiRequiredFields.add("options"); - openapiRequiredFields.add("categories"); - openapiRequiredFields.add("isCloudEventSource"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SourceMetadataV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SourceMetadataV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SourceMetadataV1 is not found in the empty JSON string", SourceMetadataV1.openapiRequiredFields.toString())); + public SourceMetadataV1 options(List options) { + + this.options = options; + return this; + } + + public SourceMetadataV1 addOptionsItem(IntegrationOptionBeta optionsItem) { + if (this.options == null) { + this.options = new ArrayList<>(); } - } + this.options.add(optionsItem); + return this; + } + + /** + * Options for this Source. + * + * @return options + */ + @javax.annotation.Nonnull + public List getOptions() { + return options; + } + + public void setOptions(List options) { + this.options = options; + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SourceMetadataV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SourceMetadataV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + public SourceMetadataV1 categories(List categories) { + + this.categories = categories; + return this; + } + + public SourceMetadataV1 addCategoriesItem(String categoriesItem) { + if (this.categories == null) { + this.categories = new ArrayList<>(); } - } + this.categories.add(categoriesItem); + return this; + } + + /** + * A list of categories this Source belongs to. + * + * @return categories + */ + @javax.annotation.Nonnull + public List getCategories() { + return categories; + } + + public void setCategories(List categories) { + this.categories = categories; + } + + public SourceMetadataV1 isCloudEventSource(Boolean isCloudEventSource) { - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SourceMetadataV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + this.isCloudEventSource = isCloudEventSource; + return this; + } + + /** + * True if this is a Cloud Event Source. + * + * @return isCloudEventSource + */ + @javax.annotation.Nonnull + public Boolean getIsCloudEventSource() { + return isCloudEventSource; + } + + public void setIsCloudEventSource(Boolean isCloudEventSource) { + this.isCloudEventSource = isCloudEventSource; + } + + public SourceMetadataV1 status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Support status of the Source. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public SourceMetadataV1 partnerOwned(Boolean partnerOwned) { + + this.partnerOwned = partnerOwned; + return this; + } + + /** + * Partner Owned flag. + * + * @return partnerOwned + */ + @javax.annotation.Nullable + public Boolean getPartnerOwned() { + return partnerOwned; + } + + public void setPartnerOwned(Boolean partnerOwned) { + this.partnerOwned = partnerOwned; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } - } - 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("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("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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())); - } - // ensure the json data is an array - if (!jsonObj.get("options").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `options` to be an array in the JSON string but got `%s`", jsonObj.get("options").toString())); - } - - JsonArray jsonArrayoptions = jsonObj.getAsJsonArray("options"); - // ensure the required json array is present - if (jsonObj.get("categories") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("categories").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `categories` to be an array in the JSON string but got `%s`", jsonObj.get("categories").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") + SourceMetadataV1 sourceMetadataV1 = (SourceMetadataV1) o; + return Objects.equals(this.id, sourceMetadataV1.id) + && Objects.equals(this.name, sourceMetadataV1.name) + && Objects.equals(this.slug, sourceMetadataV1.slug) + && Objects.equals(this.description, sourceMetadataV1.description) + && Objects.equals(this.logos, sourceMetadataV1.logos) + && Objects.equals(this.options, sourceMetadataV1.options) + && Objects.equals(this.categories, sourceMetadataV1.categories) + && Objects.equals(this.isCloudEventSource, sourceMetadataV1.isCloudEventSource) + && Objects.equals(this.status, sourceMetadataV1.status) + && Objects.equals(this.partnerOwned, sourceMetadataV1.partnerOwned); + } + @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SourceMetadataV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SourceMetadataV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SourceMetadataV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SourceMetadataV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SourceMetadataV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of SourceMetadataV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of SourceMetadataV1 - * @throws IOException if the JSON string is invalid with respect to SourceMetadataV1 - */ - public static SourceMetadataV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SourceMetadataV1.class); - } - - /** - * Convert an instance of SourceMetadataV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public int hashCode() { + return Objects.hash( + id, + name, + slug, + description, + logos, + options, + categories, + isCloudEventSource, + status, + partnerOwned); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SourceMetadataV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" logos: ").append(toIndentedString(logos)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append(" categories: ").append(toIndentedString(categories)).append("\n"); + sb.append(" isCloudEventSource: ") + .append(toIndentedString(isCloudEventSource)) + .append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" partnerOwned: ").append(toIndentedString(partnerOwned)).append("\n"); + sb.append("}"); + return sb.toString(); + } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("name"); + openapiFields.add("slug"); + openapiFields.add("description"); + openapiFields.add("logos"); + openapiFields.add("options"); + openapiFields.add("categories"); + openapiFields.add("isCloudEventSource"); + openapiFields.add("status"); + openapiFields.add("partnerOwned"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("slug"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("logos"); + openapiRequiredFields.add("options"); + openapiRequiredFields.add("categories"); + openapiRequiredFields.add("isCloudEventSource"); + 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 SourceMetadataV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SourceMetadataV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SourceMetadataV1 is not found in the" + + " empty JSON string", + SourceMetadataV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SourceMetadataV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SourceMetadataV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SourceMetadataV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").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 `logos` + LogosBeta.validateJsonElement(jsonObj.get("logos")); + // ensure the json data is an array + if (!jsonObj.get("options").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `options` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("options").toString())); + } + + JsonArray jsonArrayoptions = jsonObj.getAsJsonArray("options"); + // validate the required field `options` (array) + for (int i = 0; i < jsonArrayoptions.size(); i++) { + IntegrationOptionBeta.validateJsonElement(jsonArrayoptions.get(i)); + } + ; + // ensure the required json array is present + if (jsonObj.get("categories") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("categories").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `categories` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("categories").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SourceMetadataV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SourceMetadataV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SourceMetadataV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SourceMetadataV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SourceMetadataV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SourceMetadataV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SourceMetadataV1 + * @throws IOException if the JSON string is invalid with respect to SourceMetadataV1 + */ + public static SourceMetadataV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SourceMetadataV1.class); + } + + /** + * Convert an instance of SourceMetadataV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/SourceSettingsOutputV1.java b/src/main/java/com/segment/publicapi/models/SourceSettingsOutputV1.java index 452242f2..dc18d239 100644 --- a/src/main/java/com/segment/publicapi/models/SourceSettingsOutputV1.java +++ b/src/main/java/com/segment/publicapi/models/SourceSettingsOutputV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,326 +9,332 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Group; -import com.segment.publicapi.models.Identify; -import com.segment.publicapi.models.Track; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** The output of Source settings. */ +public class SourceSettingsOutputV1 { + public static final String SERIALIZED_NAME_TRACK = "track"; -/** - * The output of Source settings. - */ -@ApiModel(description = "The output of Source settings.") + @SerializedName(SERIALIZED_NAME_TRACK) + private TrackSourceSettingsV1 track; -public class SourceSettingsOutputV1 { - public static final String SERIALIZED_NAME_TRACK = "track"; - @SerializedName(SERIALIZED_NAME_TRACK) - private Track track; - - public static final String SERIALIZED_NAME_IDENTIFY = "identify"; - @SerializedName(SERIALIZED_NAME_IDENTIFY) - private Identify identify; - - public static final String SERIALIZED_NAME_GROUP = "group"; - @SerializedName(SERIALIZED_NAME_GROUP) - private Group group; + public static final String SERIALIZED_NAME_IDENTIFY = "identify"; - public static final String SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO = "forwardingViolationsTo"; - @SerializedName(SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO) - private String forwardingViolationsTo; + @SerializedName(SERIALIZED_NAME_IDENTIFY) + private IdentifySourceSettingsV1 identify; - public static final String SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO = "forwardingBlockedEventsTo"; - @SerializedName(SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO) - private String forwardingBlockedEventsTo; + public static final String SERIALIZED_NAME_GROUP = "group"; - public SourceSettingsOutputV1() { - } + @SerializedName(SERIALIZED_NAME_GROUP) + private GroupSourceSettingsV1 group; - public SourceSettingsOutputV1 track(Track track) { - - this.track = track; - return this; - } + public static final String SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO = "forwardingViolationsTo"; - /** - * Get track - * @return track - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + @SerializedName(SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO) + private String forwardingViolationsTo; - public Track getTrack() { - return track; - } + public static final String SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO = + "forwardingBlockedEventsTo"; + @SerializedName(SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO) + private String forwardingBlockedEventsTo; - public void setTrack(Track track) { - this.track = track; - } + public SourceSettingsOutputV1() {} + public SourceSettingsOutputV1 track(TrackSourceSettingsV1 track) { - public SourceSettingsOutputV1 identify(Identify identify) { - - this.identify = identify; - return this; - } + this.track = track; + return this; + } - /** - * Get identify - * @return identify - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + /** + * Get track + * + * @return track + */ + @javax.annotation.Nullable + public TrackSourceSettingsV1 getTrack() { + return track; + } - public Identify getIdentify() { - return identify; - } + public void setTrack(TrackSourceSettingsV1 track) { + this.track = track; + } + public SourceSettingsOutputV1 identify(IdentifySourceSettingsV1 identify) { - public void setIdentify(Identify identify) { - this.identify = identify; - } + this.identify = identify; + return this; + } + /** + * Get identify + * + * @return identify + */ + @javax.annotation.Nullable + public IdentifySourceSettingsV1 getIdentify() { + return identify; + } + + public void setIdentify(IdentifySourceSettingsV1 identify) { + this.identify = identify; + } - public SourceSettingsOutputV1 group(Group group) { - - this.group = group; - return this; - } + public SourceSettingsOutputV1 group(GroupSourceSettingsV1 group) { - /** - * Get group - * @return group - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + this.group = group; + return this; + } - public Group getGroup() { - return group; - } + /** + * Get group + * + * @return group + */ + @javax.annotation.Nullable + public GroupSourceSettingsV1 getGroup() { + return group; + } + + public void setGroup(GroupSourceSettingsV1 group) { + this.group = group; + } + public SourceSettingsOutputV1 forwardingViolationsTo(String forwardingViolationsTo) { - public void setGroup(Group group) { - this.group = group; - } + this.forwardingViolationsTo = forwardingViolationsTo; + return this; + } + /** + * SourceId to forward violations to. + * + * @return forwardingViolationsTo + */ + @javax.annotation.Nullable + public String getForwardingViolationsTo() { + return forwardingViolationsTo; + } - public SourceSettingsOutputV1 forwardingViolationsTo(String forwardingViolationsTo) { - - this.forwardingViolationsTo = forwardingViolationsTo; - return this; - } + public void setForwardingViolationsTo(String forwardingViolationsTo) { + this.forwardingViolationsTo = forwardingViolationsTo; + } - /** - * SourceId to forward violations to. - * @return forwardingViolationsTo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "SourceId to forward violations to.") + public SourceSettingsOutputV1 forwardingBlockedEventsTo(String forwardingBlockedEventsTo) { - public String getForwardingViolationsTo() { - return forwardingViolationsTo; - } + this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; + return this; + } + /** + * SourceId to forward blocked events to. + * + * @return forwardingBlockedEventsTo + */ + @javax.annotation.Nullable + public String getForwardingBlockedEventsTo() { + return forwardingBlockedEventsTo; + } - public void setForwardingViolationsTo(String forwardingViolationsTo) { - this.forwardingViolationsTo = forwardingViolationsTo; - } + public void setForwardingBlockedEventsTo(String forwardingBlockedEventsTo) { + this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SourceSettingsOutputV1 sourceSettingsOutputV1 = (SourceSettingsOutputV1) o; + return Objects.equals(this.track, sourceSettingsOutputV1.track) + && Objects.equals(this.identify, sourceSettingsOutputV1.identify) + && Objects.equals(this.group, sourceSettingsOutputV1.group) + && Objects.equals( + this.forwardingViolationsTo, sourceSettingsOutputV1.forwardingViolationsTo) + && Objects.equals( + this.forwardingBlockedEventsTo, + sourceSettingsOutputV1.forwardingBlockedEventsTo); + } - public SourceSettingsOutputV1 forwardingBlockedEventsTo(String forwardingBlockedEventsTo) { - - this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; - return this; - } + @Override + public int hashCode() { + return Objects.hash( + track, identify, group, forwardingViolationsTo, forwardingBlockedEventsTo); + } - /** - * SourceId to forward blocked events to. - * @return forwardingBlockedEventsTo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "SourceId to forward blocked events to.") + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SourceSettingsOutputV1 {\n"); + sb.append(" track: ").append(toIndentedString(track)).append("\n"); + sb.append(" identify: ").append(toIndentedString(identify)).append("\n"); + sb.append(" group: ").append(toIndentedString(group)).append("\n"); + sb.append(" forwardingViolationsTo: ") + .append(toIndentedString(forwardingViolationsTo)) + .append("\n"); + sb.append(" forwardingBlockedEventsTo: ") + .append(toIndentedString(forwardingBlockedEventsTo)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } - public String getForwardingBlockedEventsTo() { - return forwardingBlockedEventsTo; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public void setForwardingBlockedEventsTo(String forwardingBlockedEventsTo) { - this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("track"); + openapiFields.add("identify"); + openapiFields.add("group"); + openapiFields.add("forwardingViolationsTo"); + openapiFields.add("forwardingBlockedEventsTo"); + // 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 SourceSettingsOutputV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SourceSettingsOutputV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SourceSettingsOutputV1 is not found in" + + " the empty JSON string", + SourceSettingsOutputV1.openapiRequiredFields.toString())); + } + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SourceSettingsOutputV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SourceSettingsOutputV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `track` + if (jsonObj.get("track") != null && !jsonObj.get("track").isJsonNull()) { + TrackSourceSettingsV1.validateJsonElement(jsonObj.get("track")); + } + // validate the optional field `identify` + if (jsonObj.get("identify") != null && !jsonObj.get("identify").isJsonNull()) { + IdentifySourceSettingsV1.validateJsonElement(jsonObj.get("identify")); + } + // validate the optional field `group` + if (jsonObj.get("group") != null && !jsonObj.get("group").isJsonNull()) { + GroupSourceSettingsV1.validateJsonElement(jsonObj.get("group")); + } + if ((jsonObj.get("forwardingViolationsTo") != null + && !jsonObj.get("forwardingViolationsTo").isJsonNull()) + && !jsonObj.get("forwardingViolationsTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `forwardingViolationsTo` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("forwardingViolationsTo").toString())); + } + if ((jsonObj.get("forwardingBlockedEventsTo") != null + && !jsonObj.get("forwardingBlockedEventsTo").isJsonNull()) + && !jsonObj.get("forwardingBlockedEventsTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `forwardingBlockedEventsTo` to be a primitive type" + + " in the JSON string but got `%s`", + jsonObj.get("forwardingBlockedEventsTo").toString())); + } } - if (o == null || getClass() != o.getClass()) { - return false; + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SourceSettingsOutputV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SourceSettingsOutputV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SourceSettingsOutputV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SourceSettingsOutputV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SourceSettingsOutputV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } } - SourceSettingsOutputV1 sourceSettingsOutputV1 = (SourceSettingsOutputV1) o; - return Objects.equals(this.track, sourceSettingsOutputV1.track) && - Objects.equals(this.identify, sourceSettingsOutputV1.identify) && - Objects.equals(this.group, sourceSettingsOutputV1.group) && - Objects.equals(this.forwardingViolationsTo, sourceSettingsOutputV1.forwardingViolationsTo) && - Objects.equals(this.forwardingBlockedEventsTo, sourceSettingsOutputV1.forwardingBlockedEventsTo); - } - - @Override - public int hashCode() { - return Objects.hash(track, identify, group, forwardingViolationsTo, forwardingBlockedEventsTo); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SourceSettingsOutputV1 {\n"); - sb.append(" track: ").append(toIndentedString(track)).append("\n"); - sb.append(" identify: ").append(toIndentedString(identify)).append("\n"); - sb.append(" group: ").append(toIndentedString(group)).append("\n"); - sb.append(" forwardingViolationsTo: ").append(toIndentedString(forwardingViolationsTo)).append("\n"); - sb.append(" forwardingBlockedEventsTo: ").append(toIndentedString(forwardingBlockedEventsTo)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + /** + * Create an instance of SourceSettingsOutputV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SourceSettingsOutputV1 + * @throws IOException if the JSON string is invalid with respect to SourceSettingsOutputV1 + */ + public static SourceSettingsOutputV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SourceSettingsOutputV1.class); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("track"); - openapiFields.add("identify"); - openapiFields.add("group"); - openapiFields.add("forwardingViolationsTo"); - openapiFields.add("forwardingBlockedEventsTo"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SourceSettingsOutputV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SourceSettingsOutputV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SourceSettingsOutputV1 is not found in the empty JSON string", SourceSettingsOutputV1.openapiRequiredFields.toString())); - } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SourceSettingsOutputV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SourceSettingsOutputV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - if ((jsonObj.get("forwardingViolationsTo") != null && !jsonObj.get("forwardingViolationsTo").isJsonNull()) && !jsonObj.get("forwardingViolationsTo").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `forwardingViolationsTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("forwardingViolationsTo").toString())); - } - if ((jsonObj.get("forwardingBlockedEventsTo") != null && !jsonObj.get("forwardingBlockedEventsTo").isJsonNull()) && !jsonObj.get("forwardingBlockedEventsTo").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `forwardingBlockedEventsTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("forwardingBlockedEventsTo").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SourceSettingsOutputV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SourceSettingsOutputV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SourceSettingsOutputV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SourceSettingsOutputV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SourceSettingsOutputV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + /** + * Convert an instance of SourceSettingsOutputV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); } - } - - /** - * Create an instance of SourceSettingsOutputV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of SourceSettingsOutputV1 - * @throws IOException if the JSON string is invalid with respect to SourceSettingsOutputV1 - */ - public static SourceSettingsOutputV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SourceSettingsOutputV1.class); - } - - /** - * Convert an instance of SourceSettingsOutputV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } } - diff --git a/src/main/java/com/segment/publicapi/models/SourceV1.java b/src/main/java/com/segment/publicapi/models/SourceV1.java index d2cb4aac..57d7db3d 100644 --- a/src/main/java/com/segment/publicapi/models/SourceV1.java +++ b/src/main/java/com/segment/publicapi/models/SourceV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,490 +9,511 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.LabelV1; -import com.segment.publicapi.models.Metadata1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Defines a data Source for Segment data. */ +public class SourceV1 { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * Defines a data Source for Segment data. - */ -@ApiModel(description = "Defines a data Source for Segment data.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class SourceV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + public static final String SERIALIZED_NAME_SLUG = "slug"; + + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata1 metadata; + public static final String SERIALIZED_NAME_METADATA = "metadata"; - public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) - private String workspaceId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_WRITE_KEYS = "writeKeys"; - @SerializedName(SERIALIZED_NAME_WRITE_KEYS) - private List writeKeys = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_METADATA) + private SourceMetadataV1 metadata; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; + public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - public static final String SERIALIZED_NAME_LABELS = "labels"; - @SerializedName(SERIALIZED_NAME_LABELS) - private List labels = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) + private String workspaceId; - public SourceV1() { - } + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public SourceV1 id(String id) { - - this.id = id; - return this; - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - /** - * The id of the Source. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source. Config API note: analogous to `name`.") + public static final String SERIALIZED_NAME_WRITE_KEYS = "writeKeys"; - public String getId() { - return id; - } + @SerializedName(SERIALIZED_NAME_WRITE_KEYS) + private List writeKeys = new ArrayList<>(); + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - public void setId(String id) { - this.id = id; - } + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; + public static final String SERIALIZED_NAME_LABELS = "labels"; - public SourceV1 slug(String slug) { - - this.slug = slug; - return this; - } + @SerializedName(SERIALIZED_NAME_LABELS) + private List labels = new ArrayList<>(); - /** - * The slug used to identify the Source in the Segment app. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The slug used to identify the Source in the Segment app. Config API note: equal to `name`.") + public SourceV1() {} - public String getSlug() { - return slug; - } + public SourceV1 id(String id) { + this.id = id; + return this; + } - public void setSlug(String slug) { - this.slug = slug; - } + /** + * The id of the Source. Config API note: analogous to `name`. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } - public SourceV1 name(String name) { - - this.name = name; - return this; - } + public SourceV1 slug(String slug) { - /** - * The name of the Source. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Source. Config API note: equal to `displayName`.") + this.slug = slug; + return this; + } - public String getName() { - return name; - } + /** + * The slug used to identify the Source in the Segment app. Config API note: equal to + * `name`. + * + * @return slug + */ + @javax.annotation.Nonnull + public String getSlug() { + return slug; + } + public void setSlug(String slug) { + this.slug = slug; + } - public void setName(String name) { - this.name = name; - } + public SourceV1 name(String name) { + this.name = name; + return this; + } - public SourceV1 metadata(Metadata1 metadata) { - - this.metadata = metadata; - return this; - } + /** + * The name of the Source. Config API note: equal to `displayName`. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public void setName(String name) { + this.name = name; + } - public Metadata1 getMetadata() { - return metadata; - } + public SourceV1 metadata(SourceMetadataV1 metadata) { + this.metadata = metadata; + return this; + } - public void setMetadata(Metadata1 metadata) { - this.metadata = metadata; - } + /** + * Get metadata + * + * @return metadata + */ + @javax.annotation.Nonnull + public SourceMetadataV1 getMetadata() { + return metadata; + } + public void setMetadata(SourceMetadataV1 metadata) { + this.metadata = metadata; + } - public SourceV1 workspaceId(String workspaceId) { - - this.workspaceId = workspaceId; - return this; - } + public SourceV1 workspaceId(String workspaceId) { - /** - * The id of the Workspace that owns the Source. Config API note: equal to `parent`. - * @return workspaceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Workspace that owns the Source. Config API note: equal to `parent`.") + this.workspaceId = workspaceId; + return this; + } - public String getWorkspaceId() { - return workspaceId; - } + /** + * The id of the Workspace that owns the Source. Config API note: equal to `parent`. + * + * @return workspaceId + */ + @javax.annotation.Nonnull + public String getWorkspaceId() { + return workspaceId; + } + + public void setWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + } + public SourceV1 enabled(Boolean enabled) { - public void setWorkspaceId(String workspaceId) { - this.workspaceId = workspaceId; - } + this.enabled = enabled; + return this; + } + + /** + * Enable to receive data from the Source. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public SourceV1 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public SourceV1 writeKeys(List writeKeys) { - /** - * Enable to receive data from the Source. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Enable to receive data from the Source.") + this.writeKeys = writeKeys; + return this; + } - public Boolean getEnabled() { - return enabled; - } + public SourceV1 addWriteKeysItem(String writeKeysItem) { + if (this.writeKeys == null) { + this.writeKeys = new ArrayList<>(); + } + this.writeKeys.add(writeKeysItem); + return this; + } + /** + * The write keys used to send data from the Source. This field is left empty when the current + * token does not have the 'source admin' permission. + * + * @return writeKeys + */ + @javax.annotation.Nonnull + public List getWriteKeys() { + return writeKeys; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public void setWriteKeys(List writeKeys) { + this.writeKeys = writeKeys; + } + public SourceV1 settings(Map settings) { - public SourceV1 writeKeys(List writeKeys) { - - this.writeKeys = writeKeys; - return this; - } + this.settings = settings; + return this; + } - public SourceV1 addWriteKeysItem(String writeKeysItem) { - this.writeKeys.add(writeKeysItem); - return this; - } - - /** - * The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission. - * @return writeKeys - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The write keys used to send data from the Source. This field is left empty when the current token does not have the 'source admin' permission.") - - public List getWriteKeys() { - return writeKeys; - } - - - public void setWriteKeys(List writeKeys) { - this.writeKeys = writeKeys; - } - - - public SourceV1 settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The settings associated with the Source. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The settings associated with the Source.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - public SourceV1 labels(List labels) { - - this.labels = labels; - return this; - } - - public SourceV1 addLabelsItem(LabelV1 labelsItem) { - this.labels.add(labelsItem); - return this; - } - - /** - * A list of labels applied to the Source. - * @return labels - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A list of labels applied to the Source.") - - public List getLabels() { - return labels; - } - - - public void setLabels(List labels) { - this.labels = labels; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SourceV1 sourceV1 = (SourceV1) o; - return Objects.equals(this.id, sourceV1.id) && - Objects.equals(this.slug, sourceV1.slug) && - Objects.equals(this.name, sourceV1.name) && - Objects.equals(this.metadata, sourceV1.metadata) && - Objects.equals(this.workspaceId, sourceV1.workspaceId) && - Objects.equals(this.enabled, sourceV1.enabled) && - Objects.equals(this.writeKeys, sourceV1.writeKeys) && - Objects.equals(this.settings, sourceV1.settings) && - Objects.equals(this.labels, sourceV1.labels); - } - - @Override - public int hashCode() { - return Objects.hash(id, slug, name, metadata, workspaceId, enabled, writeKeys, settings, labels); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SourceV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" writeKeys: ").append(toIndentedString(writeKeys)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("slug"); - openapiFields.add("name"); - openapiFields.add("metadata"); - openapiFields.add("workspaceId"); - openapiFields.add("enabled"); - openapiFields.add("writeKeys"); - openapiFields.add("settings"); - openapiFields.add("labels"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("workspaceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("writeKeys"); - openapiRequiredFields.add("labels"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SourceV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SourceV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SourceV1 is not found in the empty JSON string", SourceV1.openapiRequiredFields.toString())); + public SourceV1 putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); } - } + this.settings.put(key, settingsItem); + return this; + } + + /** + * A key-value object that contains instance-specific settings for a Source. The + * `options` field in the Source metadata defines the schema of this object. + * + * @return settings + */ + @javax.annotation.Nullable + public Map getSettings() { + return settings; + } + + public void setSettings(Map settings) { + this.settings = settings; + } + + public SourceV1 labels(List labels) { - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SourceV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SourceV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + this.labels = labels; + return this; + } + + public SourceV1 addLabelsItem(LabelV1 labelsItem) { + if (this.labels == null) { + this.labels = new ArrayList<>(); } - } + this.labels.add(labelsItem); + return this; + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SourceV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + /** + * A list of labels applied to the Source. + * + * @return labels + */ + @javax.annotation.Nonnull + public List getLabels() { + return labels; + } + + public void setLabels(List labels) { + this.labels = labels; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } - } - 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("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("workspaceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceId").toString())); - } - // ensure the required json array is present - if (jsonObj.get("writeKeys") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("writeKeys").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `writeKeys` to be an array in the JSON string but got `%s`", jsonObj.get("writeKeys").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("labels").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `labels` to be an array in the JSON string but got `%s`", jsonObj.get("labels").toString())); - } - - JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") + SourceV1 sourceV1 = (SourceV1) o; + return Objects.equals(this.id, sourceV1.id) + && Objects.equals(this.slug, sourceV1.slug) + && Objects.equals(this.name, sourceV1.name) + && Objects.equals(this.metadata, sourceV1.metadata) + && Objects.equals(this.workspaceId, sourceV1.workspaceId) + && Objects.equals(this.enabled, sourceV1.enabled) + && Objects.equals(this.writeKeys, sourceV1.writeKeys) + && Objects.equals(this.settings, sourceV1.settings) + && Objects.equals(this.labels, sourceV1.labels); + } + @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SourceV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SourceV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SourceV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SourceV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SourceV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of SourceV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of SourceV1 - * @throws IOException if the JSON string is invalid with respect to SourceV1 - */ - public static SourceV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SourceV1.class); - } - - /** - * Convert an instance of SourceV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public int hashCode() { + return Objects.hash( + id, slug, name, metadata, workspaceId, enabled, writeKeys, settings, labels); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SourceV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" writeKeys: ").append(toIndentedString(writeKeys)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("slug"); + openapiFields.add("name"); + openapiFields.add("metadata"); + openapiFields.add("workspaceId"); + openapiFields.add("enabled"); + openapiFields.add("writeKeys"); + openapiFields.add("settings"); + openapiFields.add("labels"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("slug"); + openapiRequiredFields.add("metadata"); + openapiRequiredFields.add("workspaceId"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("writeKeys"); + openapiRequiredFields.add("labels"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SourceV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SourceV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SourceV1 is not found in the empty" + + " JSON string", + SourceV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SourceV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `SourceV1`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SourceV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").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 required field `metadata` + SourceMetadataV1.validateJsonElement(jsonObj.get("metadata")); + if (!jsonObj.get("workspaceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `workspaceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("workspaceId").toString())); + } + // ensure the required json array is present + if (jsonObj.get("writeKeys") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("writeKeys").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `writeKeys` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("writeKeys").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("labels").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `labels` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("labels").toString())); + } + + JsonArray jsonArraylabels = jsonObj.getAsJsonArray("labels"); + // validate the required field `labels` (array) + for (int i = 0; i < jsonArraylabels.size(); i++) { + LabelV1.validateJsonElement(jsonArraylabels.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SourceV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SourceV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SourceV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SourceV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SourceV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SourceV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SourceV1 + * @throws IOException if the JSON string is invalid with respect to SourceV1 + */ + public static SourceV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SourceV1.class); + } + + /** + * Convert an instance of SourceV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Space.java b/src/main/java/com/segment/publicapi/models/Space.java index e8c56293..7e505e05 100644 --- a/src/main/java/com/segment/publicapi/models/Space.java +++ b/src/main/java/com/segment/publicapi/models/Space.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,276 +9,270 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Space matching the given id. - */ -@ApiModel(description = "Space matching the given id.") - +/** Space */ public class Space { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; + public static final String SERIALIZED_NAME_ID = "id"; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + @SerializedName(SERIALIZED_NAME_ID) + private String id; - public Space() { - } + public static final String SERIALIZED_NAME_SLUG = "slug"; - public Space id(String id) { - - this.id = id; - return this; - } + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; - /** - * Get id - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public static final String SERIALIZED_NAME_NAME = "name"; - public String getId() { - return id; - } + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public Space() {} - public void setId(String id) { - this.id = id; - } + public Space id(String id) { + this.id = id; + return this; + } - public Space slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * Get slug - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + /** + * Get id + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - public String getSlug() { - return slug; - } + public void setId(String id) { + this.id = id; + } + public Space slug(String slug) { - public void setSlug(String slug) { - this.slug = slug; - } + this.slug = slug; + return this; + } + /** + * Get slug + * + * @return slug + */ + @javax.annotation.Nonnull + public String getSlug() { + return slug; + } - public Space name(String name) { - - this.name = name; - return this; - } + public void setSlug(String slug) { + this.slug = slug; + } - /** - * Get name - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public Space name(String name) { - public String getName() { - return 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 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; + } + Space space = (Space) o; + return Objects.equals(this.id, space.id) + && Objects.equals(this.slug, space.slug) + && Objects.equals(this.name, space.name); + } + @Override + public int hashCode() { + return Objects.hash(id, slug, name); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Space {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - Space space = (Space) o; - return Objects.equals(this.id, space.id) && - Objects.equals(this.slug, space.slug) && - Objects.equals(this.name, space.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, slug, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Space {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).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"; + + 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("slug"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("slug"); + openapiRequiredFields.add("name"); } - return o.toString().replace("\n", "\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("slug"); - openapiFields.add("name"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("name"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Space - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Space.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Space is not found in the empty JSON string", Space.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Space + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Space.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Space is not found in the empty JSON" + + " string", + Space.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Space.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Space` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Space.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `Space`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Space.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Space.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").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("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("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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 (!Space.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Space' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Space.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Space value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Space read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of Space given an JSON string - * - * @param jsonString JSON string - * @return An instance of Space - * @throws IOException if the JSON string is invalid with respect to Space - */ - public static Space fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Space.class); - } - - /** - * Convert an instance of Space to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Space.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Space' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Space.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Space value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Space read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of Space given an JSON string + * + * @param jsonString JSON string + * @return An instance of Space + * @throws IOException if the JSON string is invalid with respect to Space + */ + public static Space fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Space.class); + } + + /** + * Convert an instance of Space to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/SpaceWarehouseSchemaOverride.java b/src/main/java/com/segment/publicapi/models/SpaceWarehouseSchemaOverride.java new file mode 100644 index 00000000..06014ded --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/SpaceWarehouseSchemaOverride.java @@ -0,0 +1,280 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * Overrides the enabled or disabled state of the specified collection and / or properties within + * the schema. + */ +public class SpaceWarehouseSchemaOverride { + public static final String SERIALIZED_NAME_COLLECTION = "collection"; + + @SerializedName(SERIALIZED_NAME_COLLECTION) + private String collection; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_PROPERTY = "property"; + + @SerializedName(SERIALIZED_NAME_PROPERTY) + private String property; + + public SpaceWarehouseSchemaOverride() {} + + public SpaceWarehouseSchemaOverride collection(String collection) { + + this.collection = collection; + return this; + } + + /** + * The collection within the Source. + * + * @return collection + */ + @javax.annotation.Nonnull + public String getCollection() { + return collection; + } + + public void setCollection(String collection) { + this.collection = collection; + } + + public SpaceWarehouseSchemaOverride enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Represents the overridden enabled state for the listed collection and / or properties. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public SpaceWarehouseSchemaOverride property(String property) { + + this.property = property; + return this; + } + + /** + * A map that contains the properties within the collection to which the Warehouse should sync. + * + * @return property + */ + @javax.annotation.Nullable + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpaceWarehouseSchemaOverride spaceWarehouseSchemaOverride = + (SpaceWarehouseSchemaOverride) o; + return Objects.equals(this.collection, spaceWarehouseSchemaOverride.collection) + && Objects.equals(this.enabled, spaceWarehouseSchemaOverride.enabled) + && Objects.equals(this.property, spaceWarehouseSchemaOverride.property); + } + + @Override + public int hashCode() { + return Objects.hash(collection, enabled, property); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpaceWarehouseSchemaOverride {\n"); + sb.append(" collection: ").append(toIndentedString(collection)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("collection"); + openapiFields.add("enabled"); + openapiFields.add("property"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("collection"); + openapiRequiredFields.add("enabled"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * SpaceWarehouseSchemaOverride + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SpaceWarehouseSchemaOverride.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SpaceWarehouseSchemaOverride is not" + + " found in the empty JSON string", + SpaceWarehouseSchemaOverride.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SpaceWarehouseSchemaOverride.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SpaceWarehouseSchemaOverride` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SpaceWarehouseSchemaOverride.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("collection").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collection` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("collection").toString())); + } + if ((jsonObj.get("property") != null && !jsonObj.get("property").isJsonNull()) + && !jsonObj.get("property").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `property` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("property").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SpaceWarehouseSchemaOverride.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SpaceWarehouseSchemaOverride' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(SpaceWarehouseSchemaOverride.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SpaceWarehouseSchemaOverride value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SpaceWarehouseSchemaOverride read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SpaceWarehouseSchemaOverride given an JSON string + * + * @param jsonString JSON string + * @return An instance of SpaceWarehouseSchemaOverride + * @throws IOException if the JSON string is invalid with respect to + * SpaceWarehouseSchemaOverride + */ + public static SpaceWarehouseSchemaOverride fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SpaceWarehouseSchemaOverride.class); + } + + /** + * Convert an instance of SpaceWarehouseSchemaOverride to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/SpaceWarehouseSelectiveSyncItemAlpha.java b/src/main/java/com/segment/publicapi/models/SpaceWarehouseSelectiveSyncItemAlpha.java new file mode 100644 index 00000000..0ac52660 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/SpaceWarehouseSelectiveSyncItemAlpha.java @@ -0,0 +1,324 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * Represents an entry in the Space Warehouse Selective Sync schema for a Warehouse and Space pair. + */ +public class SpaceWarehouseSelectiveSyncItemAlpha { + public static final String SERIALIZED_NAME_COLLECTION = "collection"; + + @SerializedName(SERIALIZED_NAME_COLLECTION) + private String collection; + + public static final String SERIALIZED_NAME_WAREHOUSE_ID = "warehouseId"; + + @SerializedName(SERIALIZED_NAME_WAREHOUSE_ID) + private String warehouseId; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private Map properties = new HashMap<>(); + + public SpaceWarehouseSelectiveSyncItemAlpha() {} + + public SpaceWarehouseSelectiveSyncItemAlpha collection(String collection) { + + this.collection = collection; + return this; + } + + /** + * The collection within the Source. + * + * @return collection + */ + @javax.annotation.Nonnull + public String getCollection() { + return collection; + } + + public void setCollection(String collection) { + this.collection = collection; + } + + public SpaceWarehouseSelectiveSyncItemAlpha warehouseId(String warehouseId) { + + this.warehouseId = warehouseId; + return this; + } + + /** + * The id of the Warehouse this sync belongs to. + * + * @return warehouseId + */ + @javax.annotation.Nonnull + public String getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(String warehouseId) { + this.warehouseId = warehouseId; + } + + public SpaceWarehouseSelectiveSyncItemAlpha enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * The Enabled flag ok telling whether the Collection is enabled or not. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public SpaceWarehouseSelectiveSyncItemAlpha properties(Map properties) { + + this.properties = properties; + return this; + } + + public SpaceWarehouseSelectiveSyncItemAlpha putPropertiesItem( + String key, Object propertiesItem) { + if (this.properties == null) { + this.properties = new HashMap<>(); + } + this.properties.put(key, propertiesItem); + return this; + } + + /** + * A map that contains the properties within the collection to which the Warehouse should sync. + * + * @return properties + */ + @javax.annotation.Nonnull + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpaceWarehouseSelectiveSyncItemAlpha spaceWarehouseSelectiveSyncItemAlpha = + (SpaceWarehouseSelectiveSyncItemAlpha) o; + return Objects.equals(this.collection, spaceWarehouseSelectiveSyncItemAlpha.collection) + && Objects.equals( + this.warehouseId, spaceWarehouseSelectiveSyncItemAlpha.warehouseId) + && Objects.equals(this.enabled, spaceWarehouseSelectiveSyncItemAlpha.enabled) + && Objects.equals(this.properties, spaceWarehouseSelectiveSyncItemAlpha.properties); + } + + @Override + public int hashCode() { + return Objects.hash(collection, warehouseId, enabled, properties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpaceWarehouseSelectiveSyncItemAlpha {\n"); + sb.append(" collection: ").append(toIndentedString(collection)).append("\n"); + sb.append(" warehouseId: ").append(toIndentedString(warehouseId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("collection"); + openapiFields.add("warehouseId"); + openapiFields.add("enabled"); + openapiFields.add("properties"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("collection"); + openapiRequiredFields.add("warehouseId"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("properties"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * SpaceWarehouseSelectiveSyncItemAlpha + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SpaceWarehouseSelectiveSyncItemAlpha.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SpaceWarehouseSelectiveSyncItemAlpha" + + " is not found in the empty JSON string", + SpaceWarehouseSelectiveSyncItemAlpha.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SpaceWarehouseSelectiveSyncItemAlpha.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SpaceWarehouseSelectiveSyncItemAlpha` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SpaceWarehouseSelectiveSyncItemAlpha.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("collection").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collection` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("collection").toString())); + } + if (!jsonObj.get("warehouseId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `warehouseId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("warehouseId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SpaceWarehouseSelectiveSyncItemAlpha.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SpaceWarehouseSelectiveSyncItemAlpha' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(SpaceWarehouseSelectiveSyncItemAlpha.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, SpaceWarehouseSelectiveSyncItemAlpha value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SpaceWarehouseSelectiveSyncItemAlpha read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SpaceWarehouseSelectiveSyncItemAlpha given an JSON string + * + * @param jsonString JSON string + * @return An instance of SpaceWarehouseSelectiveSyncItemAlpha + * @throws IOException if the JSON string is invalid with respect to + * SpaceWarehouseSelectiveSyncItemAlpha + */ + public static SpaceWarehouseSelectiveSyncItemAlpha fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, SpaceWarehouseSelectiveSyncItemAlpha.class); + } + + /** + * Convert an instance of SpaceWarehouseSelectiveSyncItemAlpha to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/SpecificDaysConfig.java b/src/main/java/com/segment/publicapi/models/SpecificDaysConfig.java new file mode 100644 index 00000000..cb518213 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/SpecificDaysConfig.java @@ -0,0 +1,308 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Configures a schedule for specific days and times. */ +public class SpecificDaysConfig { + public static final String SERIALIZED_NAME_DAYS = "days"; + + @SerializedName(SERIALIZED_NAME_DAYS) + private List days = new ArrayList<>(); + + public static final String SERIALIZED_NAME_HOURS = "hours"; + + @SerializedName(SERIALIZED_NAME_HOURS) + private List hours = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TIMEZONE = "timezone"; + + @SerializedName(SERIALIZED_NAME_TIMEZONE) + private String timezone; + + public SpecificDaysConfig() {} + + public SpecificDaysConfig days(List days) { + + this.days = days; + return this; + } + + public SpecificDaysConfig addDaysItem(BigDecimal daysItem) { + if (this.days == null) { + this.days = new ArrayList<>(); + } + this.days.add(daysItem); + return this; + } + + /** + * Days of week for schedule (0=Sunday, 6=Saturday). + * + * @return days + */ + @javax.annotation.Nonnull + public List getDays() { + return days; + } + + public void setDays(List days) { + this.days = days; + } + + public SpecificDaysConfig hours(List hours) { + + this.hours = hours; + return this; + } + + public SpecificDaysConfig addHoursItem(BigDecimal hoursItem) { + if (this.hours == null) { + this.hours = new ArrayList<>(); + } + this.hours.add(hoursItem); + return this; + } + + /** + * Hours of day for schedule (0-23). + * + * @return hours + */ + @javax.annotation.Nonnull + public List getHours() { + return hours; + } + + public void setHours(List hours) { + this.hours = hours; + } + + public SpecificDaysConfig timezone(String timezone) { + + this.timezone = timezone; + return this; + } + + /** + * TZ database time zone identifier; for example, America/New_York. + * + * @return timezone + */ + @javax.annotation.Nonnull + public String getTimezone() { + return timezone; + } + + public void setTimezone(String timezone) { + this.timezone = timezone; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecificDaysConfig specificDaysConfig = (SpecificDaysConfig) o; + return Objects.equals(this.days, specificDaysConfig.days) + && Objects.equals(this.hours, specificDaysConfig.hours) + && Objects.equals(this.timezone, specificDaysConfig.timezone); + } + + @Override + public int hashCode() { + return Objects.hash(days, hours, timezone); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecificDaysConfig {\n"); + sb.append(" days: ").append(toIndentedString(days)).append("\n"); + sb.append(" hours: ").append(toIndentedString(hours)).append("\n"); + sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("days"); + openapiFields.add("hours"); + openapiFields.add("timezone"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("days"); + openapiRequiredFields.add("hours"); + openapiRequiredFields.add("timezone"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SpecificDaysConfig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SpecificDaysConfig.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SpecificDaysConfig is not found in the" + + " empty JSON string", + SpecificDaysConfig.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SpecificDaysConfig.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SpecificDaysConfig` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SpecificDaysConfig.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 required json array is present + if (jsonObj.get("days") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("days").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `days` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("days").toString())); + } + // ensure the required json array is present + if (jsonObj.get("hours") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("hours").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `hours` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("hours").toString())); + } + if (!jsonObj.get("timezone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `timezone` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("timezone").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SpecificDaysConfig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SpecificDaysConfig' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SpecificDaysConfig.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SpecificDaysConfig value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SpecificDaysConfig read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SpecificDaysConfig given an JSON string + * + * @param jsonString JSON string + * @return An instance of SpecificDaysConfig + * @throws IOException if the JSON string is invalid with respect to SpecificDaysConfig + */ + public static SpecificDaysConfig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SpecificDaysConfig.class); + } + + /** + * Convert an instance of SpecificDaysConfig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/StreamStatusV1.java b/src/main/java/com/segment/publicapi/models/StreamStatusV1.java index 6d3e3b2c..81abfce9 100644 --- a/src/main/java/com/segment/publicapi/models/StreamStatusV1.java +++ b/src/main/java/com/segment/publicapi/models/StreamStatusV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,258 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DestinationStatusV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - /** - * StreamStatus represents status of each stream including all the Destinations corresponding to the stream. + * StreamStatus represents status of each stream including all the Destinations corresponding to the + * stream. */ -@ApiModel(description = "StreamStatus represents status of each stream including all the Destinations corresponding to the stream.") - public class StreamStatusV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + public static final String SERIALIZED_NAME_ID = "id"; - public static final String SERIALIZED_NAME_DESTINATION_STATUS = "destinationStatus"; - @SerializedName(SERIALIZED_NAME_DESTINATION_STATUS) - private List destinationStatus = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_ID) + private String id; - public StreamStatusV1() { - } + public static final String SERIALIZED_NAME_DESTINATION_STATUS = "destinationStatus"; - public StreamStatusV1 id(String id) { - - this.id = id; - return this; - } + @SerializedName(SERIALIZED_NAME_DESTINATION_STATUS) + private List destinationStatus = new ArrayList<>(); - /** - * Get id - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public StreamStatusV1() {} - public String getId() { - return id; - } + public StreamStatusV1 id(String id) { + this.id = id; + return this; + } - public void setId(String id) { - this.id = id; - } - + /** + * Get id + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - public StreamStatusV1 destinationStatus(List destinationStatus) { - - this.destinationStatus = destinationStatus; - return this; - } + public void setId(String id) { + this.id = id; + } - public StreamStatusV1 addDestinationStatusItem(DestinationStatusV1 destinationStatusItem) { - this.destinationStatus.add(destinationStatusItem); - return this; - } + public StreamStatusV1 destinationStatus(List destinationStatus) { - /** - * Get destinationStatus - * @return destinationStatus - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + this.destinationStatus = destinationStatus; + return this; + } - public List getDestinationStatus() { - return destinationStatus; - } + public StreamStatusV1 addDestinationStatusItem(DestinationStatusV1 destinationStatusItem) { + if (this.destinationStatus == null) { + this.destinationStatus = new ArrayList<>(); + } + this.destinationStatus.add(destinationStatusItem); + return this; + } + /** + * Get destinationStatus + * + * @return destinationStatus + */ + @javax.annotation.Nonnull + public List getDestinationStatus() { + return destinationStatus; + } - public void setDestinationStatus(List destinationStatus) { - this.destinationStatus = destinationStatus; - } + public void setDestinationStatus(List destinationStatus) { + this.destinationStatus = destinationStatus; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StreamStatusV1 streamStatusV1 = (StreamStatusV1) o; + return Objects.equals(this.id, streamStatusV1.id) + && Objects.equals(this.destinationStatus, streamStatusV1.destinationStatus); + } + @Override + public int hashCode() { + return Objects.hash(id, destinationStatus); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StreamStatusV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" destinationStatus: ") + .append(toIndentedString(destinationStatus)) + .append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - StreamStatusV1 streamStatusV1 = (StreamStatusV1) o; - return Objects.equals(this.id, streamStatusV1.id) && - Objects.equals(this.destinationStatus, streamStatusV1.destinationStatus); - } - - @Override - public int hashCode() { - return Objects.hash(id, destinationStatus); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class StreamStatusV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" destinationStatus: ").append(toIndentedString(destinationStatus)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("destinationStatus"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("destinationStatus"); } - return o.toString().replace("\n", "\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("destinationStatus"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("destinationStatus"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to StreamStatusV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!StreamStatusV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in StreamStatusV1 is not found in the empty JSON string", StreamStatusV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StreamStatusV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StreamStatusV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in StreamStatusV1 is not found in the" + + " empty JSON string", + StreamStatusV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!StreamStatusV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StreamStatusV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StreamStatusV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `StreamStatusV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : StreamStatusV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StreamStatusV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.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())); - } - // ensure the json data is an array - if (!jsonObj.get("destinationStatus").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationStatus` to be an array in the JSON string but got `%s`", jsonObj.get("destinationStatus").toString())); - } - - JsonArray jsonArraydestinationStatus = jsonObj.getAsJsonArray("destinationStatus"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!StreamStatusV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'StreamStatusV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(StreamStatusV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, StreamStatusV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public StreamStatusV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + 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())); + } + // ensure the json data is an array + if (!jsonObj.get("destinationStatus").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `destinationStatus` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("destinationStatus").toString())); + } + + JsonArray jsonArraydestinationStatus = jsonObj.getAsJsonArray("destinationStatus"); + // validate the required field `destinationStatus` (array) + for (int i = 0; i < jsonArraydestinationStatus.size(); i++) { + DestinationStatusV1.validateJsonElement(jsonArraydestinationStatus.get(i)); + } + ; } - } - - /** - * Create an instance of StreamStatusV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of StreamStatusV1 - * @throws IOException if the JSON string is invalid with respect to StreamStatusV1 - */ - public static StreamStatusV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, StreamStatusV1.class); - } - - /** - * Convert an instance of StreamStatusV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StreamStatusV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StreamStatusV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(StreamStatusV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, StreamStatusV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StreamStatusV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of StreamStatusV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of StreamStatusV1 + * @throws IOException if the JSON string is invalid with respect to StreamStatusV1 + */ + public static StreamStatusV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StreamStatusV1.class); + } + + /** + * Convert an instance of StreamStatusV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Subscription.java b/src/main/java/com/segment/publicapi/models/Subscription.java deleted file mode 100644 index d0746a5a..00000000 --- a/src/main/java/com/segment/publicapi/models/Subscription.java +++ /dev/null @@ -1,450 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The Destination subscription. - */ -@ApiModel(description = "The Destination subscription.") - -public class Subscription { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_ACTION_ID = "actionId"; - @SerializedName(SERIALIZED_NAME_ACTION_ID) - private String actionId; - - public static final String SERIALIZED_NAME_ACTION_SLUG = "actionSlug"; - @SerializedName(SERIALIZED_NAME_ACTION_SLUG) - private String actionSlug; - - public static final String SERIALIZED_NAME_DESTINATION_ID = "destinationId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_ID) - private String destinationId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; - - public static final String SERIALIZED_NAME_TRIGGER = "trigger"; - @SerializedName(SERIALIZED_NAME_TRIGGER) - private String trigger; - - public Subscription() { - } - - public Subscription id(String id) { - - this.id = id; - return this; - } - - /** - * The unique identifier for the subscription. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier for the subscription.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Subscription name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the subscription. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the subscription.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Subscription actionId(String actionId) { - - this.actionId = actionId; - return this; - } - - /** - * The unique identifier for the Destination action to trigger. - * @return actionId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier for the Destination action to trigger.") - - public String getActionId() { - return actionId; - } - - - public void setActionId(String actionId) { - this.actionId = actionId; - } - - - public Subscription actionSlug(String actionSlug) { - - this.actionSlug = actionSlug; - return this; - } - - /** - * The URL-friendly key for the associated Destination action. - * @return actionSlug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The URL-friendly key for the associated Destination action.") - - public String getActionSlug() { - return actionSlug; - } - - - public void setActionSlug(String actionSlug) { - this.actionSlug = actionSlug; - } - - - public Subscription destinationId(String destinationId) { - - this.destinationId = destinationId; - return this; - } - - /** - * The associated Destination instance id. - * @return destinationId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The associated Destination instance id.") - - public String getDestinationId() { - return destinationId; - } - - - public void setDestinationId(String destinationId) { - this.destinationId = destinationId; - } - - - public Subscription enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Is the subscription enabled. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Is the subscription enabled.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Subscription settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The customer settings for action fields. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The customer settings for action fields.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - public Subscription trigger(String trigger) { - - this.trigger = trigger; - return this; - } - - /** - * FQL string that describes what events should trigger a Destination action. - * @return trigger - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "FQL string that describes what events should trigger a Destination action.") - - public String getTrigger() { - return trigger; - } - - - public void setTrigger(String trigger) { - this.trigger = trigger; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Subscription subscription = (Subscription) o; - return Objects.equals(this.id, subscription.id) && - Objects.equals(this.name, subscription.name) && - Objects.equals(this.actionId, subscription.actionId) && - Objects.equals(this.actionSlug, subscription.actionSlug) && - Objects.equals(this.destinationId, subscription.destinationId) && - Objects.equals(this.enabled, subscription.enabled) && - Objects.equals(this.settings, subscription.settings) && - Objects.equals(this.trigger, subscription.trigger); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, actionId, actionSlug, destinationId, enabled, settings, trigger); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Subscription {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" actionId: ").append(toIndentedString(actionId)).append("\n"); - sb.append(" actionSlug: ").append(toIndentedString(actionSlug)).append("\n"); - sb.append(" destinationId: ").append(toIndentedString(destinationId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("actionId"); - openapiFields.add("actionSlug"); - openapiFields.add("destinationId"); - openapiFields.add("enabled"); - openapiFields.add("settings"); - openapiFields.add("trigger"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("actionId"); - openapiRequiredFields.add("actionSlug"); - openapiRequiredFields.add("destinationId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("settings"); - openapiRequiredFields.add("trigger"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Subscription - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Subscription.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Subscription is not found in the empty JSON string", Subscription.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Subscription.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Subscription` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Subscription.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("actionId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `actionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actionId").toString())); - } - if (!jsonObj.get("actionSlug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `actionSlug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actionSlug").toString())); - } - if (!jsonObj.get("destinationId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationId").toString())); - } - if (!jsonObj.get("trigger").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `trigger` to be a primitive type in the JSON string but got `%s`", jsonObj.get("trigger").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Subscription.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Subscription' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Subscription.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Subscription value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Subscription read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Subscription given an JSON string - * - * @param jsonString JSON string - * @return An instance of Subscription - * @throws IOException if the JSON string is invalid with respect to Subscription - */ - public static Subscription fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Subscription.class); - } - - /** - * Convert an instance of Subscription to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/SupportedFeatures.java b/src/main/java/com/segment/publicapi/models/SupportedFeatures.java deleted file mode 100644 index 6ed2e0a5..00000000 --- a/src/main/java/com/segment/publicapi/models/SupportedFeatures.java +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * Features that this Destination supports. Config API note: holds `browserUnbundling` fields. - */ -@ApiModel(description = "Features that this Destination supports. Config API note: holds `browserUnbundling` fields.") - -public class SupportedFeatures { - /** - * This Destination's support level for cloud mode instances. The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent. - */ - @JsonAdapter(CloudModeInstancesEnum.Adapter.class) - public enum CloudModeInstancesEnum { - _0("0"), - - _1("1"), - - MULTIPLE("MULTIPLE"), - - NONE("NONE"), - - SINGLE("SINGLE"); - - private String value; - - CloudModeInstancesEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static CloudModeInstancesEnum fromValue(String value) { - for (CloudModeInstancesEnum b : CloudModeInstancesEnum.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 CloudModeInstancesEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public CloudModeInstancesEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return CloudModeInstancesEnum.fromValue(value); - } - } - } - - public static final String SERIALIZED_NAME_CLOUD_MODE_INSTANCES = "cloudModeInstances"; - @SerializedName(SERIALIZED_NAME_CLOUD_MODE_INSTANCES) - private CloudModeInstancesEnum cloudModeInstances; - - /** - * This Destination's support level for device mode instances. Support for multiple device mode instances is currently not planned. The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent. - */ - @JsonAdapter(DeviceModeInstancesEnum.Adapter.class) - public enum DeviceModeInstancesEnum { - _0("0"), - - _1("1"), - - NONE("NONE"), - - SINGLE("SINGLE"); - - private String value; - - DeviceModeInstancesEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static DeviceModeInstancesEnum fromValue(String value) { - for (DeviceModeInstancesEnum b : DeviceModeInstancesEnum.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 DeviceModeInstancesEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public DeviceModeInstancesEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return DeviceModeInstancesEnum.fromValue(value); - } - } - } - - public static final String SERIALIZED_NAME_DEVICE_MODE_INSTANCES = "deviceModeInstances"; - @SerializedName(SERIALIZED_NAME_DEVICE_MODE_INSTANCES) - private DeviceModeInstancesEnum deviceModeInstances; - - public static final String SERIALIZED_NAME_REPLAY = "replay"; - @SerializedName(SERIALIZED_NAME_REPLAY) - private Boolean replay; - - public static final String SERIALIZED_NAME_BROWSER_UNBUNDLING = "browserUnbundling"; - @SerializedName(SERIALIZED_NAME_BROWSER_UNBUNDLING) - private Boolean browserUnbundling; - - public static final String SERIALIZED_NAME_BROWSER_UNBUNDLING_PUBLIC = "browserUnbundlingPublic"; - @SerializedName(SERIALIZED_NAME_BROWSER_UNBUNDLING_PUBLIC) - private Boolean browserUnbundlingPublic; - - public SupportedFeatures() { - } - - public SupportedFeatures cloudModeInstances(CloudModeInstancesEnum cloudModeInstances) { - - this.cloudModeInstances = cloudModeInstances; - return this; - } - - /** - * This Destination's support level for cloud mode instances. The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent. - * @return cloudModeInstances - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "This Destination's support level for cloud mode instances. The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent.") - - public CloudModeInstancesEnum getCloudModeInstances() { - return cloudModeInstances; - } - - - public void setCloudModeInstances(CloudModeInstancesEnum cloudModeInstances) { - this.cloudModeInstances = cloudModeInstances; - } - - - public SupportedFeatures deviceModeInstances(DeviceModeInstancesEnum deviceModeInstances) { - - this.deviceModeInstances = deviceModeInstances; - return this; - } - - /** - * This Destination's support level for device mode instances. Support for multiple device mode instances is currently not planned. The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent. - * @return deviceModeInstances - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "This Destination's support level for device mode instances. Support for multiple device mode instances is currently not planned. The values '0' and 'NONE', and '1' and 'SINGLE' are equivalent.") - - public DeviceModeInstancesEnum getDeviceModeInstances() { - return deviceModeInstances; - } - - - public void setDeviceModeInstances(DeviceModeInstancesEnum deviceModeInstances) { - this.deviceModeInstances = deviceModeInstances; - } - - - public SupportedFeatures replay(Boolean replay) { - - this.replay = replay; - return this; - } - - /** - * Whether this Destination supports replays. - * @return replay - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination supports replays.") - - public Boolean getReplay() { - return replay; - } - - - public void setReplay(Boolean replay) { - this.replay = replay; - } - - - public SupportedFeatures browserUnbundling(Boolean browserUnbundling) { - - this.browserUnbundling = browserUnbundling; - return this; - } - - /** - * Whether this Destination supports browser unbundling. - * @return browserUnbundling - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination supports browser unbundling.") - - public Boolean getBrowserUnbundling() { - return browserUnbundling; - } - - - public void setBrowserUnbundling(Boolean browserUnbundling) { - this.browserUnbundling = browserUnbundling; - } - - - public SupportedFeatures browserUnbundlingPublic(Boolean browserUnbundlingPublic) { - - this.browserUnbundlingPublic = browserUnbundlingPublic; - return this; - } - - /** - * Whether this Destination supports public browser unbundling. - * @return browserUnbundlingPublic - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination supports public browser unbundling.") - - public Boolean getBrowserUnbundlingPublic() { - return browserUnbundlingPublic; - } - - - public void setBrowserUnbundlingPublic(Boolean browserUnbundlingPublic) { - this.browserUnbundlingPublic = browserUnbundlingPublic; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SupportedFeatures supportedFeatures = (SupportedFeatures) o; - return Objects.equals(this.cloudModeInstances, supportedFeatures.cloudModeInstances) && - Objects.equals(this.deviceModeInstances, supportedFeatures.deviceModeInstances) && - Objects.equals(this.replay, supportedFeatures.replay) && - Objects.equals(this.browserUnbundling, supportedFeatures.browserUnbundling) && - Objects.equals(this.browserUnbundlingPublic, supportedFeatures.browserUnbundlingPublic); - } - - @Override - public int hashCode() { - return Objects.hash(cloudModeInstances, deviceModeInstances, replay, browserUnbundling, browserUnbundlingPublic); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SupportedFeatures {\n"); - sb.append(" cloudModeInstances: ").append(toIndentedString(cloudModeInstances)).append("\n"); - sb.append(" deviceModeInstances: ").append(toIndentedString(deviceModeInstances)).append("\n"); - sb.append(" replay: ").append(toIndentedString(replay)).append("\n"); - sb.append(" browserUnbundling: ").append(toIndentedString(browserUnbundling)).append("\n"); - sb.append(" browserUnbundlingPublic: ").append(toIndentedString(browserUnbundlingPublic)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("cloudModeInstances"); - openapiFields.add("deviceModeInstances"); - openapiFields.add("replay"); - openapiFields.add("browserUnbundling"); - openapiFields.add("browserUnbundlingPublic"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SupportedFeatures - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SupportedFeatures.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SupportedFeatures is not found in the empty JSON string", SupportedFeatures.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SupportedFeatures.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SupportedFeatures` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - if ((jsonObj.get("cloudModeInstances") != null && !jsonObj.get("cloudModeInstances").isJsonNull()) && !jsonObj.get("cloudModeInstances").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `cloudModeInstances` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cloudModeInstances").toString())); - } - if ((jsonObj.get("deviceModeInstances") != null && !jsonObj.get("deviceModeInstances").isJsonNull()) && !jsonObj.get("deviceModeInstances").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `deviceModeInstances` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deviceModeInstances").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SupportedFeatures.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SupportedFeatures' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SupportedFeatures.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SupportedFeatures value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SupportedFeatures read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of SupportedFeatures given an JSON string - * - * @param jsonString JSON string - * @return An instance of SupportedFeatures - * @throws IOException if the JSON string is invalid with respect to SupportedFeatures - */ - public static SupportedFeatures fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SupportedFeatures.class); - } - - /** - * Convert an instance of SupportedFeatures to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/SupportedMethods.java b/src/main/java/com/segment/publicapi/models/SupportedMethods.java deleted file mode 100644 index df66670c..00000000 --- a/src/main/java/com/segment/publicapi/models/SupportedMethods.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * Methods that this Destination supports. Config API note: equal to `methods`. - */ -@ApiModel(description = "Methods that this Destination supports. Config API note: equal to `methods`.") - -public class SupportedMethods { - public static final String SERIALIZED_NAME_PAGEVIEW = "pageview"; - @SerializedName(SERIALIZED_NAME_PAGEVIEW) - private Boolean pageview; - - public static final String SERIALIZED_NAME_IDENTIFY = "identify"; - @SerializedName(SERIALIZED_NAME_IDENTIFY) - private Boolean identify; - - public static final String SERIALIZED_NAME_ALIAS = "alias"; - @SerializedName(SERIALIZED_NAME_ALIAS) - private Boolean alias; - - public static final String SERIALIZED_NAME_TRACK = "track"; - @SerializedName(SERIALIZED_NAME_TRACK) - private Boolean track; - - public static final String SERIALIZED_NAME_GROUP = "group"; - @SerializedName(SERIALIZED_NAME_GROUP) - private Boolean group; - - public SupportedMethods() { - } - - public SupportedMethods pageview(Boolean pageview) { - - this.pageview = pageview; - return this; - } - - /** - * Identifies if the Destination supports the `pageview` method. - * @return pageview - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Identifies if the Destination supports the `pageview` method.") - - public Boolean getPageview() { - return pageview; - } - - - public void setPageview(Boolean pageview) { - this.pageview = pageview; - } - - - public SupportedMethods identify(Boolean identify) { - - this.identify = identify; - return this; - } - - /** - * Identifies if the Destination supports the `identify` method. - * @return identify - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Identifies if the Destination supports the `identify` method.") - - public Boolean getIdentify() { - return identify; - } - - - public void setIdentify(Boolean identify) { - this.identify = identify; - } - - - public SupportedMethods alias(Boolean alias) { - - this.alias = alias; - return this; - } - - /** - * Identifies if the Destination supports the `alias` method. - * @return alias - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Identifies if the Destination supports the `alias` method.") - - public Boolean getAlias() { - return alias; - } - - - public void setAlias(Boolean alias) { - this.alias = alias; - } - - - public SupportedMethods track(Boolean track) { - - this.track = track; - return this; - } - - /** - * Identifies if the Destination supports the `track` method. - * @return track - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Identifies if the Destination supports the `track` method.") - - public Boolean getTrack() { - return track; - } - - - public void setTrack(Boolean track) { - this.track = track; - } - - - public SupportedMethods group(Boolean group) { - - this.group = group; - return this; - } - - /** - * Identifies if the Destination supports the `group` method. - * @return group - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Identifies if the Destination supports the `group` method.") - - public Boolean getGroup() { - return group; - } - - - public void setGroup(Boolean group) { - this.group = group; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SupportedMethods supportedMethods = (SupportedMethods) o; - return Objects.equals(this.pageview, supportedMethods.pageview) && - Objects.equals(this.identify, supportedMethods.identify) && - Objects.equals(this.alias, supportedMethods.alias) && - Objects.equals(this.track, supportedMethods.track) && - Objects.equals(this.group, supportedMethods.group); - } - - @Override - public int hashCode() { - return Objects.hash(pageview, identify, alias, track, group); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SupportedMethods {\n"); - sb.append(" pageview: ").append(toIndentedString(pageview)).append("\n"); - sb.append(" identify: ").append(toIndentedString(identify)).append("\n"); - sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); - sb.append(" track: ").append(toIndentedString(track)).append("\n"); - sb.append(" group: ").append(toIndentedString(group)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("pageview"); - openapiFields.add("identify"); - openapiFields.add("alias"); - openapiFields.add("track"); - openapiFields.add("group"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SupportedMethods - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SupportedMethods.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SupportedMethods is not found in the empty JSON string", SupportedMethods.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SupportedMethods.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SupportedMethods` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SupportedMethods.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SupportedMethods' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SupportedMethods.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SupportedMethods value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SupportedMethods read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of SupportedMethods given an JSON string - * - * @param jsonString JSON string - * @return An instance of SupportedMethods - * @throws IOException if the JSON string is invalid with respect to SupportedMethods - */ - public static SupportedMethods fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SupportedMethods.class); - } - - /** - * Convert an instance of SupportedMethods to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/SupportedPlatforms.java b/src/main/java/com/segment/publicapi/models/SupportedPlatforms.java deleted file mode 100644 index 9ba16920..00000000 --- a/src/main/java/com/segment/publicapi/models/SupportedPlatforms.java +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * Platforms from which the Destination receives events. Config API note: equal to `platforms`. - */ -@ApiModel(description = "Platforms from which the Destination receives events. Config API note: equal to `platforms`.") - -public class SupportedPlatforms { - public static final String SERIALIZED_NAME_BROWSER = "browser"; - @SerializedName(SERIALIZED_NAME_BROWSER) - private Boolean browser; - - public static final String SERIALIZED_NAME_SERVER = "server"; - @SerializedName(SERIALIZED_NAME_SERVER) - private Boolean server; - - public static final String SERIALIZED_NAME_MOBILE = "mobile"; - @SerializedName(SERIALIZED_NAME_MOBILE) - private Boolean mobile; - - public SupportedPlatforms() { - } - - public SupportedPlatforms browser(Boolean browser) { - - this.browser = browser; - return this; - } - - /** - * Whether this Destination supports browser events. - * @return browser - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination supports browser events.") - - public Boolean getBrowser() { - return browser; - } - - - public void setBrowser(Boolean browser) { - this.browser = browser; - } - - - public SupportedPlatforms server(Boolean server) { - - this.server = server; - return this; - } - - /** - * Whether this Destination supports server events. - * @return server - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination supports server events.") - - public Boolean getServer() { - return server; - } - - - public void setServer(Boolean server) { - this.server = server; - } - - - public SupportedPlatforms mobile(Boolean mobile) { - - this.mobile = mobile; - return this; - } - - /** - * Whether this Destination supports mobile events. - * @return mobile - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination supports mobile events.") - - public Boolean getMobile() { - return mobile; - } - - - public void setMobile(Boolean mobile) { - this.mobile = mobile; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SupportedPlatforms supportedPlatforms = (SupportedPlatforms) o; - return Objects.equals(this.browser, supportedPlatforms.browser) && - Objects.equals(this.server, supportedPlatforms.server) && - Objects.equals(this.mobile, supportedPlatforms.mobile); - } - - @Override - public int hashCode() { - return Objects.hash(browser, server, mobile); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SupportedPlatforms {\n"); - sb.append(" browser: ").append(toIndentedString(browser)).append("\n"); - sb.append(" server: ").append(toIndentedString(server)).append("\n"); - sb.append(" mobile: ").append(toIndentedString(mobile)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("browser"); - openapiFields.add("server"); - openapiFields.add("mobile"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SupportedPlatforms - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SupportedPlatforms.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SupportedPlatforms is not found in the empty JSON string", SupportedPlatforms.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SupportedPlatforms.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SupportedPlatforms` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SupportedPlatforms.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SupportedPlatforms' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SupportedPlatforms.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SupportedPlatforms value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SupportedPlatforms read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of SupportedPlatforms given an JSON string - * - * @param jsonString JSON string - * @return An instance of SupportedPlatforms - * @throws IOException if the JSON string is invalid with respect to SupportedPlatforms - */ - public static SupportedPlatforms fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SupportedPlatforms.class); - } - - /** - * Convert an instance of SupportedPlatforms to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/SuppressedInner.java b/src/main/java/com/segment/publicapi/models/SuppressedInner.java index 693f1bf6..b5d3b480 100644 --- a/src/main/java/com/segment/publicapi/models/SuppressedInner.java +++ b/src/main/java/com/segment/publicapi/models/SuppressedInner.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,251 +9,250 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * SuppressedInner - */ - +/** SuppressedInner */ public class SuppressedInner { - public static final String SERIALIZED_NAME_SUBJECT_TYPE = "subjectType"; - @SerializedName(SERIALIZED_NAME_SUBJECT_TYPE) - private String subjectType; + public static final String SERIALIZED_NAME_SUBJECT_TYPE = "subjectType"; - public static final String SERIALIZED_NAME_SUBJECT_IDS = "subjectIds"; - @SerializedName(SERIALIZED_NAME_SUBJECT_IDS) - private List subjectIds = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_SUBJECT_TYPE) + private String subjectType; - public SuppressedInner() { - } + public static final String SERIALIZED_NAME_SUBJECT_IDS = "subjectIds"; - public SuppressedInner subjectType(String subjectType) { - - this.subjectType = subjectType; - return this; - } + @SerializedName(SERIALIZED_NAME_SUBJECT_IDS) + private List subjectIds = new ArrayList<>(); - /** - * Get subjectType - * @return subjectType - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public SuppressedInner() {} - public String getSubjectType() { - return subjectType; - } + public SuppressedInner subjectType(String subjectType) { + this.subjectType = subjectType; + return this; + } - public void setSubjectType(String subjectType) { - this.subjectType = subjectType; - } - - - public SuppressedInner subjectIds(List subjectIds) { - - this.subjectIds = subjectIds; - return this; - } - - public SuppressedInner addSubjectIdsItem(String subjectIdsItem) { - this.subjectIds.add(subjectIdsItem); - return this; - } - - /** - * Get subjectIds - * @return subjectIds - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public List getSubjectIds() { - return subjectIds; - } + /** + * Get subjectType + * + * @return subjectType + */ + @javax.annotation.Nonnull + public String getSubjectType() { + return subjectType; + } + public void setSubjectType(String subjectType) { + this.subjectType = subjectType; + } - public void setSubjectIds(List subjectIds) { - this.subjectIds = subjectIds; - } + public SuppressedInner subjectIds(List subjectIds) { + this.subjectIds = subjectIds; + return this; + } + public SuppressedInner addSubjectIdsItem(String subjectIdsItem) { + if (this.subjectIds == null) { + this.subjectIds = new ArrayList<>(); + } + this.subjectIds.add(subjectIdsItem); + return this; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get subjectIds + * + * @return subjectIds + */ + @javax.annotation.Nonnull + public List getSubjectIds() { + return subjectIds; } - if (o == null || getClass() != o.getClass()) { - return false; + + public void setSubjectIds(List subjectIds) { + this.subjectIds = subjectIds; } - SuppressedInner suppressedInner = (SuppressedInner) o; - return Objects.equals(this.subjectType, suppressedInner.subjectType) && - Objects.equals(this.subjectIds, suppressedInner.subjectIds); - } - @Override - public int hashCode() { - return Objects.hash(subjectType, subjectIds); - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SuppressedInner suppressedInner = (SuppressedInner) o; + return Objects.equals(this.subjectType, suppressedInner.subjectType) + && Objects.equals(this.subjectIds, suppressedInner.subjectIds); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SuppressedInner {\n"); - sb.append(" subjectType: ").append(toIndentedString(subjectType)).append("\n"); - sb.append(" subjectIds: ").append(toIndentedString(subjectIds)).append("\n"); - sb.append("}"); - return sb.toString(); - } + @Override + public int hashCode() { + return Objects.hash(subjectType, subjectIds); + } - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SuppressedInner {\n"); + sb.append(" subjectType: ").append(toIndentedString(subjectType)).append("\n"); + sb.append(" subjectIds: ").append(toIndentedString(subjectIds)).append("\n"); + sb.append("}"); + return sb.toString(); } - return o.toString().replace("\n", "\n "); - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("subjectType"); - openapiFields.add("subjectIds"); + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("subjectType"); + openapiFields.add("subjectIds"); - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("subjectType"); - openapiRequiredFields.add("subjectIds"); - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("subjectType"); + openapiRequiredFields.add("subjectIds"); + } - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SuppressedInner - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SuppressedInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SuppressedInner is not found in the empty JSON string", SuppressedInner.openapiRequiredFields.toString())); + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SuppressedInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SuppressedInner.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SuppressedInner is not found in the" + + " empty JSON string", + SuppressedInner.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SuppressedInner.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SuppressedInner` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SuppressedInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SuppressedInner` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SuppressedInner.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SuppressedInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } } - } - if (!jsonObj.get("subjectType").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `subjectType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subjectType").toString())); - } - // ensure the required json array is present - if (jsonObj.get("subjectIds") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("subjectIds").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `subjectIds` to be an array in the JSON string but got `%s`", jsonObj.get("subjectIds").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SuppressedInner.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SuppressedInner' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SuppressedInner.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SuppressedInner value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SuppressedInner read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("subjectType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `subjectType` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("subjectType").toString())); + } + // ensure the required json array is present + if (jsonObj.get("subjectIds") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("subjectIds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `subjectIds` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("subjectIds").toString())); + } + } - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SuppressedInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SuppressedInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SuppressedInner.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SuppressedInner value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SuppressedInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } } - } - /** - * Create an instance of SuppressedInner given an JSON string - * - * @param jsonString JSON string - * @return An instance of SuppressedInner - * @throws IOException if the JSON string is invalid with respect to SuppressedInner - */ - public static SuppressedInner fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SuppressedInner.class); - } + /** + * Create an instance of SuppressedInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of SuppressedInner + * @throws IOException if the JSON string is invalid with respect to SuppressedInner + */ + public static SuppressedInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SuppressedInner.class); + } - /** - * Convert an instance of SuppressedInner to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + /** + * Convert an instance of SuppressedInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } - diff --git a/src/main/java/com/segment/publicapi/models/SyncExtractPhase.java b/src/main/java/com/segment/publicapi/models/SyncExtractPhase.java new file mode 100644 index 00000000..af09ca5a --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/SyncExtractPhase.java @@ -0,0 +1,433 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Object representing the extract phase + details. */ +public class SyncExtractPhase { + public static final String SERIALIZED_NAME_ADDED_COUNT = "addedCount"; + + @SerializedName(SERIALIZED_NAME_ADDED_COUNT) + private String addedCount; + + public static final String SERIALIZED_NAME_UPDATED_COUNT = "updatedCount"; + + @SerializedName(SERIALIZED_NAME_UPDATED_COUNT) + private String updatedCount; + + public static final String SERIALIZED_NAME_DELETED_COUNT = "deletedCount"; + + @SerializedName(SERIALIZED_NAME_DELETED_COUNT) + private String deletedCount; + + public static final String SERIALIZED_NAME_EXTRACT_COUNT = "extractCount"; + + @SerializedName(SERIALIZED_NAME_EXTRACT_COUNT) + private String extractCount; + + public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; + + @SerializedName(SERIALIZED_NAME_ERROR_CODE) + private String errorCode; + + public static final String SERIALIZED_NAME_STARTED_AT = "startedAt"; + + @SerializedName(SERIALIZED_NAME_STARTED_AT) + private String startedAt; + + public static final String SERIALIZED_NAME_FINISHED_AT = "finishedAt"; + + @SerializedName(SERIALIZED_NAME_FINISHED_AT) + private String finishedAt; + + public SyncExtractPhase() {} + + public SyncExtractPhase addedCount(String addedCount) { + + this.addedCount = addedCount; + return this; + } + + /** + * Counts the subset of records with status=new, which indicates records that were + * created/inserted/added. + * + * @return addedCount + */ + @javax.annotation.Nonnull + public String getAddedCount() { + return addedCount; + } + + public void setAddedCount(String addedCount) { + this.addedCount = addedCount; + } + + public SyncExtractPhase updatedCount(String updatedCount) { + + this.updatedCount = updatedCount; + return this; + } + + /** + * Counts the subset of records with status=updated, which indicates records that were + * modified/updated. + * + * @return updatedCount + */ + @javax.annotation.Nonnull + public String getUpdatedCount() { + return updatedCount; + } + + public void setUpdatedCount(String updatedCount) { + this.updatedCount = updatedCount; + } + + public SyncExtractPhase deletedCount(String deletedCount) { + + this.deletedCount = deletedCount; + return this; + } + + /** + * Counts the subset of records with status=deleted, which indicates records that were + * deleted/removed. + * + * @return deletedCount + */ + @javax.annotation.Nonnull + public String getDeletedCount() { + return deletedCount; + } + + public void setDeletedCount(String deletedCount) { + this.deletedCount = deletedCount; + } + + public SyncExtractPhase extractCount(String extractCount) { + + this.extractCount = extractCount; + return this; + } + + /** + * Counts the total number of records/rows handled by extract, across all statuses. + * + * @return extractCount + */ + @javax.annotation.Nonnull + public String getExtractCount() { + return extractCount; + } + + public void setExtractCount(String extractCount) { + this.extractCount = extractCount; + } + + public SyncExtractPhase errorCode(String errorCode) { + + this.errorCode = errorCode; + return this; + } + + /** + * Error code indicates a fatal sync error code, if applicable. + * + * @return errorCode + */ + @javax.annotation.Nonnull + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public SyncExtractPhase startedAt(String startedAt) { + + this.startedAt = startedAt; + return this; + } + + /** + * Time that the extract phase started. + * + * @return startedAt + */ + @javax.annotation.Nonnull + public String getStartedAt() { + return startedAt; + } + + public void setStartedAt(String startedAt) { + this.startedAt = startedAt; + } + + public SyncExtractPhase finishedAt(String finishedAt) { + + this.finishedAt = finishedAt; + return this; + } + + /** + * Time that the extract phase finished. + * + * @return finishedAt + */ + @javax.annotation.Nonnull + public String getFinishedAt() { + return finishedAt; + } + + public void setFinishedAt(String finishedAt) { + this.finishedAt = finishedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SyncExtractPhase syncExtractPhase = (SyncExtractPhase) o; + return Objects.equals(this.addedCount, syncExtractPhase.addedCount) + && Objects.equals(this.updatedCount, syncExtractPhase.updatedCount) + && Objects.equals(this.deletedCount, syncExtractPhase.deletedCount) + && Objects.equals(this.extractCount, syncExtractPhase.extractCount) + && Objects.equals(this.errorCode, syncExtractPhase.errorCode) + && Objects.equals(this.startedAt, syncExtractPhase.startedAt) + && Objects.equals(this.finishedAt, syncExtractPhase.finishedAt); + } + + @Override + public int hashCode() { + return Objects.hash( + addedCount, + updatedCount, + deletedCount, + extractCount, + errorCode, + startedAt, + finishedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SyncExtractPhase {\n"); + sb.append(" addedCount: ").append(toIndentedString(addedCount)).append("\n"); + sb.append(" updatedCount: ").append(toIndentedString(updatedCount)).append("\n"); + sb.append(" deletedCount: ").append(toIndentedString(deletedCount)).append("\n"); + sb.append(" extractCount: ").append(toIndentedString(extractCount)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" startedAt: ").append(toIndentedString(startedAt)).append("\n"); + sb.append(" finishedAt: ").append(toIndentedString(finishedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("addedCount"); + openapiFields.add("updatedCount"); + openapiFields.add("deletedCount"); + openapiFields.add("extractCount"); + openapiFields.add("errorCode"); + openapiFields.add("startedAt"); + openapiFields.add("finishedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("addedCount"); + openapiRequiredFields.add("updatedCount"); + openapiRequiredFields.add("deletedCount"); + openapiRequiredFields.add("extractCount"); + openapiRequiredFields.add("errorCode"); + openapiRequiredFields.add("startedAt"); + openapiRequiredFields.add("finishedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SyncExtractPhase + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SyncExtractPhase.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SyncExtractPhase is not found in the" + + " empty JSON string", + SyncExtractPhase.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SyncExtractPhase.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SyncExtractPhase` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SyncExtractPhase.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("addedCount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `addedCount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("addedCount").toString())); + } + if (!jsonObj.get("updatedCount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `updatedCount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("updatedCount").toString())); + } + if (!jsonObj.get("deletedCount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `deletedCount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("deletedCount").toString())); + } + if (!jsonObj.get("extractCount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `extractCount` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("extractCount").toString())); + } + if (!jsonObj.get("errorCode").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorCode` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorCode").toString())); + } + if (!jsonObj.get("startedAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `startedAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("startedAt").toString())); + } + if (!jsonObj.get("finishedAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `finishedAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("finishedAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SyncExtractPhase.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SyncExtractPhase' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SyncExtractPhase.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SyncExtractPhase value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SyncExtractPhase read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SyncExtractPhase given an JSON string + * + * @param jsonString JSON string + * @return An instance of SyncExtractPhase + * @throws IOException if the JSON string is invalid with respect to SyncExtractPhase + */ + public static SyncExtractPhase fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SyncExtractPhase.class); + } + + /** + * Convert an instance of SyncExtractPhase to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/SyncLoadPhase.java b/src/main/java/com/segment/publicapi/models/SyncLoadPhase.java new file mode 100644 index 00000000..54275d86 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/SyncLoadPhase.java @@ -0,0 +1,357 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Object representing the load phase + details. */ +public class SyncLoadPhase { + public static final String SERIALIZED_NAME_DELIVER_SUCCESS_COUNT = "deliverSuccessCount"; + + @SerializedName(SERIALIZED_NAME_DELIVER_SUCCESS_COUNT) + private String deliverSuccessCount; + + public static final String SERIALIZED_NAME_DELIVER_FAILURE_COUNT = "deliverFailureCount"; + + @SerializedName(SERIALIZED_NAME_DELIVER_FAILURE_COUNT) + private String deliverFailureCount; + + public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; + + @SerializedName(SERIALIZED_NAME_ERROR_CODE) + private String errorCode; + + public static final String SERIALIZED_NAME_STARTED_AT = "startedAt"; + + @SerializedName(SERIALIZED_NAME_STARTED_AT) + private String startedAt; + + public static final String SERIALIZED_NAME_FINISHED_AT = "finishedAt"; + + @SerializedName(SERIALIZED_NAME_FINISHED_AT) + private String finishedAt; + + public SyncLoadPhase() {} + + public SyncLoadPhase deliverSuccessCount(String deliverSuccessCount) { + + this.deliverSuccessCount = deliverSuccessCount; + return this; + } + + /** + * Counts the subset of records successfully delivered to the downstream Destination. + * + * @return deliverSuccessCount + */ + @javax.annotation.Nonnull + public String getDeliverSuccessCount() { + return deliverSuccessCount; + } + + public void setDeliverSuccessCount(String deliverSuccessCount) { + this.deliverSuccessCount = deliverSuccessCount; + } + + public SyncLoadPhase deliverFailureCount(String deliverFailureCount) { + + this.deliverFailureCount = deliverFailureCount; + return this; + } + + /** + * Counts the subset of records status that failed to be delivered by either receiving a + * permanent error (for example, 400 Bad Request) or by exhausting all retries for temporary + * errors (for example, 429 Too Many Requests). + * + * @return deliverFailureCount + */ + @javax.annotation.Nonnull + public String getDeliverFailureCount() { + return deliverFailureCount; + } + + public void setDeliverFailureCount(String deliverFailureCount) { + this.deliverFailureCount = deliverFailureCount; + } + + public SyncLoadPhase errorCode(String errorCode) { + + this.errorCode = errorCode; + return this; + } + + /** + * Error code indicates a fatal sync error code, if applicable. + * + * @return errorCode + */ + @javax.annotation.Nonnull + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public SyncLoadPhase startedAt(String startedAt) { + + this.startedAt = startedAt; + return this; + } + + /** + * Time that the load phase started. + * + * @return startedAt + */ + @javax.annotation.Nonnull + public String getStartedAt() { + return startedAt; + } + + public void setStartedAt(String startedAt) { + this.startedAt = startedAt; + } + + public SyncLoadPhase finishedAt(String finishedAt) { + + this.finishedAt = finishedAt; + return this; + } + + /** + * Time that the load phase finished. + * + * @return finishedAt + */ + @javax.annotation.Nonnull + public String getFinishedAt() { + return finishedAt; + } + + public void setFinishedAt(String finishedAt) { + this.finishedAt = finishedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SyncLoadPhase syncLoadPhase = (SyncLoadPhase) o; + return Objects.equals(this.deliverSuccessCount, syncLoadPhase.deliverSuccessCount) + && Objects.equals(this.deliverFailureCount, syncLoadPhase.deliverFailureCount) + && Objects.equals(this.errorCode, syncLoadPhase.errorCode) + && Objects.equals(this.startedAt, syncLoadPhase.startedAt) + && Objects.equals(this.finishedAt, syncLoadPhase.finishedAt); + } + + @Override + public int hashCode() { + return Objects.hash( + deliverSuccessCount, deliverFailureCount, errorCode, startedAt, finishedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SyncLoadPhase {\n"); + sb.append(" deliverSuccessCount: ") + .append(toIndentedString(deliverSuccessCount)) + .append("\n"); + sb.append(" deliverFailureCount: ") + .append(toIndentedString(deliverFailureCount)) + .append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" startedAt: ").append(toIndentedString(startedAt)).append("\n"); + sb.append(" finishedAt: ").append(toIndentedString(finishedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("deliverSuccessCount"); + openapiFields.add("deliverFailureCount"); + openapiFields.add("errorCode"); + openapiFields.add("startedAt"); + openapiFields.add("finishedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("deliverSuccessCount"); + openapiRequiredFields.add("deliverFailureCount"); + openapiRequiredFields.add("errorCode"); + openapiRequiredFields.add("startedAt"); + openapiRequiredFields.add("finishedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SyncLoadPhase + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SyncLoadPhase.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SyncLoadPhase is not found in the" + + " empty JSON string", + SyncLoadPhase.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SyncLoadPhase.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SyncLoadPhase` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SyncLoadPhase.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("deliverSuccessCount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `deliverSuccessCount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("deliverSuccessCount").toString())); + } + if (!jsonObj.get("deliverFailureCount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `deliverFailureCount` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("deliverFailureCount").toString())); + } + if (!jsonObj.get("errorCode").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `errorCode` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("errorCode").toString())); + } + if (!jsonObj.get("startedAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `startedAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("startedAt").toString())); + } + if (!jsonObj.get("finishedAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `finishedAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("finishedAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SyncLoadPhase.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SyncLoadPhase' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SyncLoadPhase.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SyncLoadPhase value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SyncLoadPhase read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SyncLoadPhase given an JSON string + * + * @param jsonString JSON string + * @return An instance of SyncLoadPhase + * @throws IOException if the JSON string is invalid with respect to SyncLoadPhase + */ + public static SyncLoadPhase fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SyncLoadPhase.class); + } + + /** + * Convert an instance of SyncLoadPhase to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/SyncNoticeV1.java b/src/main/java/com/segment/publicapi/models/SyncNoticeV1.java index 37930c07..5995dcd4 100644 --- a/src/main/java/com/segment/publicapi/models/SyncNoticeV1.java +++ b/src/main/java/com/segment/publicapi/models/SyncNoticeV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,276 +9,270 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Represents a notice within a sync for a Source and Warehouse pair. - */ -@ApiModel(description = "Represents a notice within a sync for a Source and Warehouse pair.") - +/** Represents a notice within a sync for a Source and Warehouse pair. */ public class SyncNoticeV1 { - public static final String SERIALIZED_NAME_LEVEL = "level"; - @SerializedName(SERIALIZED_NAME_LEVEL) - private String level; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - private String message; + public static final String SERIALIZED_NAME_LEVEL = "level"; - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; + @SerializedName(SERIALIZED_NAME_LEVEL) + private String level; - public SyncNoticeV1() { - } + public static final String SERIALIZED_NAME_MESSAGE = "message"; - public SyncNoticeV1 level(String level) { - - this.level = level; - return this; - } + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; - /** - * The severity of the notice. - * @return level - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The severity of the notice.") + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - public String getLevel() { - return level; - } + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; + public SyncNoticeV1() {} - public void setLevel(String level) { - this.level = level; - } + public SyncNoticeV1 level(String level) { + this.level = level; + return this; + } - public SyncNoticeV1 message(String message) { - - this.message = message; - return this; - } - - /** - * The human-readable message that describes the notice. - * @return message - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The human-readable message that describes the notice.") + /** + * The severity of the notice. + * + * @return level + */ + @javax.annotation.Nonnull + public String getLevel() { + return level; + } - public String getMessage() { - return message; - } + public void setLevel(String level) { + this.level = level; + } + public SyncNoticeV1 message(String message) { - public void setMessage(String message) { - this.message = message; - } + this.message = message; + return this; + } + /** + * The human-readable message that describes the notice. + * + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } - public SyncNoticeV1 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } + public void setMessage(String message) { + this.message = message; + } - /** - * The timestamp of this sync notice's creation. - * @return createdAt - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The timestamp of this sync notice's creation.") + public SyncNoticeV1 createdAt(String createdAt) { - public String getCreatedAt() { - return createdAt; - } + this.createdAt = createdAt; + return this; + } + /** + * The timestamp of this sync notice's creation. + * + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SyncNoticeV1 syncNoticeV1 = (SyncNoticeV1) o; + return Objects.equals(this.level, syncNoticeV1.level) + && Objects.equals(this.message, syncNoticeV1.message) + && Objects.equals(this.createdAt, syncNoticeV1.createdAt); + } + @Override + public int hashCode() { + return Objects.hash(level, message, createdAt); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SyncNoticeV1 {\n"); + sb.append(" level: ").append(toIndentedString(level)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - SyncNoticeV1 syncNoticeV1 = (SyncNoticeV1) o; - return Objects.equals(this.level, syncNoticeV1.level) && - Objects.equals(this.message, syncNoticeV1.message) && - Objects.equals(this.createdAt, syncNoticeV1.createdAt); - } - - @Override - public int hashCode() { - return Objects.hash(level, message, createdAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SyncNoticeV1 {\n"); - sb.append(" level: ").append(toIndentedString(level)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("level"); + openapiFields.add("message"); + openapiFields.add("createdAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("level"); + openapiRequiredFields.add("message"); + openapiRequiredFields.add("createdAt"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("level"); - openapiFields.add("message"); - openapiFields.add("createdAt"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("level"); - openapiRequiredFields.add("message"); - openapiRequiredFields.add("createdAt"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SyncNoticeV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SyncNoticeV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SyncNoticeV1 is not found in the empty JSON string", SyncNoticeV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SyncNoticeV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SyncNoticeV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SyncNoticeV1 is not found in the empty" + + " JSON string", + SyncNoticeV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SyncNoticeV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SyncNoticeV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SyncNoticeV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `SyncNoticeV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SyncNoticeV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SyncNoticeV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("level").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `level` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("level").toString())); + } + if (!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("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdAt").toString())); } - } - if (!jsonObj.get("level").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `level` to be a primitive type in the JSON string but got `%s`", jsonObj.get("level").toString())); - } - if (!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("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SyncNoticeV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SyncNoticeV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SyncNoticeV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SyncNoticeV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SyncNoticeV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of SyncNoticeV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of SyncNoticeV1 - * @throws IOException if the JSON string is invalid with respect to SyncNoticeV1 - */ - public static SyncNoticeV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SyncNoticeV1.class); - } - - /** - * Convert an instance of SyncNoticeV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SyncNoticeV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SyncNoticeV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SyncNoticeV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SyncNoticeV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SyncNoticeV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SyncNoticeV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SyncNoticeV1 + * @throws IOException if the JSON string is invalid with respect to SyncNoticeV1 + */ + public static SyncNoticeV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SyncNoticeV1.class); + } + + /** + * Convert an instance of SyncNoticeV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/SyncV1.java b/src/main/java/com/segment/publicapi/models/SyncV1.java index 32a8b8f7..a86bb4df 100644 --- a/src/main/java/com/segment/publicapi/models/SyncV1.java +++ b/src/main/java/com/segment/publicapi/models/SyncV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,452 +9,461 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.segment.publicapi.models.SyncNoticeV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - /** - * Represents a sync between a Source and Warehouse. A sync occurs when data from a Source is loaded into a Warehouse. + * Represents a sync between a Source and Warehouse. A sync occurs when data from a Source is loaded + * into a Warehouse. */ -@ApiModel(description = "Represents a sync between a Source and Warehouse. A sync occurs when data from a Source is loaded into a Warehouse.") - public class SyncV1 { - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - public static final String SERIALIZED_NAME_START = "start"; - @SerializedName(SERIALIZED_NAME_START) - private String start; + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; - public static final String SERIALIZED_NAME_END = "end"; - @SerializedName(SERIALIZED_NAME_END) - private String end; + public static final String SERIALIZED_NAME_START = "start"; - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - private String status; - - public static final String SERIALIZED_NAME_DURATION = "duration"; - @SerializedName(SERIALIZED_NAME_DURATION) - private BigDecimal duration; - - public static final String SERIALIZED_NAME_HUMAN_DURATION = "humanDuration"; - @SerializedName(SERIALIZED_NAME_HUMAN_DURATION) - private String humanDuration; + @SerializedName(SERIALIZED_NAME_START) + private String start; - public static final String SERIALIZED_NAME_COUNT = "count"; - @SerializedName(SERIALIZED_NAME_COUNT) - private BigDecimal count; + public static final String SERIALIZED_NAME_END = "end"; - public static final String SERIALIZED_NAME_NOTICES = "notices"; - @SerializedName(SERIALIZED_NAME_NOTICES) - private List notices = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_END) + private String end; - public SyncV1() { - } + public static final String SERIALIZED_NAME_STATUS = "status"; - public SyncV1 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; - /** - * The id of the Source loaded in the sync. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source loaded in the sync.") + public static final String SERIALIZED_NAME_DURATION = "duration"; - public String getSourceId() { - return sourceId; - } + @SerializedName(SERIALIZED_NAME_DURATION) + private BigDecimal duration; + public static final String SERIALIZED_NAME_HUMAN_DURATION = "humanDuration"; - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + @SerializedName(SERIALIZED_NAME_HUMAN_DURATION) + private String humanDuration; + public static final String SERIALIZED_NAME_COUNT = "count"; - public SyncV1 start(String start) { - - this.start = start; - return this; - } + @SerializedName(SERIALIZED_NAME_COUNT) + private BigDecimal count; - /** - * The start time of the sync. - * @return start - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The start time of the sync.") + public static final String SERIALIZED_NAME_NOTICES = "notices"; - public String getStart() { - return start; - } + @SerializedName(SERIALIZED_NAME_NOTICES) + private List notices = new ArrayList<>(); + public SyncV1() {} - public void setStart(String start) { - this.start = start; - } + public SyncV1 sourceId(String sourceId) { + this.sourceId = sourceId; + return this; + } - public SyncV1 end(String end) { - - this.end = end; - return this; - } + /** + * The id of the Source loaded in the sync. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } - /** - * The time the sync completed. Returns null if unfinished. - * @return end - **/ - @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "The time the sync completed. Returns null if unfinished.") + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } - public String getEnd() { - return end; - } + public SyncV1 start(String start) { + this.start = start; + return this; + } - public void setEnd(String end) { - this.end = end; - } + /** + * The start time of the sync. + * + * @return start + */ + @javax.annotation.Nonnull + public String getStart() { + return start; + } + public void setStart(String start) { + this.start = start; + } - public SyncV1 status(String status) { - - this.status = status; - return this; - } + public SyncV1 end(String end) { - /** - * The status of the sync. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The status of the sync.") + this.end = end; + return this; + } - public String getStatus() { - return status; - } + /** + * The time the sync completed. Returns null if unfinished. + * + * @return end + */ + @javax.annotation.Nullable + public String getEnd() { + return end; + } + public void setEnd(String end) { + this.end = end; + } - public void setStatus(String status) { - this.status = status; - } + public SyncV1 status(String status) { + this.status = status; + return this; + } - public SyncV1 duration(BigDecimal duration) { - - this.duration = duration; - return this; - } + /** + * The status of the sync. + * + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } - /** - * The duration of the sync in seconds. Returns the partial duration if the sync has not finished yet. - * @return duration - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The duration of the sync in seconds. Returns the partial duration if the sync has not finished yet.") + public void setStatus(String status) { + this.status = status; + } - public BigDecimal getDuration() { - return duration; - } + public SyncV1 duration(BigDecimal duration) { + this.duration = duration; + return this; + } - public void setDuration(BigDecimal duration) { - this.duration = duration; - } + /** + * The duration of the sync in seconds. Returns the partial duration if the sync has not + * finished yet. + * + * @return duration + */ + @javax.annotation.Nonnull + public BigDecimal getDuration() { + return duration; + } + public void setDuration(BigDecimal duration) { + this.duration = duration; + } - public SyncV1 humanDuration(String humanDuration) { - - this.humanDuration = humanDuration; - return this; - } + public SyncV1 humanDuration(String humanDuration) { - /** - * The human-readable counterpart of `duration`. - * @return humanDuration - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The human-readable counterpart of `duration`.") - - public String getHumanDuration() { - return humanDuration; - } - - - public void setHumanDuration(String humanDuration) { - this.humanDuration = humanDuration; - } - - - public SyncV1 count(BigDecimal count) { - - this.count = count; - return this; - } - - /** - * The number of rows synced into the Warehouse. - * @return count - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The number of rows synced into the Warehouse.") - - public BigDecimal getCount() { - return count; - } - - - public void setCount(BigDecimal count) { - this.count = count; - } - - - public SyncV1 notices(List notices) { - - this.notices = notices; - return this; - } - - public SyncV1 addNoticesItem(SyncNoticeV1 noticesItem) { - this.notices.add(noticesItem); - return this; - } - - /** - * Notices that contain the events that occurred during the sync. - * @return notices - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Notices that contain the events that occurred during the sync.") - - public List getNotices() { - return notices; - } - - - public void setNotices(List notices) { - this.notices = notices; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SyncV1 syncV1 = (SyncV1) o; - return Objects.equals(this.sourceId, syncV1.sourceId) && - Objects.equals(this.start, syncV1.start) && - Objects.equals(this.end, syncV1.end) && - Objects.equals(this.status, syncV1.status) && - Objects.equals(this.duration, syncV1.duration) && - Objects.equals(this.humanDuration, syncV1.humanDuration) && - Objects.equals(this.count, syncV1.count) && - Objects.equals(this.notices, syncV1.notices); - } - - @Override - public int hashCode() { - return Objects.hash(sourceId, start, end, status, duration, humanDuration, count, notices); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SyncV1 {\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" start: ").append(toIndentedString(start)).append("\n"); - sb.append(" end: ").append(toIndentedString(end)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); - sb.append(" humanDuration: ").append(toIndentedString(humanDuration)).append("\n"); - sb.append(" count: ").append(toIndentedString(count)).append("\n"); - sb.append(" notices: ").append(toIndentedString(notices)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourceId"); - openapiFields.add("start"); - openapiFields.add("end"); - openapiFields.add("status"); - openapiFields.add("duration"); - openapiFields.add("humanDuration"); - openapiFields.add("count"); - openapiFields.add("notices"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("start"); - openapiRequiredFields.add("end"); - openapiRequiredFields.add("status"); - openapiRequiredFields.add("duration"); - openapiRequiredFields.add("humanDuration"); - openapiRequiredFields.add("count"); - openapiRequiredFields.add("notices"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to SyncV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!SyncV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in SyncV1 is not found in the empty JSON string", SyncV1.openapiRequiredFields.toString())); - } - } + this.humanDuration = humanDuration; + return this; + } + + /** + * The human-readable counterpart of `duration`. + * + * @return humanDuration + */ + @javax.annotation.Nonnull + public String getHumanDuration() { + return humanDuration; + } + + public void setHumanDuration(String humanDuration) { + this.humanDuration = humanDuration; + } + + public SyncV1 count(BigDecimal count) { + + this.count = count; + return this; + } + + /** + * The number of rows synced into the Warehouse. + * + * @return count + */ + @javax.annotation.Nonnull + public BigDecimal getCount() { + return count; + } + + public void setCount(BigDecimal count) { + this.count = count; + } + + public SyncV1 notices(List notices) { + + this.notices = notices; + return this; + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!SyncV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SyncV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + public SyncV1 addNoticesItem(SyncNoticeV1 noticesItem) { + if (this.notices == null) { + this.notices = new ArrayList<>(); } - } + this.notices.add(noticesItem); + return this; + } + + /** + * Notices that contain the events that occurred during the sync. + * + * @return notices + */ + @javax.annotation.Nonnull + public List getNotices() { + return notices; + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SyncV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + public void setNotices(List notices) { + this.notices = notices; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("start").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `start` to be a primitive type in the JSON string but got `%s`", jsonObj.get("start").toString())); - } - if (!jsonObj.get("end").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `end` to be a primitive type in the JSON string but got `%s`", jsonObj.get("end").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("humanDuration").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `humanDuration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("humanDuration").toString())); - } - // ensure the json data is an array - if (!jsonObj.get("notices").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `notices` to be an array in the JSON string but got `%s`", jsonObj.get("notices").toString())); - } - - JsonArray jsonArraynotices = jsonObj.getAsJsonArray("notices"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") + if (o == null || getClass() != o.getClass()) { + return false; + } + SyncV1 syncV1 = (SyncV1) o; + return Objects.equals(this.sourceId, syncV1.sourceId) + && Objects.equals(this.start, syncV1.start) + && Objects.equals(this.end, syncV1.end) + && Objects.equals(this.status, syncV1.status) + && Objects.equals(this.duration, syncV1.duration) + && Objects.equals(this.humanDuration, syncV1.humanDuration) + && Objects.equals(this.count, syncV1.count) + && Objects.equals(this.notices, syncV1.notices); + } + @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SyncV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SyncV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(SyncV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, SyncV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SyncV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of SyncV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of SyncV1 - * @throws IOException if the JSON string is invalid with respect to SyncV1 - */ - public static SyncV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SyncV1.class); - } - - /** - * Convert an instance of SyncV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public int hashCode() { + return Objects.hash(sourceId, start, end, status, duration, humanDuration, count, notices); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SyncV1 {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" start: ").append(toIndentedString(start)).append("\n"); + sb.append(" end: ").append(toIndentedString(end)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" humanDuration: ").append(toIndentedString(humanDuration)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" notices: ").append(toIndentedString(notices)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + openapiFields.add("start"); + openapiFields.add("end"); + openapiFields.add("status"); + openapiFields.add("duration"); + openapiFields.add("humanDuration"); + openapiFields.add("count"); + openapiFields.add("notices"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("start"); + openapiRequiredFields.add("end"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("duration"); + openapiRequiredFields.add("humanDuration"); + openapiRequiredFields.add("count"); + openapiRequiredFields.add("notices"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SyncV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SyncV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in SyncV1 is not found in the empty JSON" + + " string", + SyncV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SyncV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `SyncV1`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SyncV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if (!jsonObj.get("start").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `start` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("start").toString())); + } + if ((jsonObj.get("end") != null && !jsonObj.get("end").isJsonNull()) + && !jsonObj.get("end").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `end` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("end").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("humanDuration").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `humanDuration` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("humanDuration").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("notices").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `notices` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("notices").toString())); + } + + JsonArray jsonArraynotices = jsonObj.getAsJsonArray("notices"); + // validate the required field `notices` (array) + for (int i = 0; i < jsonArraynotices.size(); i++) { + SyncNoticeV1.validateJsonElement(jsonArraynotices.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SyncV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SyncV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SyncV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SyncV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SyncV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of SyncV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SyncV1 + * @throws IOException if the JSON string is invalid with respect to SyncV1 + */ + public static SyncV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SyncV1.class); + } + + /** + * Convert an instance of SyncV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Track.java b/src/main/java/com/segment/publicapi/models/Track.java deleted file mode 100644 index d9daf781..00000000 --- a/src/main/java/com/segment/publicapi/models/Track.java +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * Track settings. - */ -@ApiModel(description = "Track settings.") - -public class Track { - public static final String SERIALIZED_NAME_ALLOW_UNPLANNED_EVENTS = "allowUnplannedEvents"; - @SerializedName(SERIALIZED_NAME_ALLOW_UNPLANNED_EVENTS) - private Boolean allowUnplannedEvents; - - public static final String SERIALIZED_NAME_ALLOW_UNPLANNED_EVENT_PROPERTIES = "allowUnplannedEventProperties"; - @SerializedName(SERIALIZED_NAME_ALLOW_UNPLANNED_EVENT_PROPERTIES) - private Boolean allowUnplannedEventProperties; - - public static final String SERIALIZED_NAME_ALLOW_EVENT_ON_VIOLATIONS = "allowEventOnViolations"; - @SerializedName(SERIALIZED_NAME_ALLOW_EVENT_ON_VIOLATIONS) - private Boolean allowEventOnViolations; - - public static final String SERIALIZED_NAME_ALLOW_PROPERTIES_ON_VIOLATIONS = "allowPropertiesOnViolations"; - @SerializedName(SERIALIZED_NAME_ALLOW_PROPERTIES_ON_VIOLATIONS) - private Boolean allowPropertiesOnViolations; - - /** - * The common track event on violations. Config API note: equal to `commonTrackEventOnViolations`. - */ - @JsonAdapter(CommonEventOnViolationsEnum.Adapter.class) - public enum CommonEventOnViolationsEnum { - ALLOW("ALLOW"), - - BLOCK("BLOCK"), - - OMIT_PROPERTIES("OMIT_PROPERTIES"); - - private String value; - - CommonEventOnViolationsEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static CommonEventOnViolationsEnum fromValue(String value) { - for (CommonEventOnViolationsEnum b : CommonEventOnViolationsEnum.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 CommonEventOnViolationsEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public CommonEventOnViolationsEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return CommonEventOnViolationsEnum.fromValue(value); - } - } - } - - public static final String SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS = "commonEventOnViolations"; - @SerializedName(SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS) - private CommonEventOnViolationsEnum commonEventOnViolations; - - public Track() { - } - - public Track allowUnplannedEvents(Boolean allowUnplannedEvents) { - - this.allowUnplannedEvents = allowUnplannedEvents; - return this; - } - - /** - * Enable to allow unplanned track events. Config API note: equal to `allowUnplannedTrackEvents`. - * @return allowUnplannedEvents - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow unplanned track events. Config API note: equal to `allowUnplannedTrackEvents`.") - - public Boolean getAllowUnplannedEvents() { - return allowUnplannedEvents; - } - - - public void setAllowUnplannedEvents(Boolean allowUnplannedEvents) { - this.allowUnplannedEvents = allowUnplannedEvents; - } - - - public Track allowUnplannedEventProperties(Boolean allowUnplannedEventProperties) { - - this.allowUnplannedEventProperties = allowUnplannedEventProperties; - return this; - } - - /** - * Enable to allow unplanned track event properties. Config API note: equal to `allowUnplannedTrackEventProperties`. - * @return allowUnplannedEventProperties - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow unplanned track event properties. Config API note: equal to `allowUnplannedTrackEventProperties`.") - - public Boolean getAllowUnplannedEventProperties() { - return allowUnplannedEventProperties; - } - - - public void setAllowUnplannedEventProperties(Boolean allowUnplannedEventProperties) { - this.allowUnplannedEventProperties = allowUnplannedEventProperties; - } - - - public Track allowEventOnViolations(Boolean allowEventOnViolations) { - - this.allowEventOnViolations = allowEventOnViolations; - return this; - } - - /** - * Allow track event on violations. Config API note: equal to `allowTrackEventOnViolations`. - * @return allowEventOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Allow track event on violations. Config API note: equal to `allowTrackEventOnViolations`.") - - public Boolean getAllowEventOnViolations() { - return allowEventOnViolations; - } - - - public void setAllowEventOnViolations(Boolean allowEventOnViolations) { - this.allowEventOnViolations = allowEventOnViolations; - } - - - public Track allowPropertiesOnViolations(Boolean allowPropertiesOnViolations) { - - this.allowPropertiesOnViolations = allowPropertiesOnViolations; - return this; - } - - /** - * Enable to allow track properties on violations. Config API note: equal to `allowTrackEventPropertiesOnViolations`. - * @return allowPropertiesOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow track properties on violations. Config API note: equal to `allowTrackEventPropertiesOnViolations`.") - - public Boolean getAllowPropertiesOnViolations() { - return allowPropertiesOnViolations; - } - - - public void setAllowPropertiesOnViolations(Boolean allowPropertiesOnViolations) { - this.allowPropertiesOnViolations = allowPropertiesOnViolations; - } - - - public Track commonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { - - this.commonEventOnViolations = commonEventOnViolations; - return this; - } - - /** - * The common track event on violations. Config API note: equal to `commonTrackEventOnViolations`. - * @return commonEventOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The common track event on violations. Config API note: equal to `commonTrackEventOnViolations`.") - - public CommonEventOnViolationsEnum getCommonEventOnViolations() { - return commonEventOnViolations; - } - - - public void setCommonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { - this.commonEventOnViolations = commonEventOnViolations; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Track track = (Track) o; - return Objects.equals(this.allowUnplannedEvents, track.allowUnplannedEvents) && - Objects.equals(this.allowUnplannedEventProperties, track.allowUnplannedEventProperties) && - Objects.equals(this.allowEventOnViolations, track.allowEventOnViolations) && - Objects.equals(this.allowPropertiesOnViolations, track.allowPropertiesOnViolations) && - Objects.equals(this.commonEventOnViolations, track.commonEventOnViolations); - } - - @Override - public int hashCode() { - return Objects.hash(allowUnplannedEvents, allowUnplannedEventProperties, allowEventOnViolations, allowPropertiesOnViolations, commonEventOnViolations); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Track {\n"); - sb.append(" allowUnplannedEvents: ").append(toIndentedString(allowUnplannedEvents)).append("\n"); - sb.append(" allowUnplannedEventProperties: ").append(toIndentedString(allowUnplannedEventProperties)).append("\n"); - sb.append(" allowEventOnViolations: ").append(toIndentedString(allowEventOnViolations)).append("\n"); - sb.append(" allowPropertiesOnViolations: ").append(toIndentedString(allowPropertiesOnViolations)).append("\n"); - sb.append(" commonEventOnViolations: ").append(toIndentedString(commonEventOnViolations)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("allowUnplannedEvents"); - openapiFields.add("allowUnplannedEventProperties"); - openapiFields.add("allowEventOnViolations"); - openapiFields.add("allowPropertiesOnViolations"); - openapiFields.add("commonEventOnViolations"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Track - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Track.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Track is not found in the empty JSON string", Track.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Track.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Track` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - if ((jsonObj.get("commonEventOnViolations") != null && !jsonObj.get("commonEventOnViolations").isJsonNull()) && !jsonObj.get("commonEventOnViolations").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `commonEventOnViolations` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commonEventOnViolations").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Track.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Track' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Track.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Track value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Track read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Track given an JSON string - * - * @param jsonString JSON string - * @return An instance of Track - * @throws IOException if the JSON string is invalid with respect to Track - */ - public static Track fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Track.class); - } - - /** - * Convert an instance of Track to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/TrackSourceSettingsV1.java b/src/main/java/com/segment/publicapi/models/TrackSourceSettingsV1.java index b112b045..427a17eb 100644 --- a/src/main/java/com/segment/publicapi/models/TrackSourceSettingsV1.java +++ b/src/main/java/com/segment/publicapi/models/TrackSourceSettingsV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,368 +9,388 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** TrackSourceSettingsV1 */ +public class TrackSourceSettingsV1 { + public static final String SERIALIZED_NAME_ALLOW_UNPLANNED_EVENTS = "allowUnplannedEvents"; -/** - * TrackSourceSettingsV1 - */ + @SerializedName(SERIALIZED_NAME_ALLOW_UNPLANNED_EVENTS) + private Boolean allowUnplannedEvents; -public class TrackSourceSettingsV1 { - public static final String SERIALIZED_NAME_ALLOW_UNPLANNED_EVENTS = "allowUnplannedEvents"; - @SerializedName(SERIALIZED_NAME_ALLOW_UNPLANNED_EVENTS) - private Boolean allowUnplannedEvents; - - public static final String SERIALIZED_NAME_ALLOW_UNPLANNED_EVENT_PROPERTIES = "allowUnplannedEventProperties"; - @SerializedName(SERIALIZED_NAME_ALLOW_UNPLANNED_EVENT_PROPERTIES) - private Boolean allowUnplannedEventProperties; - - public static final String SERIALIZED_NAME_ALLOW_EVENT_ON_VIOLATIONS = "allowEventOnViolations"; - @SerializedName(SERIALIZED_NAME_ALLOW_EVENT_ON_VIOLATIONS) - private Boolean allowEventOnViolations; - - public static final String SERIALIZED_NAME_ALLOW_PROPERTIES_ON_VIOLATIONS = "allowPropertiesOnViolations"; - @SerializedName(SERIALIZED_NAME_ALLOW_PROPERTIES_ON_VIOLATIONS) - private Boolean allowPropertiesOnViolations; - - /** - * The common track event on violations. Config API note: equal to `commonTrackEventOnViolations`. - */ - @JsonAdapter(CommonEventOnViolationsEnum.Adapter.class) - public enum CommonEventOnViolationsEnum { - ALLOW("ALLOW"), - - BLOCK("BLOCK"), - - OMIT_PROPERTIES("OMIT_PROPERTIES"); - - private String value; - - CommonEventOnViolationsEnum(String value) { - this.value = value; - } + public static final String SERIALIZED_NAME_ALLOW_UNPLANNED_EVENT_PROPERTIES = + "allowUnplannedEventProperties"; - public String getValue() { - return value; - } + @SerializedName(SERIALIZED_NAME_ALLOW_UNPLANNED_EVENT_PROPERTIES) + private Boolean allowUnplannedEventProperties; - @Override - public String toString() { - return String.valueOf(value); - } + public static final String SERIALIZED_NAME_ALLOW_EVENT_ON_VIOLATIONS = "allowEventOnViolations"; - public static CommonEventOnViolationsEnum fromValue(String value) { - for (CommonEventOnViolationsEnum b : CommonEventOnViolationsEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } + @SerializedName(SERIALIZED_NAME_ALLOW_EVENT_ON_VIOLATIONS) + private Boolean allowEventOnViolations; - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final CommonEventOnViolationsEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public CommonEventOnViolationsEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return CommonEventOnViolationsEnum.fromValue(value); - } - } - } + public static final String SERIALIZED_NAME_ALLOW_PROPERTIES_ON_VIOLATIONS = + "allowPropertiesOnViolations"; - public static final String SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS = "commonEventOnViolations"; - @SerializedName(SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS) - private CommonEventOnViolationsEnum commonEventOnViolations; + @SerializedName(SERIALIZED_NAME_ALLOW_PROPERTIES_ON_VIOLATIONS) + private Boolean allowPropertiesOnViolations; - public TrackSourceSettingsV1() { - } + /** + * The common track event on violations. Config API note: equal to + * `commonTrackEventOnViolations`. + */ + @JsonAdapter(CommonEventOnViolationsEnum.Adapter.class) + public enum CommonEventOnViolationsEnum { + ALLOW("ALLOW"), - public TrackSourceSettingsV1 allowUnplannedEvents(Boolean allowUnplannedEvents) { - - this.allowUnplannedEvents = allowUnplannedEvents; - return this; - } + BLOCK("BLOCK"), - /** - * Enable to allow unplanned track events. Config API note: equal to `allowUnplannedTrackEvents`. - * @return allowUnplannedEvents - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow unplanned track events. Config API note: equal to `allowUnplannedTrackEvents`.") + OMIT_PROPERTIES("OMIT_PROPERTIES"); - public Boolean getAllowUnplannedEvents() { - return allowUnplannedEvents; - } + private String value; + CommonEventOnViolationsEnum(String value) { + this.value = value; + } - public void setAllowUnplannedEvents(Boolean allowUnplannedEvents) { - this.allowUnplannedEvents = allowUnplannedEvents; - } + public String getValue() { + return value; + } + @Override + public String toString() { + return String.valueOf(value); + } - public TrackSourceSettingsV1 allowUnplannedEventProperties(Boolean allowUnplannedEventProperties) { - - this.allowUnplannedEventProperties = allowUnplannedEventProperties; - return this; - } + public static CommonEventOnViolationsEnum fromValue(String value) { + for (CommonEventOnViolationsEnum b : CommonEventOnViolationsEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - /** - * Enable to allow unplanned track event properties. Config API note: equal to `allowUnplannedTrackEventProperties`. - * @return allowUnplannedEventProperties - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow unplanned track event properties. Config API note: equal to `allowUnplannedTrackEventProperties`.") + public static class Adapter extends TypeAdapter { + @Override + public void write( + final JsonWriter jsonWriter, final CommonEventOnViolationsEnum enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CommonEventOnViolationsEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return CommonEventOnViolationsEnum.fromValue(value); + } + } + } - public Boolean getAllowUnplannedEventProperties() { - return allowUnplannedEventProperties; - } + public static final String SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS = + "commonEventOnViolations"; + @SerializedName(SERIALIZED_NAME_COMMON_EVENT_ON_VIOLATIONS) + private CommonEventOnViolationsEnum commonEventOnViolations; - public void setAllowUnplannedEventProperties(Boolean allowUnplannedEventProperties) { - this.allowUnplannedEventProperties = allowUnplannedEventProperties; - } + public TrackSourceSettingsV1() {} + public TrackSourceSettingsV1 allowUnplannedEvents(Boolean allowUnplannedEvents) { - public TrackSourceSettingsV1 allowEventOnViolations(Boolean allowEventOnViolations) { - - this.allowEventOnViolations = allowEventOnViolations; - return this; - } + this.allowUnplannedEvents = allowUnplannedEvents; + return this; + } - /** - * Allow track event on violations. Config API note: equal to `allowTrackEventOnViolations`. - * @return allowEventOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Allow track event on violations. Config API note: equal to `allowTrackEventOnViolations`.") + /** + * Enable to allow unplanned track events. Config API note: equal to + * `allowUnplannedTrackEvents`. + * + * @return allowUnplannedEvents + */ + @javax.annotation.Nullable + public Boolean getAllowUnplannedEvents() { + return allowUnplannedEvents; + } - public Boolean getAllowEventOnViolations() { - return allowEventOnViolations; - } + public void setAllowUnplannedEvents(Boolean allowUnplannedEvents) { + this.allowUnplannedEvents = allowUnplannedEvents; + } + public TrackSourceSettingsV1 allowUnplannedEventProperties( + Boolean allowUnplannedEventProperties) { - public void setAllowEventOnViolations(Boolean allowEventOnViolations) { - this.allowEventOnViolations = allowEventOnViolations; - } + this.allowUnplannedEventProperties = allowUnplannedEventProperties; + return this; + } + /** + * Enable to allow unplanned track event properties. Config API note: equal to + * `allowUnplannedTrackEventProperties`. + * + * @return allowUnplannedEventProperties + */ + @javax.annotation.Nullable + public Boolean getAllowUnplannedEventProperties() { + return allowUnplannedEventProperties; + } - public TrackSourceSettingsV1 allowPropertiesOnViolations(Boolean allowPropertiesOnViolations) { - - this.allowPropertiesOnViolations = allowPropertiesOnViolations; - return this; - } + public void setAllowUnplannedEventProperties(Boolean allowUnplannedEventProperties) { + this.allowUnplannedEventProperties = allowUnplannedEventProperties; + } - /** - * Enable to allow track properties on violations. Config API note: equal to `allowTrackEventPropertiesOnViolations`. - * @return allowPropertiesOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow track properties on violations. Config API note: equal to `allowTrackEventPropertiesOnViolations`.") + public TrackSourceSettingsV1 allowEventOnViolations(Boolean allowEventOnViolations) { - public Boolean getAllowPropertiesOnViolations() { - return allowPropertiesOnViolations; - } + this.allowEventOnViolations = allowEventOnViolations; + return this; + } + /** + * Allow track event on violations. Config API note: equal to + * `allowTrackEventOnViolations`. + * + * @return allowEventOnViolations + */ + @javax.annotation.Nullable + public Boolean getAllowEventOnViolations() { + return allowEventOnViolations; + } - public void setAllowPropertiesOnViolations(Boolean allowPropertiesOnViolations) { - this.allowPropertiesOnViolations = allowPropertiesOnViolations; - } + public void setAllowEventOnViolations(Boolean allowEventOnViolations) { + this.allowEventOnViolations = allowEventOnViolations; + } + public TrackSourceSettingsV1 allowPropertiesOnViolations(Boolean allowPropertiesOnViolations) { - public TrackSourceSettingsV1 commonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { - - this.commonEventOnViolations = commonEventOnViolations; - return this; - } + this.allowPropertiesOnViolations = allowPropertiesOnViolations; + return this; + } - /** - * The common track event on violations. Config API note: equal to `commonTrackEventOnViolations`. - * @return commonEventOnViolations - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The common track event on violations. Config API note: equal to `commonTrackEventOnViolations`.") + /** + * Enable to allow track properties on violations. Config API note: equal to + * `allowTrackEventPropertiesOnViolations`. + * + * @return allowPropertiesOnViolations + */ + @javax.annotation.Nullable + public Boolean getAllowPropertiesOnViolations() { + return allowPropertiesOnViolations; + } - public CommonEventOnViolationsEnum getCommonEventOnViolations() { - return commonEventOnViolations; - } + public void setAllowPropertiesOnViolations(Boolean allowPropertiesOnViolations) { + this.allowPropertiesOnViolations = allowPropertiesOnViolations; + } + public TrackSourceSettingsV1 commonEventOnViolations( + CommonEventOnViolationsEnum commonEventOnViolations) { - public void setCommonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { - this.commonEventOnViolations = commonEventOnViolations; - } + this.commonEventOnViolations = commonEventOnViolations; + return this; + } + /** + * The common track event on violations. Config API note: equal to + * `commonTrackEventOnViolations`. + * + * @return commonEventOnViolations + */ + @javax.annotation.Nullable + public CommonEventOnViolationsEnum getCommonEventOnViolations() { + return commonEventOnViolations; + } + public void setCommonEventOnViolations(CommonEventOnViolationsEnum commonEventOnViolations) { + this.commonEventOnViolations = commonEventOnViolations; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TrackSourceSettingsV1 trackSourceSettingsV1 = (TrackSourceSettingsV1) o; + return Objects.equals(this.allowUnplannedEvents, trackSourceSettingsV1.allowUnplannedEvents) + && Objects.equals( + this.allowUnplannedEventProperties, + trackSourceSettingsV1.allowUnplannedEventProperties) + && Objects.equals( + this.allowEventOnViolations, trackSourceSettingsV1.allowEventOnViolations) + && Objects.equals( + this.allowPropertiesOnViolations, + trackSourceSettingsV1.allowPropertiesOnViolations) + && Objects.equals( + this.commonEventOnViolations, + trackSourceSettingsV1.commonEventOnViolations); } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public int hashCode() { + return Objects.hash( + allowUnplannedEvents, + allowUnplannedEventProperties, + allowEventOnViolations, + allowPropertiesOnViolations, + commonEventOnViolations); } - TrackSourceSettingsV1 trackSourceSettingsV1 = (TrackSourceSettingsV1) o; - return Objects.equals(this.allowUnplannedEvents, trackSourceSettingsV1.allowUnplannedEvents) && - Objects.equals(this.allowUnplannedEventProperties, trackSourceSettingsV1.allowUnplannedEventProperties) && - Objects.equals(this.allowEventOnViolations, trackSourceSettingsV1.allowEventOnViolations) && - Objects.equals(this.allowPropertiesOnViolations, trackSourceSettingsV1.allowPropertiesOnViolations) && - Objects.equals(this.commonEventOnViolations, trackSourceSettingsV1.commonEventOnViolations); - } - - @Override - public int hashCode() { - return Objects.hash(allowUnplannedEvents, allowUnplannedEventProperties, allowEventOnViolations, allowPropertiesOnViolations, commonEventOnViolations); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TrackSourceSettingsV1 {\n"); - sb.append(" allowUnplannedEvents: ").append(toIndentedString(allowUnplannedEvents)).append("\n"); - sb.append(" allowUnplannedEventProperties: ").append(toIndentedString(allowUnplannedEventProperties)).append("\n"); - sb.append(" allowEventOnViolations: ").append(toIndentedString(allowEventOnViolations)).append("\n"); - sb.append(" allowPropertiesOnViolations: ").append(toIndentedString(allowPropertiesOnViolations)).append("\n"); - sb.append(" commonEventOnViolations: ").append(toIndentedString(commonEventOnViolations)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TrackSourceSettingsV1 {\n"); + sb.append(" allowUnplannedEvents: ") + .append(toIndentedString(allowUnplannedEvents)) + .append("\n"); + sb.append(" allowUnplannedEventProperties: ") + .append(toIndentedString(allowUnplannedEventProperties)) + .append("\n"); + sb.append(" allowEventOnViolations: ") + .append(toIndentedString(allowEventOnViolations)) + .append("\n"); + sb.append(" allowPropertiesOnViolations: ") + .append(toIndentedString(allowPropertiesOnViolations)) + .append("\n"); + sb.append(" commonEventOnViolations: ") + .append(toIndentedString(commonEventOnViolations)) + .append("\n"); + sb.append("}"); + return sb.toString(); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("allowUnplannedEvents"); - openapiFields.add("allowUnplannedEventProperties"); - openapiFields.add("allowEventOnViolations"); - openapiFields.add("allowPropertiesOnViolations"); - openapiFields.add("commonEventOnViolations"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to TrackSourceSettingsV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!TrackSourceSettingsV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in TrackSourceSettingsV1 is not found in the empty JSON string", TrackSourceSettingsV1.openapiRequiredFields.toString())); + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!TrackSourceSettingsV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TrackSourceSettingsV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("allowUnplannedEvents"); + openapiFields.add("allowUnplannedEventProperties"); + openapiFields.add("allowEventOnViolations"); + openapiFields.add("allowPropertiesOnViolations"); + openapiFields.add("commonEventOnViolations"); + + // 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 TrackSourceSettingsV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TrackSourceSettingsV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TrackSourceSettingsV1 is not found in" + + " the empty JSON string", + TrackSourceSettingsV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TrackSourceSettingsV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `TrackSourceSettingsV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("commonEventOnViolations") != null + && !jsonObj.get("commonEventOnViolations").isJsonNull()) + && !jsonObj.get("commonEventOnViolations").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `commonEventOnViolations` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("commonEventOnViolations").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TrackSourceSettingsV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TrackSourceSettingsV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TrackSourceSettingsV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TrackSourceSettingsV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TrackSourceSettingsV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - if ((jsonObj.get("commonEventOnViolations") != null && !jsonObj.get("commonEventOnViolations").isJsonNull()) && !jsonObj.get("commonEventOnViolations").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `commonEventOnViolations` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commonEventOnViolations").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!TrackSourceSettingsV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'TrackSourceSettingsV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(TrackSourceSettingsV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, TrackSourceSettingsV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public TrackSourceSettingsV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of TrackSourceSettingsV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of TrackSourceSettingsV1 - * @throws IOException if the JSON string is invalid with respect to TrackSourceSettingsV1 - */ - public static TrackSourceSettingsV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, TrackSourceSettingsV1.class); - } - - /** - * Convert an instance of TrackSourceSettingsV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of TrackSourceSettingsV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of TrackSourceSettingsV1 + * @throws IOException if the JSON string is invalid with respect to TrackSourceSettingsV1 + */ + public static TrackSourceSettingsV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TrackSourceSettingsV1.class); + } + + /** + * Convert an instance of TrackSourceSettingsV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/TrackingPlan.java b/src/main/java/com/segment/publicapi/models/TrackingPlan.java deleted file mode 100644 index 5d74a9b9..00000000 --- a/src/main/java/com/segment/publicapi/models/TrackingPlan.java +++ /dev/null @@ -1,467 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The requested Tracking Plan. - */ -@ApiModel(description = "The requested Tracking Plan.") - -public class TrackingPlan { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - /** - * The Tracking Plan's type. - */ - @JsonAdapter(TypeEnum.Adapter.class) - public enum TypeEnum { - LIVE("LIVE"), - - PROPERTY_LIBRARY("PROPERTY_LIBRARY"), - - RULE_LIBRARY("RULE_LIBRARY"), - - TEMPLATE("TEMPLATE"); - - 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_UPDATED_AT = "updatedAt"; - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private String updatedAt; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; - - public TrackingPlan() { - } - - public TrackingPlan id(String id) { - - this.id = id; - return this; - } - - /** - * The Tracking Plan's identifier. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Tracking Plan's identifier. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public TrackingPlan name(String name) { - - this.name = name; - return this; - } - - /** - * The Tracking Plan's name. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Tracking Plan's name. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public TrackingPlan slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * URL-friendly slug of this Tracking Plan. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "URL-friendly slug of this Tracking Plan. Config API note: equal to `name`.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - public TrackingPlan description(String description) { - - this.description = description; - return this; - } - - /** - * The Tracking Plan's description. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Tracking Plan's description.") - - public String getDescription() { - return description; - } - - - public void setDescription(String description) { - this.description = description; - } - - - public TrackingPlan type(TypeEnum type) { - - this.type = type; - return this; - } - - /** - * The Tracking Plan's type. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Tracking Plan's type.") - - public TypeEnum getType() { - return type; - } - - - public void setType(TypeEnum type) { - this.type = type; - } - - - public TrackingPlan updatedAt(String updatedAt) { - - this.updatedAt = updatedAt; - return this; - } - - /** - * The timestamp of the last change to the Tracking Plan. Config API note: equal to `updateTime`. - * @return updatedAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The timestamp of the last change to the Tracking Plan. Config API note: equal to `updateTime`.") - - public String getUpdatedAt() { - return updatedAt; - } - - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - - public TrackingPlan createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } - - /** - * The timestamp of this Tracking Plan's creation. Config API note: equal to `createTime`. - * @return createdAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The timestamp of this Tracking Plan's creation. Config API note: equal to `createTime`.") - - public String getCreatedAt() { - return createdAt; - } - - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TrackingPlan trackingPlan = (TrackingPlan) o; - return Objects.equals(this.id, trackingPlan.id) && - Objects.equals(this.name, trackingPlan.name) && - Objects.equals(this.slug, trackingPlan.slug) && - Objects.equals(this.description, trackingPlan.description) && - Objects.equals(this.type, trackingPlan.type) && - Objects.equals(this.updatedAt, trackingPlan.updatedAt) && - Objects.equals(this.createdAt, trackingPlan.createdAt); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, slug, description, type, updatedAt, createdAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TrackingPlan {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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("id"); - openapiFields.add("name"); - openapiFields.add("slug"); - openapiFields.add("description"); - openapiFields.add("type"); - openapiFields.add("updatedAt"); - openapiFields.add("createdAt"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("type"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to TrackingPlan - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!TrackingPlan.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in TrackingPlan is not found in the empty JSON string", TrackingPlan.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!TrackingPlan.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TrackingPlan` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : TrackingPlan.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("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("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("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) && !jsonObj.get("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!TrackingPlan.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'TrackingPlan' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(TrackingPlan.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, TrackingPlan value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public TrackingPlan read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of TrackingPlan given an JSON string - * - * @param jsonString JSON string - * @return An instance of TrackingPlan - * @throws IOException if the JSON string is invalid with respect to TrackingPlan - */ - public static TrackingPlan fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, TrackingPlan.class); - } - - /** - * Convert an instance of TrackingPlan to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/TrackingPlan1.java b/src/main/java/com/segment/publicapi/models/TrackingPlan1.java deleted file mode 100644 index 8c3904cf..00000000 --- a/src/main/java/com/segment/publicapi/models/TrackingPlan1.java +++ /dev/null @@ -1,467 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The created Tracking Plan. - */ -@ApiModel(description = "The created Tracking Plan.") - -public class TrackingPlan1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - /** - * The Tracking Plan's type. - */ - @JsonAdapter(TypeEnum.Adapter.class) - public enum TypeEnum { - LIVE("LIVE"), - - PROPERTY_LIBRARY("PROPERTY_LIBRARY"), - - RULE_LIBRARY("RULE_LIBRARY"), - - TEMPLATE("TEMPLATE"); - - 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_UPDATED_AT = "updatedAt"; - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private String updatedAt; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; - - public TrackingPlan1() { - } - - public TrackingPlan1 id(String id) { - - this.id = id; - return this; - } - - /** - * The Tracking Plan's identifier. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Tracking Plan's identifier. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public TrackingPlan1 name(String name) { - - this.name = name; - return this; - } - - /** - * The Tracking Plan's name. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Tracking Plan's name. Config API note: equal to `displayName`.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public TrackingPlan1 slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * URL-friendly slug of this Tracking Plan. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "URL-friendly slug of this Tracking Plan. Config API note: equal to `name`.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - public TrackingPlan1 description(String description) { - - this.description = description; - return this; - } - - /** - * The Tracking Plan's description. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Tracking Plan's description.") - - public String getDescription() { - return description; - } - - - public void setDescription(String description) { - this.description = description; - } - - - public TrackingPlan1 type(TypeEnum type) { - - this.type = type; - return this; - } - - /** - * The Tracking Plan's type. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Tracking Plan's type.") - - public TypeEnum getType() { - return type; - } - - - public void setType(TypeEnum type) { - this.type = type; - } - - - public TrackingPlan1 updatedAt(String updatedAt) { - - this.updatedAt = updatedAt; - return this; - } - - /** - * The timestamp of the last change to the Tracking Plan. Config API note: equal to `updateTime`. - * @return updatedAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The timestamp of the last change to the Tracking Plan. Config API note: equal to `updateTime`.") - - public String getUpdatedAt() { - return updatedAt; - } - - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - - public TrackingPlan1 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } - - /** - * The timestamp of this Tracking Plan's creation. Config API note: equal to `createTime`. - * @return createdAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The timestamp of this Tracking Plan's creation. Config API note: equal to `createTime`.") - - public String getCreatedAt() { - return createdAt; - } - - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TrackingPlan1 trackingPlan1 = (TrackingPlan1) o; - return Objects.equals(this.id, trackingPlan1.id) && - Objects.equals(this.name, trackingPlan1.name) && - Objects.equals(this.slug, trackingPlan1.slug) && - Objects.equals(this.description, trackingPlan1.description) && - Objects.equals(this.type, trackingPlan1.type) && - Objects.equals(this.updatedAt, trackingPlan1.updatedAt) && - Objects.equals(this.createdAt, trackingPlan1.createdAt); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, slug, description, type, updatedAt, createdAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TrackingPlan1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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("id"); - openapiFields.add("name"); - openapiFields.add("slug"); - openapiFields.add("description"); - openapiFields.add("type"); - openapiFields.add("updatedAt"); - openapiFields.add("createdAt"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("type"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to TrackingPlan1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!TrackingPlan1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in TrackingPlan1 is not found in the empty JSON string", TrackingPlan1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!TrackingPlan1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TrackingPlan1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : TrackingPlan1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("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("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("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) && !jsonObj.get("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!TrackingPlan1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'TrackingPlan1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(TrackingPlan1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, TrackingPlan1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public TrackingPlan1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of TrackingPlan1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of TrackingPlan1 - * @throws IOException if the JSON string is invalid with respect to TrackingPlan1 - */ - public static TrackingPlan1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, TrackingPlan1.class); - } - - /** - * Convert an instance of TrackingPlan1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/TrackingPlanV1.java b/src/main/java/com/segment/publicapi/models/TrackingPlanV1.java index 2bae5f07..9d938afd 100644 --- a/src/main/java/com/segment/publicapi/models/TrackingPlanV1.java +++ b/src/main/java/com/segment/publicapi/models/TrackingPlanV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,458 +9,469 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Represents a Tracking Plan. */ +public class TrackingPlanV1 { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * Represents a Tracking Plan. - */ -@ApiModel(description = "Represents a Tracking Plan.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class TrackingPlanV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - /** - * The Tracking Plan's type. - */ - @JsonAdapter(TypeEnum.Adapter.class) - public enum TypeEnum { - LIVE("LIVE"), - - PROPERTY_LIBRARY("PROPERTY_LIBRARY"), - - RULE_LIBRARY("RULE_LIBRARY"), - - TEMPLATE("TEMPLATE"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } + public static final String SERIALIZED_NAME_NAME = "name"; - public String getValue() { - return value; - } + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - @Override - public String toString() { - return String.valueOf(value); - } + public static final String SERIALIZED_NAME_SLUG = "slug"; - public static TypeEnum fromValue(String value) { - for (TypeEnum b : TypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; - 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_DESCRIPTION = "description"; - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - private TypeEnum type; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private String updatedAt; + /** The Tracking Plan's type. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ENGAGE("ENGAGE"), - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; + LIVE("LIVE"), - public TrackingPlanV1() { - } + PROPERTY_LIBRARY("PROPERTY_LIBRARY"), - public TrackingPlanV1 id(String id) { - - this.id = id; - return this; - } + RULE_LIBRARY("RULE_LIBRARY"), - /** - * The Tracking Plan's identifier. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Tracking Plan's identifier. Config API note: analogous to `name`.") + TEMPLATE("TEMPLATE"); - public String getId() { - return id; - } + private String value; + TypeEnum(String value) { + this.value = value; + } - public void setId(String id) { - this.id = id; - } + public String getValue() { + return value; + } + @Override + public String toString() { + return String.valueOf(value); + } - public TrackingPlanV1 name(String name) { - - this.name = name; - return this; - } + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - /** - * The Tracking Plan's name. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Tracking Plan's name. Config API note: equal to `displayName`.") + 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 String getName() { - return name; - } + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; - public void setName(String name) { - this.name = name; - } + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private String updatedAt; - public TrackingPlanV1 slug(String slug) { - - this.slug = slug; - return this; - } + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - /** - * URL-friendly slug of this Tracking Plan. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "URL-friendly slug of this Tracking Plan. Config API note: equal to `name`.") + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; - public String getSlug() { - return slug; - } + public TrackingPlanV1() {} + public TrackingPlanV1 id(String id) { - public void setSlug(String slug) { - this.slug = slug; - } + this.id = id; + return this; + } + /** + * The Tracking Plan's identifier. Config API note: analogous to `name`. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - public TrackingPlanV1 description(String description) { - - this.description = description; - return this; - } + public void setId(String id) { + this.id = id; + } - /** - * The Tracking Plan's description. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Tracking Plan's description.") + public TrackingPlanV1 name(String name) { - public String getDescription() { - return description; - } + this.name = name; + return this; + } + /** + * The Tracking Plan's name. Config API note: equal to `displayName`. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - public void setDescription(String description) { - this.description = description; - } + public void setName(String name) { + this.name = name; + } + public TrackingPlanV1 slug(String slug) { - public TrackingPlanV1 type(TypeEnum type) { - - this.type = type; - return this; - } + this.slug = slug; + return this; + } - /** - * The Tracking Plan's type. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Tracking Plan's type.") + /** + * URL-friendly slug of this Tracking Plan. Config API note: equal to `name`. + * + * @return slug + */ + @javax.annotation.Nullable + public String getSlug() { + return slug; + } - public TypeEnum getType() { - return type; - } + public void setSlug(String slug) { + this.slug = slug; + } + public TrackingPlanV1 description(String description) { - public void setType(TypeEnum type) { - this.type = type; - } + this.description = description; + return this; + } + /** + * The Tracking Plan's description. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } - public TrackingPlanV1 updatedAt(String updatedAt) { - - this.updatedAt = updatedAt; - return this; - } + public void setDescription(String description) { + this.description = description; + } - /** - * The timestamp of the last change to the Tracking Plan. Config API note: equal to `updateTime`. - * @return updatedAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The timestamp of the last change to the Tracking Plan. Config API note: equal to `updateTime`.") + public TrackingPlanV1 type(TypeEnum type) { - public String getUpdatedAt() { - return updatedAt; - } + this.type = type; + return this; + } + /** + * The Tracking Plan's type. + * + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } + public void setType(TypeEnum type) { + this.type = type; + } + public TrackingPlanV1 updatedAt(String updatedAt) { - public TrackingPlanV1 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } + this.updatedAt = updatedAt; + return this; + } - /** - * The timestamp of this Tracking Plan's creation. Config API note: equal to `createTime`. - * @return createdAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The timestamp of this Tracking Plan's creation. Config API note: equal to `createTime`.") + /** + * The timestamp of the last change to the Tracking Plan. Config API note: equal to + * `updateTime`. + * + * @return updatedAt + */ + @javax.annotation.Nullable + public String getUpdatedAt() { + return updatedAt; + } - public String getCreatedAt() { - return createdAt; - } + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + public TrackingPlanV1 createdAt(String createdAt) { - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } + this.createdAt = createdAt; + return this; + } + /** + * The timestamp of this Tracking Plan's creation. Config API note: equal to + * `createTime`. + * + * @return createdAt + */ + @javax.annotation.Nullable + public String getCreatedAt() { + return createdAt; + } + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TrackingPlanV1 trackingPlanV1 = (TrackingPlanV1) o; + return Objects.equals(this.id, trackingPlanV1.id) + && Objects.equals(this.name, trackingPlanV1.name) + && Objects.equals(this.slug, trackingPlanV1.slug) + && Objects.equals(this.description, trackingPlanV1.description) + && Objects.equals(this.type, trackingPlanV1.type) + && Objects.equals(this.updatedAt, trackingPlanV1.updatedAt) + && Objects.equals(this.createdAt, trackingPlanV1.createdAt); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public int hashCode() { + return Objects.hash(id, name, slug, description, type, updatedAt, createdAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TrackingPlanV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - TrackingPlanV1 trackingPlanV1 = (TrackingPlanV1) o; - return Objects.equals(this.id, trackingPlanV1.id) && - Objects.equals(this.name, trackingPlanV1.name) && - Objects.equals(this.slug, trackingPlanV1.slug) && - Objects.equals(this.description, trackingPlanV1.description) && - Objects.equals(this.type, trackingPlanV1.type) && - Objects.equals(this.updatedAt, trackingPlanV1.updatedAt) && - Objects.equals(this.createdAt, trackingPlanV1.createdAt); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, slug, description, type, updatedAt, createdAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TrackingPlanV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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"; + + 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("name"); + openapiFields.add("slug"); + openapiFields.add("description"); + openapiFields.add("type"); + openapiFields.add("updatedAt"); + openapiFields.add("createdAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("slug"); - openapiFields.add("description"); - openapiFields.add("type"); - openapiFields.add("updatedAt"); - openapiFields.add("createdAt"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("type"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to TrackingPlanV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!TrackingPlanV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in TrackingPlanV1 is not found in the empty JSON string", TrackingPlanV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TrackingPlanV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TrackingPlanV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TrackingPlanV1 is not found in the" + + " empty JSON string", + TrackingPlanV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!TrackingPlanV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TrackingPlanV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TrackingPlanV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `TrackingPlanV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : TrackingPlanV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TrackingPlanV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("slug") != null && !jsonObj.get("slug").isJsonNull()) + && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").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("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("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("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) + && !jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdAt").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())); - } - 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("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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("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("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("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) && !jsonObj.get("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!TrackingPlanV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'TrackingPlanV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(TrackingPlanV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, TrackingPlanV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public TrackingPlanV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of TrackingPlanV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of TrackingPlanV1 - * @throws IOException if the JSON string is invalid with respect to TrackingPlanV1 - */ - public static TrackingPlanV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, TrackingPlanV1.class); - } - - /** - * Convert an instance of TrackingPlanV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TrackingPlanV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TrackingPlanV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TrackingPlanV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TrackingPlanV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TrackingPlanV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TrackingPlanV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of TrackingPlanV1 + * @throws IOException if the JSON string is invalid with respect to TrackingPlanV1 + */ + public static TrackingPlanV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TrackingPlanV1.class); + } + + /** + * Convert an instance of TrackingPlanV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/TraitDefinition.java b/src/main/java/com/segment/publicapi/models/TraitDefinition.java new file mode 100644 index 00000000..f7790ee3 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/TraitDefinition.java @@ -0,0 +1,296 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** TraitDefinition */ +public class TraitDefinition { + /** + * The underlying data type being aggregated for this computed trait. Possible values: users, + * accounts. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACCOUNTS("ACCOUNTS"), + + USERS("USERS"); + + 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_QUERY = "query"; + + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + + public TraitDefinition() {} + + public TraitDefinition type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * The underlying data type being aggregated for this computed trait. Possible values: users, + * accounts. + * + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + public TraitDefinition query(String query) { + + this.query = query; + return this; + } + + /** + * The query language string defining the computed trait aggregation criteria. For guidance on + * using the query language, see the [Segment documentation + * site](https://segment.com/docs/api/public-api/query-language). + * + * @return query + */ + @javax.annotation.Nonnull + 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; + } + TraitDefinition traitDefinition = (TraitDefinition) o; + return Objects.equals(this.type, traitDefinition.type) + && Objects.equals(this.query, traitDefinition.query); + } + + @Override + public int hashCode() { + return Objects.hash(type, query); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TraitDefinition {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\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("type"); + openapiFields.add("query"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("query"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TraitDefinition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TraitDefinition.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TraitDefinition is not found in the" + + " empty JSON string", + TraitDefinition.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TraitDefinition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `TraitDefinition` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TraitDefinition.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!TraitDefinition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TraitDefinition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TraitDefinition.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TraitDefinition value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TraitDefinition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TraitDefinition given an JSON string + * + * @param jsonString JSON string + * @return An instance of TraitDefinition + * @throws IOException if the JSON string is invalid with respect to TraitDefinition + */ + public static TraitDefinition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TraitDefinition.class); + } + + /** + * Convert an instance of TraitDefinition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/TraitOptions.java b/src/main/java/com/segment/publicapi/models/TraitOptions.java new file mode 100644 index 00000000..df3090d0 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/TraitOptions.java @@ -0,0 +1,225 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** TraitOptions */ +public class TraitOptions { + public static final String SERIALIZED_NAME_INCLUDE_HISTORICAL_DATA = "includeHistoricalData"; + + @SerializedName(SERIALIZED_NAME_INCLUDE_HISTORICAL_DATA) + private Boolean includeHistoricalData; + + public static final String SERIALIZED_NAME_INCLUDE_ANONYMOUS_USERS = "includeAnonymousUsers"; + + @SerializedName(SERIALIZED_NAME_INCLUDE_ANONYMOUS_USERS) + private Boolean includeAnonymousUsers; + + public TraitOptions() {} + + public TraitOptions includeHistoricalData(Boolean includeHistoricalData) { + + this.includeHistoricalData = includeHistoricalData; + return this; + } + + /** + * Determines whether data prior to the computed trait being created is included when + * determining the computed trait value. Note that including historical data may be needed in + * order to properly handle the definition specified. In these cases, Segment will automatically + * handle including historical data and the response will return the includeHistoricalData + * parameter as true. + * + * @return includeHistoricalData + */ + @javax.annotation.Nullable + public Boolean getIncludeHistoricalData() { + return includeHistoricalData; + } + + public void setIncludeHistoricalData(Boolean includeHistoricalData) { + this.includeHistoricalData = includeHistoricalData; + } + + public TraitOptions includeAnonymousUsers(Boolean includeAnonymousUsers) { + + this.includeAnonymousUsers = includeAnonymousUsers; + return this; + } + + /** + * Determines whether anonymous users should be included when determining the computed trait + * value. + * + * @return includeAnonymousUsers + */ + @javax.annotation.Nullable + public Boolean getIncludeAnonymousUsers() { + return includeAnonymousUsers; + } + + public void setIncludeAnonymousUsers(Boolean includeAnonymousUsers) { + this.includeAnonymousUsers = includeAnonymousUsers; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TraitOptions traitOptions = (TraitOptions) o; + return Objects.equals(this.includeHistoricalData, traitOptions.includeHistoricalData) + && Objects.equals(this.includeAnonymousUsers, traitOptions.includeAnonymousUsers); + } + + @Override + public int hashCode() { + return Objects.hash(includeHistoricalData, includeAnonymousUsers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TraitOptions {\n"); + sb.append(" includeHistoricalData: ") + .append(toIndentedString(includeHistoricalData)) + .append("\n"); + sb.append(" includeAnonymousUsers: ") + .append(toIndentedString(includeAnonymousUsers)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("includeHistoricalData"); + openapiFields.add("includeAnonymousUsers"); + + // 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 TraitOptions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TraitOptions.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TraitOptions is not found in the empty" + + " JSON string", + TraitOptions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TraitOptions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `TraitOptions` 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 (!TraitOptions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TraitOptions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TraitOptions.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TraitOptions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TraitOptions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TraitOptions given an JSON string + * + * @param jsonString JSON string + * @return An instance of TraitOptions + * @throws IOException if the JSON string is invalid with respect to TraitOptions + */ + public static TraitOptions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TraitOptions.class); + } + + /** + * Convert an instance of TraitOptions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Transformation.java b/src/main/java/com/segment/publicapi/models/Transformation.java deleted file mode 100644 index a7c1ea74..00000000 --- a/src/main/java/com/segment/publicapi/models/Transformation.java +++ /dev/null @@ -1,466 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PropertyRenameBeta; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The retrieved Transformation. - */ -@ApiModel(description = "The retrieved Transformation.") - -public class Transformation { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) - private String destinationMetadataId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; - - public static final String SERIALIZED_NAME_NEW_EVENT_NAME = "newEventName"; - @SerializedName(SERIALIZED_NAME_NEW_EVENT_NAME) - private String newEventName; - - public static final String SERIALIZED_NAME_PROPERTY_RENAMES = "propertyRenames"; - @SerializedName(SERIALIZED_NAME_PROPERTY_RENAMES) - private List propertyRenames = null; - - public Transformation() { - } - - public Transformation id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Transformation. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Transformation.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Transformation name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the Transformation. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the Transformation.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Transformation sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } - - /** - * The Source associated with the Transformation. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source associated with the Transformation.") - - public String getSourceId() { - return sourceId; - } - - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public Transformation destinationMetadataId(String destinationMetadataId) { - - this.destinationMetadataId = destinationMetadataId; - return this; - } - - /** - * The optional Destination metadata associated with the Transformation. - * @return destinationMetadataId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The optional Destination metadata associated with the Transformation.") - - public String getDestinationMetadataId() { - return destinationMetadataId; - } - - - public void setDestinationMetadataId(String destinationMetadataId) { - this.destinationMetadataId = destinationMetadataId; - } - - - public Transformation enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * If the Transformation is enabled. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "If the Transformation is enabled.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Transformation _if(String _if) { - - this._if = _if; - return this; - } - - /** - * If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> \"event='\\<eventName\\>'\" Identify -\\> \"type='identify'\" Group -\\> \"type='group'\" - * @return _if - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> \"event='\\'\" Identify -\\> \"type='identify'\" Group -\\> \"type='group'\"") - - public String getIf() { - return _if; - } - - - public void setIf(String _if) { - this._if = _if; - } - - - public Transformation newEventName(String newEventName) { - - this.newEventName = newEventName; - return this; - } - - /** - * Optional new event name for renaming events. Works only for 'track' event type. - * @return newEventName - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Optional new event name for renaming events. Works only for 'track' event type.") - - public String getNewEventName() { - return newEventName; - } - - - public void setNewEventName(String newEventName) { - this.newEventName = newEventName; - } - - - public Transformation propertyRenames(List propertyRenames) { - - this.propertyRenames = propertyRenames; - return this; - } - - public Transformation addPropertyRenamesItem(PropertyRenameBeta propertyRenamesItem) { - if (this.propertyRenames == null) { - this.propertyRenames = new ArrayList<>(); - } - this.propertyRenames.add(propertyRenamesItem); - return this; - } - - /** - * Optional array for renaming properties collected by your events. - * @return propertyRenames - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Optional array for renaming properties collected by your events.") - - public List getPropertyRenames() { - return propertyRenames; - } - - - public void setPropertyRenames(List propertyRenames) { - this.propertyRenames = propertyRenames; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Transformation transformation = (Transformation) o; - return Objects.equals(this.id, transformation.id) && - Objects.equals(this.name, transformation.name) && - Objects.equals(this.sourceId, transformation.sourceId) && - Objects.equals(this.destinationMetadataId, transformation.destinationMetadataId) && - Objects.equals(this.enabled, transformation.enabled) && - Objects.equals(this._if, transformation._if) && - Objects.equals(this.newEventName, transformation.newEventName) && - Objects.equals(this.propertyRenames, transformation.propertyRenames); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, sourceId, destinationMetadataId, enabled, _if, newEventName, propertyRenames); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Transformation {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" destinationMetadataId: ").append(toIndentedString(destinationMetadataId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" newEventName: ").append(toIndentedString(newEventName)).append("\n"); - sb.append(" propertyRenames: ").append(toIndentedString(propertyRenames)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("sourceId"); - openapiFields.add("destinationMetadataId"); - openapiFields.add("enabled"); - openapiFields.add("if"); - openapiFields.add("newEventName"); - openapiFields.add("propertyRenames"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("if"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Transformation - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Transformation.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Transformation is not found in the empty JSON string", Transformation.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Transformation.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Transformation` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Transformation.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if ((jsonObj.get("destinationMetadataId") != null && !jsonObj.get("destinationMetadataId").isJsonNull()) && !jsonObj.get("destinationMetadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationMetadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationMetadataId").toString())); - } - if (!jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - if ((jsonObj.get("newEventName") != null && !jsonObj.get("newEventName").isJsonNull()) && !jsonObj.get("newEventName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `newEventName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("newEventName").toString())); - } - if (jsonObj.get("propertyRenames") != null && !jsonObj.get("propertyRenames").isJsonNull()) { - JsonArray jsonArraypropertyRenames = jsonObj.getAsJsonArray("propertyRenames"); - if (jsonArraypropertyRenames != null) { - // ensure the json data is an array - if (!jsonObj.get("propertyRenames").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `propertyRenames` to be an array in the JSON string but got `%s`", jsonObj.get("propertyRenames").toString())); - } - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Transformation.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Transformation' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Transformation.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Transformation value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Transformation read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Transformation given an JSON string - * - * @param jsonString JSON string - * @return An instance of Transformation - * @throws IOException if the JSON string is invalid with respect to Transformation - */ - public static Transformation fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Transformation.class); - } - - /** - * Convert an instance of Transformation to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Transformation1.java b/src/main/java/com/segment/publicapi/models/Transformation1.java deleted file mode 100644 index cb4f6074..00000000 --- a/src/main/java/com/segment/publicapi/models/Transformation1.java +++ /dev/null @@ -1,466 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PropertyRenameBeta; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The updated Transformation. - */ -@ApiModel(description = "The updated Transformation.") - -public class Transformation1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) - private String destinationMetadataId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; - - public static final String SERIALIZED_NAME_NEW_EVENT_NAME = "newEventName"; - @SerializedName(SERIALIZED_NAME_NEW_EVENT_NAME) - private String newEventName; - - public static final String SERIALIZED_NAME_PROPERTY_RENAMES = "propertyRenames"; - @SerializedName(SERIALIZED_NAME_PROPERTY_RENAMES) - private List propertyRenames = null; - - public Transformation1() { - } - - public Transformation1 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Transformation. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Transformation.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Transformation1 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the Transformation. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the Transformation.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Transformation1 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } - - /** - * The Source associated with the Transformation. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source associated with the Transformation.") - - public String getSourceId() { - return sourceId; - } - - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public Transformation1 destinationMetadataId(String destinationMetadataId) { - - this.destinationMetadataId = destinationMetadataId; - return this; - } - - /** - * The optional Destination metadata associated with the Transformation. - * @return destinationMetadataId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The optional Destination metadata associated with the Transformation.") - - public String getDestinationMetadataId() { - return destinationMetadataId; - } - - - public void setDestinationMetadataId(String destinationMetadataId) { - this.destinationMetadataId = destinationMetadataId; - } - - - public Transformation1 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * If the Transformation is enabled. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "If the Transformation is enabled.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Transformation1 _if(String _if) { - - this._if = _if; - return this; - } - - /** - * If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> \"event='\\<eventName\\>'\" Identify -\\> \"type='identify'\" Group -\\> \"type='group'\" - * @return _if - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> \"event='\\'\" Identify -\\> \"type='identify'\" Group -\\> \"type='group'\"") - - public String getIf() { - return _if; - } - - - public void setIf(String _if) { - this._if = _if; - } - - - public Transformation1 newEventName(String newEventName) { - - this.newEventName = newEventName; - return this; - } - - /** - * Optional new event name for renaming events. Works only for 'track' event type. - * @return newEventName - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Optional new event name for renaming events. Works only for 'track' event type.") - - public String getNewEventName() { - return newEventName; - } - - - public void setNewEventName(String newEventName) { - this.newEventName = newEventName; - } - - - public Transformation1 propertyRenames(List propertyRenames) { - - this.propertyRenames = propertyRenames; - return this; - } - - public Transformation1 addPropertyRenamesItem(PropertyRenameBeta propertyRenamesItem) { - if (this.propertyRenames == null) { - this.propertyRenames = new ArrayList<>(); - } - this.propertyRenames.add(propertyRenamesItem); - return this; - } - - /** - * Optional array for renaming properties collected by your events. - * @return propertyRenames - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Optional array for renaming properties collected by your events.") - - public List getPropertyRenames() { - return propertyRenames; - } - - - public void setPropertyRenames(List propertyRenames) { - this.propertyRenames = propertyRenames; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Transformation1 transformation1 = (Transformation1) o; - return Objects.equals(this.id, transformation1.id) && - Objects.equals(this.name, transformation1.name) && - Objects.equals(this.sourceId, transformation1.sourceId) && - Objects.equals(this.destinationMetadataId, transformation1.destinationMetadataId) && - Objects.equals(this.enabled, transformation1.enabled) && - Objects.equals(this._if, transformation1._if) && - Objects.equals(this.newEventName, transformation1.newEventName) && - Objects.equals(this.propertyRenames, transformation1.propertyRenames); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, sourceId, destinationMetadataId, enabled, _if, newEventName, propertyRenames); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Transformation1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" destinationMetadataId: ").append(toIndentedString(destinationMetadataId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" newEventName: ").append(toIndentedString(newEventName)).append("\n"); - sb.append(" propertyRenames: ").append(toIndentedString(propertyRenames)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("sourceId"); - openapiFields.add("destinationMetadataId"); - openapiFields.add("enabled"); - openapiFields.add("if"); - openapiFields.add("newEventName"); - openapiFields.add("propertyRenames"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("if"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Transformation1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Transformation1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Transformation1 is not found in the empty JSON string", Transformation1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Transformation1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Transformation1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Transformation1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if ((jsonObj.get("destinationMetadataId") != null && !jsonObj.get("destinationMetadataId").isJsonNull()) && !jsonObj.get("destinationMetadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationMetadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationMetadataId").toString())); - } - if (!jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - if ((jsonObj.get("newEventName") != null && !jsonObj.get("newEventName").isJsonNull()) && !jsonObj.get("newEventName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `newEventName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("newEventName").toString())); - } - if (jsonObj.get("propertyRenames") != null && !jsonObj.get("propertyRenames").isJsonNull()) { - JsonArray jsonArraypropertyRenames = jsonObj.getAsJsonArray("propertyRenames"); - if (jsonArraypropertyRenames != null) { - // ensure the json data is an array - if (!jsonObj.get("propertyRenames").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `propertyRenames` to be an array in the JSON string but got `%s`", jsonObj.get("propertyRenames").toString())); - } - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Transformation1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Transformation1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Transformation1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Transformation1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Transformation1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Transformation1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Transformation1 - * @throws IOException if the JSON string is invalid with respect to Transformation1 - */ - public static Transformation1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Transformation1.class); - } - - /** - * Convert an instance of Transformation1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Transformation2.java b/src/main/java/com/segment/publicapi/models/Transformation2.java deleted file mode 100644 index 0f76e959..00000000 --- a/src/main/java/com/segment/publicapi/models/Transformation2.java +++ /dev/null @@ -1,466 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PropertyRenameBeta; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The created Transformation. - */ -@ApiModel(description = "The created Transformation.") - -public class Transformation2 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) - private String destinationMetadataId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; - - public static final String SERIALIZED_NAME_NEW_EVENT_NAME = "newEventName"; - @SerializedName(SERIALIZED_NAME_NEW_EVENT_NAME) - private String newEventName; - - public static final String SERIALIZED_NAME_PROPERTY_RENAMES = "propertyRenames"; - @SerializedName(SERIALIZED_NAME_PROPERTY_RENAMES) - private List propertyRenames = null; - - public Transformation2() { - } - - public Transformation2 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Transformation. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Transformation.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Transformation2 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the Transformation. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the Transformation.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public Transformation2 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } - - /** - * The Source associated with the Transformation. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source associated with the Transformation.") - - public String getSourceId() { - return sourceId; - } - - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - - public Transformation2 destinationMetadataId(String destinationMetadataId) { - - this.destinationMetadataId = destinationMetadataId; - return this; - } - - /** - * The optional Destination metadata associated with the Transformation. - * @return destinationMetadataId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The optional Destination metadata associated with the Transformation.") - - public String getDestinationMetadataId() { - return destinationMetadataId; - } - - - public void setDestinationMetadataId(String destinationMetadataId) { - this.destinationMetadataId = destinationMetadataId; - } - - - public Transformation2 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * If the Transformation is enabled. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "If the Transformation is enabled.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Transformation2 _if(String _if) { - - this._if = _if; - return this; - } - - /** - * If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> \"event='\\<eventName\\>'\" Identify -\\> \"type='identify'\" Group -\\> \"type='group'\" - * @return _if - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> \"event='\\'\" Identify -\\> \"type='identify'\" Group -\\> \"type='group'\"") - - public String getIf() { - return _if; - } - - - public void setIf(String _if) { - this._if = _if; - } - - - public Transformation2 newEventName(String newEventName) { - - this.newEventName = newEventName; - return this; - } - - /** - * Optional new event name for renaming events. Works only for 'track' event type. - * @return newEventName - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Optional new event name for renaming events. Works only for 'track' event type.") - - public String getNewEventName() { - return newEventName; - } - - - public void setNewEventName(String newEventName) { - this.newEventName = newEventName; - } - - - public Transformation2 propertyRenames(List propertyRenames) { - - this.propertyRenames = propertyRenames; - return this; - } - - public Transformation2 addPropertyRenamesItem(PropertyRenameBeta propertyRenamesItem) { - if (this.propertyRenames == null) { - this.propertyRenames = new ArrayList<>(); - } - this.propertyRenames.add(propertyRenamesItem); - return this; - } - - /** - * Optional array for renaming properties collected by your events. - * @return propertyRenames - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Optional array for renaming properties collected by your events.") - - public List getPropertyRenames() { - return propertyRenames; - } - - - public void setPropertyRenames(List propertyRenames) { - this.propertyRenames = propertyRenames; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Transformation2 transformation2 = (Transformation2) o; - return Objects.equals(this.id, transformation2.id) && - Objects.equals(this.name, transformation2.name) && - Objects.equals(this.sourceId, transformation2.sourceId) && - Objects.equals(this.destinationMetadataId, transformation2.destinationMetadataId) && - Objects.equals(this.enabled, transformation2.enabled) && - Objects.equals(this._if, transformation2._if) && - Objects.equals(this.newEventName, transformation2.newEventName) && - Objects.equals(this.propertyRenames, transformation2.propertyRenames); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, sourceId, destinationMetadataId, enabled, _if, newEventName, propertyRenames); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Transformation2 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" destinationMetadataId: ").append(toIndentedString(destinationMetadataId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" newEventName: ").append(toIndentedString(newEventName)).append("\n"); - sb.append(" propertyRenames: ").append(toIndentedString(propertyRenames)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("sourceId"); - openapiFields.add("destinationMetadataId"); - openapiFields.add("enabled"); - openapiFields.add("if"); - openapiFields.add("newEventName"); - openapiFields.add("propertyRenames"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("if"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Transformation2 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Transformation2.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Transformation2 is not found in the empty JSON string", Transformation2.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Transformation2.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Transformation2` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Transformation2.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if ((jsonObj.get("destinationMetadataId") != null && !jsonObj.get("destinationMetadataId").isJsonNull()) && !jsonObj.get("destinationMetadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationMetadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationMetadataId").toString())); - } - if (!jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - if ((jsonObj.get("newEventName") != null && !jsonObj.get("newEventName").isJsonNull()) && !jsonObj.get("newEventName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `newEventName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("newEventName").toString())); - } - if (jsonObj.get("propertyRenames") != null && !jsonObj.get("propertyRenames").isJsonNull()) { - JsonArray jsonArraypropertyRenames = jsonObj.getAsJsonArray("propertyRenames"); - if (jsonArraypropertyRenames != null) { - // ensure the json data is an array - if (!jsonObj.get("propertyRenames").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `propertyRenames` to be an array in the JSON string but got `%s`", jsonObj.get("propertyRenames").toString())); - } - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Transformation2.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Transformation2' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Transformation2.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Transformation2 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Transformation2 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Transformation2 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Transformation2 - * @throws IOException if the JSON string is invalid with respect to Transformation2 - */ - public static Transformation2 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Transformation2.class); - } - - /** - * Convert an instance of Transformation2 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/TransformationBeta.java b/src/main/java/com/segment/publicapi/models/TransformationBeta.java index 0b7d356a..ee496cc6 100644 --- a/src/main/java/com/segment/publicapi/models/TransformationBeta.java +++ b/src/main/java/com/segment/publicapi/models/TransformationBeta.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,457 +9,551 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PropertyRenameBeta; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Represents a Transformation. */ +public class TransformationBeta { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * Represents a Transformation. - */ -@ApiModel(description = "Represents a Transformation.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class TransformationBeta { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) - private String destinationMetadataId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; - public static final String SERIALIZED_NAME_NEW_EVENT_NAME = "newEventName"; - @SerializedName(SERIALIZED_NAME_NEW_EVENT_NAME) - private String newEventName; + public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; - public static final String SERIALIZED_NAME_PROPERTY_RENAMES = "propertyRenames"; - @SerializedName(SERIALIZED_NAME_PROPERTY_RENAMES) - private List propertyRenames = null; + @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) + private String destinationMetadataId; - public TransformationBeta() { - } + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public TransformationBeta id(String id) { - - this.id = id; - return this; - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - /** - * The id of the Transformation. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Transformation.") + public static final String SERIALIZED_NAME_IF = "if"; - public String getId() { - return id; - } + @SerializedName(SERIALIZED_NAME_IF) + private String _if; + public static final String SERIALIZED_NAME_NEW_EVENT_NAME = "newEventName"; - public void setId(String id) { - this.id = id; - } + @SerializedName(SERIALIZED_NAME_NEW_EVENT_NAME) + private String newEventName; + public static final String SERIALIZED_NAME_PROPERTY_RENAMES = "propertyRenames"; - public TransformationBeta name(String name) { - - this.name = name; - return this; - } + @SerializedName(SERIALIZED_NAME_PROPERTY_RENAMES) + private List propertyRenames; - /** - * The name of the Transformation. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the Transformation.") + public static final String SERIALIZED_NAME_PROPERTY_VALUE_TRANSFORMATIONS = + "propertyValueTransformations"; - public String getName() { - return name; - } + @SerializedName(SERIALIZED_NAME_PROPERTY_VALUE_TRANSFORMATIONS) + private List propertyValueTransformations; + public TransformationBeta() {} - public void setName(String name) { - this.name = name; - } + public TransformationBeta id(String id) { + this.id = id; + return this; + } - public TransformationBeta sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + /** + * The id of the Transformation. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - /** - * The Source associated with the Transformation. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source associated with the Transformation.") + public void setId(String id) { + this.id = id; + } - public String getSourceId() { - return sourceId; - } + public TransformationBeta name(String name) { + this.name = name; + return this; + } - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + /** + * The name of the Transformation. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } - public TransformationBeta destinationMetadataId(String destinationMetadataId) { - - this.destinationMetadataId = destinationMetadataId; - return this; - } + public TransformationBeta sourceId(String sourceId) { - /** - * The optional Destination metadata associated with the Transformation. - * @return destinationMetadataId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The optional Destination metadata associated with the Transformation.") + this.sourceId = sourceId; + return this; + } - public String getDestinationMetadataId() { - return destinationMetadataId; - } + /** + * The Source associated with the Transformation. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } - public void setDestinationMetadataId(String destinationMetadataId) { - this.destinationMetadataId = destinationMetadataId; - } + public TransformationBeta destinationMetadataId(String destinationMetadataId) { + this.destinationMetadataId = destinationMetadataId; + return this; + } - public TransformationBeta enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + /** + * The optional Destination metadata associated with the Transformation. + * + * @return destinationMetadataId + */ + @javax.annotation.Nullable + public String getDestinationMetadataId() { + return destinationMetadataId; + } + + public void setDestinationMetadataId(String destinationMetadataId) { + this.destinationMetadataId = destinationMetadataId; + } - /** - * If the Transformation is enabled. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "If the Transformation is enabled.") + public TransformationBeta enabled(Boolean enabled) { - public Boolean getEnabled() { - return enabled; - } + this.enabled = enabled; + return this; + } + /** + * If the Transformation is enabled. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + public TransformationBeta _if(String _if) { - public TransformationBeta _if(String _if) { - - this._if = _if; - return this; - } + this._if = _if; + return this; + } + + /** + * If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard + * event matchers, use the following: Track -\\> + * \"event='\\<eventName\\>'\" Identify -\\> + * \"type='identify'\" Group -\\> + * \"type='group'\" + * + * @return _if + */ + @javax.annotation.Nonnull + public String getIf() { + return _if; + } + + public void setIf(String _if) { + this._if = _if; + } + + public TransformationBeta newEventName(String newEventName) { + + this.newEventName = newEventName; + return this; + } + + /** + * Optional new event name for renaming events. Works only for 'track' event type. + * + * @return newEventName + */ + @javax.annotation.Nullable + public String getNewEventName() { + return newEventName; + } + + public void setNewEventName(String newEventName) { + this.newEventName = newEventName; + } - /** - * If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> \"event='\\<eventName\\>'\" Identify -\\> \"type='identify'\" Group -\\> \"type='group'\" - * @return _if - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> \"event='\\'\" Identify -\\> \"type='identify'\" Group -\\> \"type='group'\"") - - public String getIf() { - return _if; - } - - - public void setIf(String _if) { - this._if = _if; - } - - - public TransformationBeta newEventName(String newEventName) { - - this.newEventName = newEventName; - return this; - } - - /** - * Optional new event name for renaming events. Works only for 'track' event type. - * @return newEventName - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Optional new event name for renaming events. Works only for 'track' event type.") - - public String getNewEventName() { - return newEventName; - } - - - public void setNewEventName(String newEventName) { - this.newEventName = newEventName; - } - - - public TransformationBeta propertyRenames(List propertyRenames) { - - this.propertyRenames = propertyRenames; - return this; - } - - public TransformationBeta addPropertyRenamesItem(PropertyRenameBeta propertyRenamesItem) { - if (this.propertyRenames == null) { - this.propertyRenames = new ArrayList<>(); - } - this.propertyRenames.add(propertyRenamesItem); - return this; - } - - /** - * Optional array for renaming properties collected by your events. - * @return propertyRenames - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Optional array for renaming properties collected by your events.") - - public List getPropertyRenames() { - return propertyRenames; - } - - - public void setPropertyRenames(List propertyRenames) { - this.propertyRenames = propertyRenames; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TransformationBeta transformationBeta = (TransformationBeta) o; - return Objects.equals(this.id, transformationBeta.id) && - Objects.equals(this.name, transformationBeta.name) && - Objects.equals(this.sourceId, transformationBeta.sourceId) && - Objects.equals(this.destinationMetadataId, transformationBeta.destinationMetadataId) && - Objects.equals(this.enabled, transformationBeta.enabled) && - Objects.equals(this._if, transformationBeta._if) && - Objects.equals(this.newEventName, transformationBeta.newEventName) && - Objects.equals(this.propertyRenames, transformationBeta.propertyRenames); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, sourceId, destinationMetadataId, enabled, _if, newEventName, propertyRenames); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TransformationBeta {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" destinationMetadataId: ").append(toIndentedString(destinationMetadataId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" newEventName: ").append(toIndentedString(newEventName)).append("\n"); - sb.append(" propertyRenames: ").append(toIndentedString(propertyRenames)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("sourceId"); - openapiFields.add("destinationMetadataId"); - openapiFields.add("enabled"); - openapiFields.add("if"); - openapiFields.add("newEventName"); - openapiFields.add("propertyRenames"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("if"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to TransformationBeta - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!TransformationBeta.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in TransformationBeta is not found in the empty JSON string", TransformationBeta.openapiRequiredFields.toString())); + public TransformationBeta propertyRenames(List propertyRenames) { + + this.propertyRenames = propertyRenames; + return this; + } + + public TransformationBeta addPropertyRenamesItem(PropertyRenameBeta propertyRenamesItem) { + if (this.propertyRenames == null) { + this.propertyRenames = new ArrayList<>(); } - } + this.propertyRenames.add(propertyRenamesItem); + return this; + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!TransformationBeta.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TransformationBeta` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + /** + * Optional array for renaming properties collected by your events. + * + * @return propertyRenames + */ + @javax.annotation.Nullable + public List getPropertyRenames() { + return propertyRenames; + } + + public void setPropertyRenames(List propertyRenames) { + this.propertyRenames = propertyRenames; + } + + public TransformationBeta propertyValueTransformations( + List propertyValueTransformations) { + + this.propertyValueTransformations = propertyValueTransformations; + return this; + } + + public TransformationBeta addPropertyValueTransformationsItem( + PropertyValueTransformationBeta propertyValueTransformationsItem) { + if (this.propertyValueTransformations == null) { + this.propertyValueTransformations = new ArrayList<>(); } - } + this.propertyValueTransformations.add(propertyValueTransformationsItem); + return this; + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : TransformationBeta.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + /** + * Optional array for transforming properties and values collected by your events. Limited to 10 + * properties. + * + * @return propertyValueTransformations + */ + @javax.annotation.Nullable + public List getPropertyValueTransformations() { + return propertyValueTransformations; + } + + public void setPropertyValueTransformations( + List propertyValueTransformations) { + this.propertyValueTransformations = propertyValueTransformations; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - } - 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("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("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if ((jsonObj.get("destinationMetadataId") != null && !jsonObj.get("destinationMetadataId").isJsonNull()) && !jsonObj.get("destinationMetadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationMetadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationMetadataId").toString())); - } - if (!jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - if ((jsonObj.get("newEventName") != null && !jsonObj.get("newEventName").isJsonNull()) && !jsonObj.get("newEventName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `newEventName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("newEventName").toString())); - } - if (jsonObj.get("propertyRenames") != null && !jsonObj.get("propertyRenames").isJsonNull()) { - JsonArray jsonArraypropertyRenames = jsonObj.getAsJsonArray("propertyRenames"); - if (jsonArraypropertyRenames != null) { - // ensure the json data is an array - if (!jsonObj.get("propertyRenames").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `propertyRenames` to be an array in the JSON string but got `%s`", jsonObj.get("propertyRenames").toString())); - } + if (o == null || getClass() != o.getClass()) { + return false; } - } - } + TransformationBeta transformationBeta = (TransformationBeta) o; + return Objects.equals(this.id, transformationBeta.id) + && Objects.equals(this.name, transformationBeta.name) + && Objects.equals(this.sourceId, transformationBeta.sourceId) + && Objects.equals( + this.destinationMetadataId, transformationBeta.destinationMetadataId) + && Objects.equals(this.enabled, transformationBeta.enabled) + && Objects.equals(this._if, transformationBeta._if) + && Objects.equals(this.newEventName, transformationBeta.newEventName) + && Objects.equals(this.propertyRenames, transformationBeta.propertyRenames) + && Objects.equals( + this.propertyValueTransformations, + transformationBeta.propertyValueTransformations); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!TransformationBeta.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'TransformationBeta' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(TransformationBeta.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, TransformationBeta value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public TransformationBeta read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of TransformationBeta given an JSON string - * - * @param jsonString JSON string - * @return An instance of TransformationBeta - * @throws IOException if the JSON string is invalid with respect to TransformationBeta - */ - public static TransformationBeta fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, TransformationBeta.class); - } - - /** - * Convert an instance of TransformationBeta to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public int hashCode() { + return Objects.hash( + id, + name, + sourceId, + destinationMetadataId, + enabled, + _if, + newEventName, + propertyRenames, + propertyValueTransformations); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TransformationBeta {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" destinationMetadataId: ") + .append(toIndentedString(destinationMetadataId)) + .append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" newEventName: ").append(toIndentedString(newEventName)).append("\n"); + sb.append(" propertyRenames: ").append(toIndentedString(propertyRenames)).append("\n"); + sb.append(" propertyValueTransformations: ") + .append(toIndentedString(propertyValueTransformations)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("name"); + openapiFields.add("sourceId"); + openapiFields.add("destinationMetadataId"); + openapiFields.add("enabled"); + openapiFields.add("if"); + openapiFields.add("newEventName"); + openapiFields.add("propertyRenames"); + openapiFields.add("propertyValueTransformations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("if"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TransformationBeta + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TransformationBeta.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TransformationBeta is not found in the" + + " empty JSON string", + TransformationBeta.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TransformationBeta.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `TransformationBeta` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TransformationBeta.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if ((jsonObj.get("destinationMetadataId") != null + && !jsonObj.get("destinationMetadataId").isJsonNull()) + && !jsonObj.get("destinationMetadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `destinationMetadataId` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("destinationMetadataId").toString())); + } + if (!jsonObj.get("if").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `if` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("if").toString())); + } + if ((jsonObj.get("newEventName") != null && !jsonObj.get("newEventName").isJsonNull()) + && !jsonObj.get("newEventName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `newEventName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("newEventName").toString())); + } + if (jsonObj.get("propertyRenames") != null + && !jsonObj.get("propertyRenames").isJsonNull()) { + JsonArray jsonArraypropertyRenames = jsonObj.getAsJsonArray("propertyRenames"); + if (jsonArraypropertyRenames != null) { + // ensure the json data is an array + if (!jsonObj.get("propertyRenames").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyRenames` to be an array in the" + + " JSON string but got `%s`", + jsonObj.get("propertyRenames").toString())); + } + + // validate the optional field `propertyRenames` (array) + for (int i = 0; i < jsonArraypropertyRenames.size(); i++) { + PropertyRenameBeta.validateJsonElement(jsonArraypropertyRenames.get(i)); + } + ; + } + } + if (jsonObj.get("propertyValueTransformations") != null + && !jsonObj.get("propertyValueTransformations").isJsonNull()) { + JsonArray jsonArraypropertyValueTransformations = + jsonObj.getAsJsonArray("propertyValueTransformations"); + if (jsonArraypropertyValueTransformations != null) { + // ensure the json data is an array + if (!jsonObj.get("propertyValueTransformations").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyValueTransformations` to be an" + + " array in the JSON string but got `%s`", + jsonObj.get("propertyValueTransformations").toString())); + } + + // validate the optional field `propertyValueTransformations` (array) + for (int i = 0; i < jsonArraypropertyValueTransformations.size(); i++) { + PropertyValueTransformationBeta.validateJsonElement( + jsonArraypropertyValueTransformations.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TransformationBeta.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TransformationBeta' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TransformationBeta.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TransformationBeta value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TransformationBeta read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TransformationBeta given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransformationBeta + * @throws IOException if the JSON string is invalid with respect to TransformationBeta + */ + public static TransformationBeta fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TransformationBeta.class); + } + + /** + * Convert an instance of TransformationBeta to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/TransformationV1.java b/src/main/java/com/segment/publicapi/models/TransformationV1.java new file mode 100644 index 00000000..6bbc7712 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/TransformationV1.java @@ -0,0 +1,739 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Represents a Transformation. */ +public class TransformationV1 { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; + + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; + + public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; + + @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) + private String destinationMetadataId; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_IF = "if"; + + @SerializedName(SERIALIZED_NAME_IF) + private String _if; + + public static final String SERIALIZED_NAME_DROP = "drop"; + + @SerializedName(SERIALIZED_NAME_DROP) + private Boolean drop; + + public static final String SERIALIZED_NAME_NEW_EVENT_NAME = "newEventName"; + + @SerializedName(SERIALIZED_NAME_NEW_EVENT_NAME) + private String newEventName; + + public static final String SERIALIZED_NAME_PROPERTY_RENAMES = "propertyRenames"; + + @SerializedName(SERIALIZED_NAME_PROPERTY_RENAMES) + private List propertyRenames; + + public static final String SERIALIZED_NAME_PROPERTY_VALUE_TRANSFORMATIONS = + "propertyValueTransformations"; + + @SerializedName(SERIALIZED_NAME_PROPERTY_VALUE_TRANSFORMATIONS) + private List propertyValueTransformations; + + public static final String SERIALIZED_NAME_FQL_DEFINED_PROPERTIES = "fqlDefinedProperties"; + + @SerializedName(SERIALIZED_NAME_FQL_DEFINED_PROPERTIES) + private List fqlDefinedProperties; + + public static final String SERIALIZED_NAME_ALLOW_PROPERTIES = "allowProperties"; + + @SerializedName(SERIALIZED_NAME_ALLOW_PROPERTIES) + private List allowProperties; + + public static final String SERIALIZED_NAME_HASH_PROPERTIES_CONFIGURATION = + "hashPropertiesConfiguration"; + + @SerializedName(SERIALIZED_NAME_HASH_PROPERTIES_CONFIGURATION) + private HashPropertiesConfiguration hashPropertiesConfiguration; + + public TransformationV1() {} + + public TransformationV1 id(String id) { + + this.id = id; + return this; + } + + /** + * The id of the Transformation. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public TransformationV1 name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the Transformation. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public TransformationV1 sourceId(String sourceId) { + + this.sourceId = sourceId; + return this; + } + + /** + * The Source associated with the Transformation. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public TransformationV1 destinationMetadataId(String destinationMetadataId) { + + this.destinationMetadataId = destinationMetadataId; + return this; + } + + /** + * The optional Destination metadata associated with the Transformation. + * + * @return destinationMetadataId + */ + @javax.annotation.Nullable + public String getDestinationMetadataId() { + return destinationMetadataId; + } + + public void setDestinationMetadataId(String destinationMetadataId) { + this.destinationMetadataId = destinationMetadataId; + } + + public TransformationV1 enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * If the Transformation is enabled. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public TransformationV1 _if(String _if) { + + this._if = _if; + return this; + } + + /** + * If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard + * event matchers, use the following: Track -\\> + * \"event='\\<eventName\\>'\" Identify -\\> + * \"type='identify'\" Group -\\> + * \"type='group'\" + * + * @return _if + */ + @javax.annotation.Nonnull + public String getIf() { + return _if; + } + + public void setIf(String _if) { + this._if = _if; + } + + public TransformationV1 drop(Boolean drop) { + + this.drop = drop; + return this; + } + + /** + * Optional boolean value if the Transformation should drop the event entirely when the if + * statement matches, ignores all other transforms. + * + * @return drop + */ + @javax.annotation.Nullable + public Boolean getDrop() { + return drop; + } + + public void setDrop(Boolean drop) { + this.drop = drop; + } + + public TransformationV1 newEventName(String newEventName) { + + this.newEventName = newEventName; + return this; + } + + /** + * Optional new event name for renaming events. Works only for 'track' event type. + * + * @return newEventName + */ + @javax.annotation.Nullable + public String getNewEventName() { + return newEventName; + } + + public void setNewEventName(String newEventName) { + this.newEventName = newEventName; + } + + public TransformationV1 propertyRenames(List propertyRenames) { + + this.propertyRenames = propertyRenames; + return this; + } + + public TransformationV1 addPropertyRenamesItem(PropertyRenameV1 propertyRenamesItem) { + if (this.propertyRenames == null) { + this.propertyRenames = new ArrayList<>(); + } + this.propertyRenames.add(propertyRenamesItem); + return this; + } + + /** + * Optional array for renaming properties collected by your events. + * + * @return propertyRenames + */ + @javax.annotation.Nullable + public List getPropertyRenames() { + return propertyRenames; + } + + public void setPropertyRenames(List propertyRenames) { + this.propertyRenames = propertyRenames; + } + + public TransformationV1 propertyValueTransformations( + List propertyValueTransformations) { + + this.propertyValueTransformations = propertyValueTransformations; + return this; + } + + public TransformationV1 addPropertyValueTransformationsItem( + PropertyValueTransformationV1 propertyValueTransformationsItem) { + if (this.propertyValueTransformations == null) { + this.propertyValueTransformations = new ArrayList<>(); + } + this.propertyValueTransformations.add(propertyValueTransformationsItem); + return this; + } + + /** + * Optional array for transforming properties and values collected by your events. Limited to 10 + * properties. + * + * @return propertyValueTransformations + */ + @javax.annotation.Nullable + public List getPropertyValueTransformations() { + return propertyValueTransformations; + } + + public void setPropertyValueTransformations( + List propertyValueTransformations) { + this.propertyValueTransformations = propertyValueTransformations; + } + + public TransformationV1 fqlDefinedProperties(List fqlDefinedProperties) { + + this.fqlDefinedProperties = fqlDefinedProperties; + return this; + } + + public TransformationV1 addFqlDefinedPropertiesItem( + FQLDefinedPropertyV1 fqlDefinedPropertiesItem) { + if (this.fqlDefinedProperties == null) { + this.fqlDefinedProperties = new ArrayList<>(); + } + this.fqlDefinedProperties.add(fqlDefinedPropertiesItem); + return this; + } + + /** + * Optional array for defining new properties in FQL. Limited to 1 property right now. + * + * @return fqlDefinedProperties + */ + @javax.annotation.Nullable + public List getFqlDefinedProperties() { + return fqlDefinedProperties; + } + + public void setFqlDefinedProperties(List fqlDefinedProperties) { + this.fqlDefinedProperties = fqlDefinedProperties; + } + + public TransformationV1 allowProperties(List allowProperties) { + + this.allowProperties = allowProperties; + return this; + } + + public TransformationV1 addAllowPropertiesItem(String allowPropertiesItem) { + if (this.allowProperties == null) { + this.allowProperties = new ArrayList<>(); + } + this.allowProperties.add(allowPropertiesItem); + return this; + } + + /** + * Optional array for allowing properties from your events. + * + * @return allowProperties + */ + @javax.annotation.Nullable + public List getAllowProperties() { + return allowProperties; + } + + public void setAllowProperties(List allowProperties) { + this.allowProperties = allowProperties; + } + + public TransformationV1 hashPropertiesConfiguration( + HashPropertiesConfiguration hashPropertiesConfiguration) { + + this.hashPropertiesConfiguration = hashPropertiesConfiguration; + return this; + } + + /** + * Get hashPropertiesConfiguration + * + * @return hashPropertiesConfiguration + */ + @javax.annotation.Nullable + public HashPropertiesConfiguration getHashPropertiesConfiguration() { + return hashPropertiesConfiguration; + } + + public void setHashPropertiesConfiguration( + HashPropertiesConfiguration hashPropertiesConfiguration) { + this.hashPropertiesConfiguration = hashPropertiesConfiguration; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransformationV1 transformationV1 = (TransformationV1) o; + return Objects.equals(this.id, transformationV1.id) + && Objects.equals(this.name, transformationV1.name) + && Objects.equals(this.sourceId, transformationV1.sourceId) + && Objects.equals( + this.destinationMetadataId, transformationV1.destinationMetadataId) + && Objects.equals(this.enabled, transformationV1.enabled) + && Objects.equals(this._if, transformationV1._if) + && Objects.equals(this.drop, transformationV1.drop) + && Objects.equals(this.newEventName, transformationV1.newEventName) + && Objects.equals(this.propertyRenames, transformationV1.propertyRenames) + && Objects.equals( + this.propertyValueTransformations, + transformationV1.propertyValueTransformations) + && Objects.equals(this.fqlDefinedProperties, transformationV1.fqlDefinedProperties) + && Objects.equals(this.allowProperties, transformationV1.allowProperties) + && Objects.equals( + this.hashPropertiesConfiguration, + transformationV1.hashPropertiesConfiguration); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + name, + sourceId, + destinationMetadataId, + enabled, + _if, + drop, + newEventName, + propertyRenames, + propertyValueTransformations, + fqlDefinedProperties, + allowProperties, + hashPropertiesConfiguration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TransformationV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" destinationMetadataId: ") + .append(toIndentedString(destinationMetadataId)) + .append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" drop: ").append(toIndentedString(drop)).append("\n"); + sb.append(" newEventName: ").append(toIndentedString(newEventName)).append("\n"); + sb.append(" propertyRenames: ").append(toIndentedString(propertyRenames)).append("\n"); + sb.append(" propertyValueTransformations: ") + .append(toIndentedString(propertyValueTransformations)) + .append("\n"); + sb.append(" fqlDefinedProperties: ") + .append(toIndentedString(fqlDefinedProperties)) + .append("\n"); + sb.append(" allowProperties: ").append(toIndentedString(allowProperties)).append("\n"); + sb.append(" hashPropertiesConfiguration: ") + .append(toIndentedString(hashPropertiesConfiguration)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("name"); + openapiFields.add("sourceId"); + openapiFields.add("destinationMetadataId"); + openapiFields.add("enabled"); + openapiFields.add("if"); + openapiFields.add("drop"); + openapiFields.add("newEventName"); + openapiFields.add("propertyRenames"); + openapiFields.add("propertyValueTransformations"); + openapiFields.add("fqlDefinedProperties"); + openapiFields.add("allowProperties"); + openapiFields.add("hashPropertiesConfiguration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("if"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TransformationV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TransformationV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in TransformationV1 is not found in the" + + " empty JSON string", + TransformationV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TransformationV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `TransformationV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TransformationV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if ((jsonObj.get("destinationMetadataId") != null + && !jsonObj.get("destinationMetadataId").isJsonNull()) + && !jsonObj.get("destinationMetadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `destinationMetadataId` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("destinationMetadataId").toString())); + } + if (!jsonObj.get("if").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `if` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("if").toString())); + } + if ((jsonObj.get("newEventName") != null && !jsonObj.get("newEventName").isJsonNull()) + && !jsonObj.get("newEventName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `newEventName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("newEventName").toString())); + } + if (jsonObj.get("propertyRenames") != null + && !jsonObj.get("propertyRenames").isJsonNull()) { + JsonArray jsonArraypropertyRenames = jsonObj.getAsJsonArray("propertyRenames"); + if (jsonArraypropertyRenames != null) { + // ensure the json data is an array + if (!jsonObj.get("propertyRenames").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyRenames` to be an array in the" + + " JSON string but got `%s`", + jsonObj.get("propertyRenames").toString())); + } + + // validate the optional field `propertyRenames` (array) + for (int i = 0; i < jsonArraypropertyRenames.size(); i++) { + PropertyRenameV1.validateJsonElement(jsonArraypropertyRenames.get(i)); + } + ; + } + } + if (jsonObj.get("propertyValueTransformations") != null + && !jsonObj.get("propertyValueTransformations").isJsonNull()) { + JsonArray jsonArraypropertyValueTransformations = + jsonObj.getAsJsonArray("propertyValueTransformations"); + if (jsonArraypropertyValueTransformations != null) { + // ensure the json data is an array + if (!jsonObj.get("propertyValueTransformations").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyValueTransformations` to be an" + + " array in the JSON string but got `%s`", + jsonObj.get("propertyValueTransformations").toString())); + } + + // validate the optional field `propertyValueTransformations` (array) + for (int i = 0; i < jsonArraypropertyValueTransformations.size(); i++) { + PropertyValueTransformationV1.validateJsonElement( + jsonArraypropertyValueTransformations.get(i)); + } + ; + } + } + if (jsonObj.get("fqlDefinedProperties") != null + && !jsonObj.get("fqlDefinedProperties").isJsonNull()) { + JsonArray jsonArrayfqlDefinedProperties = + jsonObj.getAsJsonArray("fqlDefinedProperties"); + if (jsonArrayfqlDefinedProperties != null) { + // ensure the json data is an array + if (!jsonObj.get("fqlDefinedProperties").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fqlDefinedProperties` to be an array in" + + " the JSON string but got `%s`", + jsonObj.get("fqlDefinedProperties").toString())); + } + + // validate the optional field `fqlDefinedProperties` (array) + for (int i = 0; i < jsonArrayfqlDefinedProperties.size(); i++) { + FQLDefinedPropertyV1.validateJsonElement(jsonArrayfqlDefinedProperties.get(i)); + } + ; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("allowProperties") != null + && !jsonObj.get("allowProperties").isJsonNull() + && !jsonObj.get("allowProperties").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `allowProperties` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("allowProperties").toString())); + } + // validate the optional field `hashPropertiesConfiguration` + if (jsonObj.get("hashPropertiesConfiguration") != null + && !jsonObj.get("hashPropertiesConfiguration").isJsonNull()) { + HashPropertiesConfiguration.validateJsonElement( + jsonObj.get("hashPropertiesConfiguration")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TransformationV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TransformationV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(TransformationV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, TransformationV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TransformationV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of TransformationV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransformationV1 + * @throws IOException if the JSON string is invalid with respect to TransformationV1 + */ + public static TransformationV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TransformationV1.class); + } + + /** + * Convert an instance of TransformationV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateActivationForAudience200Response.java b/src/main/java/com/segment/publicapi/models/UpdateActivationForAudience200Response.java new file mode 100644 index 00000000..c6946d4e --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateActivationForAudience200Response.java @@ -0,0 +1,203 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** UpdateActivationForAudience200Response */ +public class UpdateActivationForAudience200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateActivationForAudienceOutput data; + + public UpdateActivationForAudience200Response() {} + + public UpdateActivationForAudience200Response data(UpdateActivationForAudienceOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateActivationForAudienceOutput getData() { + return data; + } + + public void setData(UpdateActivationForAudienceOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateActivationForAudience200Response updateActivationForAudience200Response = + (UpdateActivationForAudience200Response) o; + return Objects.equals(this.data, updateActivationForAudience200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateActivationForAudience200Response {\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 + * UpdateActivationForAudience200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateActivationForAudience200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateActivationForAudience200Response" + + " is not found in the empty JSON string", + UpdateActivationForAudience200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateActivationForAudience200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateActivationForAudience200Response` 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()) { + UpdateActivationForAudienceOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateActivationForAudience200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateActivationForAudience200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateActivationForAudience200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateActivationForAudience200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateActivationForAudience200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateActivationForAudience200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateActivationForAudience200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateActivationForAudience200Response + */ + public static UpdateActivationForAudience200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateActivationForAudience200Response.class); + } + + /** + * Convert an instance of UpdateActivationForAudience200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateActivationForAudienceAlphaInput.java b/src/main/java/com/segment/publicapi/models/UpdateActivationForAudienceAlphaInput.java new file mode 100644 index 00000000..5d76d41c --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateActivationForAudienceAlphaInput.java @@ -0,0 +1,305 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Input to update an activation. */ +public class UpdateActivationForAudienceAlphaInput { + public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; + + @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) + private String workspaceId; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_EVENT_EMITTER = "eventEmitter"; + + @SerializedName(SERIALIZED_NAME_EVENT_EMITTER) + private Object eventEmitter = null; + + public static final String SERIALIZED_NAME_SUBSCRIPTION = "subscription"; + + @SerializedName(SERIALIZED_NAME_SUBSCRIPTION) + private Object subscription = null; + + public UpdateActivationForAudienceAlphaInput() {} + + public UpdateActivationForAudienceAlphaInput workspaceId(String workspaceId) { + + this.workspaceId = workspaceId; + return this; + } + + /** + * The Workspace id. + * + * @return workspaceId + */ + @javax.annotation.Nonnull + public String getWorkspaceId() { + return workspaceId; + } + + public void setWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + } + + public UpdateActivationForAudienceAlphaInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Determines whether an activation is enabled. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public UpdateActivationForAudienceAlphaInput eventEmitter(Object eventEmitter) { + + this.eventEmitter = eventEmitter; + return this; + } + + /** + * Configuration settings for the event emitter to be created. + * + * @return eventEmitter + */ + @javax.annotation.Nullable + public Object getEventEmitter() { + return eventEmitter; + } + + public void setEventEmitter(Object eventEmitter) { + this.eventEmitter = eventEmitter; + } + + public UpdateActivationForAudienceAlphaInput subscription(Object subscription) { + + this.subscription = subscription; + return this; + } + + /** + * Subscription info to connect the event emitter to a Destination attached to the audience. + * + * @return subscription + */ + @javax.annotation.Nullable + public Object getSubscription() { + return subscription; + } + + public void setSubscription(Object subscription) { + this.subscription = subscription; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateActivationForAudienceAlphaInput updateActivationForAudienceAlphaInput = + (UpdateActivationForAudienceAlphaInput) o; + return Objects.equals(this.workspaceId, updateActivationForAudienceAlphaInput.workspaceId) + && Objects.equals(this.enabled, updateActivationForAudienceAlphaInput.enabled) + && Objects.equals( + this.eventEmitter, updateActivationForAudienceAlphaInput.eventEmitter) + && Objects.equals( + this.subscription, updateActivationForAudienceAlphaInput.subscription); + } + + @Override + public int hashCode() { + return Objects.hash(workspaceId, enabled, eventEmitter, subscription); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateActivationForAudienceAlphaInput {\n"); + sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" eventEmitter: ").append(toIndentedString(eventEmitter)).append("\n"); + sb.append(" subscription: ").append(toIndentedString(subscription)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("workspaceId"); + openapiFields.add("enabled"); + openapiFields.add("eventEmitter"); + openapiFields.add("subscription"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("workspaceId"); + openapiRequiredFields.add("eventEmitter"); + openapiRequiredFields.add("subscription"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateActivationForAudienceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateActivationForAudienceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateActivationForAudienceAlphaInput" + + " is not found in the empty JSON string", + UpdateActivationForAudienceAlphaInput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateActivationForAudienceAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateActivationForAudienceAlphaInput` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateActivationForAudienceAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("workspaceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `workspaceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("workspaceId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateActivationForAudienceAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateActivationForAudienceAlphaInput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateActivationForAudienceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateActivationForAudienceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateActivationForAudienceAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateActivationForAudienceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateActivationForAudienceAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * UpdateActivationForAudienceAlphaInput + */ + public static UpdateActivationForAudienceAlphaInput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateActivationForAudienceAlphaInput.class); + } + + /** + * Convert an instance of UpdateActivationForAudienceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateActivationForAudienceOutput.java b/src/main/java/com/segment/publicapi/models/UpdateActivationForAudienceOutput.java new file mode 100644 index 00000000..e132a392 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateActivationForAudienceOutput.java @@ -0,0 +1,209 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output for updating an activation for audience. */ +public class UpdateActivationForAudienceOutput { + public static final String SERIALIZED_NAME_ACTIVATION = "activation"; + + @SerializedName(SERIALIZED_NAME_ACTIVATION) + private ActivationSummaryOutput activation; + + public UpdateActivationForAudienceOutput() {} + + public UpdateActivationForAudienceOutput activation(ActivationSummaryOutput activation) { + + this.activation = activation; + return this; + } + + /** + * Get activation + * + * @return activation + */ + @javax.annotation.Nonnull + public ActivationSummaryOutput getActivation() { + return activation; + } + + public void setActivation(ActivationSummaryOutput activation) { + this.activation = activation; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateActivationForAudienceOutput updateActivationForAudienceOutput = + (UpdateActivationForAudienceOutput) o; + return Objects.equals(this.activation, updateActivationForAudienceOutput.activation); + } + + @Override + public int hashCode() { + return Objects.hash(activation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateActivationForAudienceOutput {\n"); + sb.append(" activation: ").append(toIndentedString(activation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("activation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("activation"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateActivationForAudienceOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateActivationForAudienceOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateActivationForAudienceOutput is" + + " not found in the empty JSON string", + UpdateActivationForAudienceOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateActivationForAudienceOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateActivationForAudienceOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateActivationForAudienceOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `activation` + ActivationSummaryOutput.validateJsonElement(jsonObj.get("activation")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateActivationForAudienceOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateActivationForAudienceOutput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateActivationForAudienceOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateActivationForAudienceOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateActivationForAudienceOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateActivationForAudienceOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateActivationForAudienceOutput + * @throws IOException if the JSON string is invalid with respect to + * UpdateActivationForAudienceOutput + */ + public static UpdateActivationForAudienceOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateActivationForAudienceOutput.class); + } + + /** + * Convert an instance of UpdateActivationForAudienceOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpace200Response.java b/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpace200Response.java new file mode 100644 index 00000000..c6b0d2de --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpace200Response.java @@ -0,0 +1,200 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** UpdateAudienceForSpace200Response */ +public class UpdateAudienceForSpace200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateAudienceForSpaceAlphaOutput data; + + public UpdateAudienceForSpace200Response() {} + + public UpdateAudienceForSpace200Response data(UpdateAudienceForSpaceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateAudienceForSpaceAlphaOutput getData() { + return data; + } + + public void setData(UpdateAudienceForSpaceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateAudienceForSpace200Response updateAudienceForSpace200Response = + (UpdateAudienceForSpace200Response) o; + return Objects.equals(this.data, updateAudienceForSpace200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateAudienceForSpace200Response {\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 + * UpdateAudienceForSpace200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAudienceForSpace200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateAudienceForSpace200Response is" + + " not found in the empty JSON string", + UpdateAudienceForSpace200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateAudienceForSpace200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateAudienceForSpace200Response` 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()) { + UpdateAudienceForSpaceAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAudienceForSpace200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAudienceForSpace200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateAudienceForSpace200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAudienceForSpace200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateAudienceForSpace200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateAudienceForSpace200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAudienceForSpace200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateAudienceForSpace200Response + */ + public static UpdateAudienceForSpace200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAudienceForSpace200Response.class); + } + + /** + * Convert an instance of UpdateAudienceForSpace200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpaceAlphaInput.java b/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpaceAlphaInput.java new file mode 100644 index 00000000..e4e822e2 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpaceAlphaInput.java @@ -0,0 +1,299 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Input to update an audience. */ +public class UpdateAudienceForSpaceAlphaInput { + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + + @SerializedName(SERIALIZED_NAME_DEFINITION) + private AudienceDefinition definition; + + public UpdateAudienceForSpaceAlphaInput() {} + + public UpdateAudienceForSpaceAlphaInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Enabled/disabled status for the audience. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public UpdateAudienceForSpaceAlphaInput name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the computation. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UpdateAudienceForSpaceAlphaInput description(String description) { + + this.description = description; + return this; + } + + /** + * The description of the computation. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public UpdateAudienceForSpaceAlphaInput definition(AudienceDefinition definition) { + + this.definition = definition; + return this; + } + + /** + * Get definition + * + * @return definition + */ + @javax.annotation.Nullable + public AudienceDefinition getDefinition() { + return definition; + } + + public void setDefinition(AudienceDefinition definition) { + this.definition = definition; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateAudienceForSpaceAlphaInput updateAudienceForSpaceAlphaInput = + (UpdateAudienceForSpaceAlphaInput) o; + return Objects.equals(this.enabled, updateAudienceForSpaceAlphaInput.enabled) + && Objects.equals(this.name, updateAudienceForSpaceAlphaInput.name) + && Objects.equals(this.description, updateAudienceForSpaceAlphaInput.description) + && Objects.equals(this.definition, updateAudienceForSpaceAlphaInput.definition); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, name, description, definition); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateAudienceForSpaceAlphaInput {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("enabled"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("definition"); + + // 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 + * UpdateAudienceForSpaceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAudienceForSpaceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateAudienceForSpaceAlphaInput is" + + " not found in the empty JSON string", + UpdateAudienceForSpaceAlphaInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateAudienceForSpaceAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateAudienceForSpaceAlphaInput` 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())); + } + 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())); + } + // validate the optional field `definition` + if (jsonObj.get("definition") != null && !jsonObj.get("definition").isJsonNull()) { + AudienceDefinition.validateJsonElement(jsonObj.get("definition")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAudienceForSpaceAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAudienceForSpaceAlphaInput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateAudienceForSpaceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAudienceForSpaceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateAudienceForSpaceAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateAudienceForSpaceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAudienceForSpaceAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * UpdateAudienceForSpaceAlphaInput + */ + public static UpdateAudienceForSpaceAlphaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAudienceForSpaceAlphaInput.class); + } + + /** + * Convert an instance of UpdateAudienceForSpaceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpaceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpaceAlphaOutput.java new file mode 100644 index 00000000..8f194ea3 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateAudienceForSpaceAlphaOutput.java @@ -0,0 +1,209 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Audience output for update. */ +public class UpdateAudienceForSpaceAlphaOutput { + public static final String SERIALIZED_NAME_AUDIENCE = "audience"; + + @SerializedName(SERIALIZED_NAME_AUDIENCE) + private AudienceSummary audience; + + public UpdateAudienceForSpaceAlphaOutput() {} + + public UpdateAudienceForSpaceAlphaOutput audience(AudienceSummary audience) { + + this.audience = audience; + return this; + } + + /** + * Get audience + * + * @return audience + */ + @javax.annotation.Nonnull + public AudienceSummary getAudience() { + return audience; + } + + public void setAudience(AudienceSummary audience) { + this.audience = audience; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateAudienceForSpaceAlphaOutput updateAudienceForSpaceAlphaOutput = + (UpdateAudienceForSpaceAlphaOutput) o; + return Objects.equals(this.audience, updateAudienceForSpaceAlphaOutput.audience); + } + + @Override + public int hashCode() { + return Objects.hash(audience); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateAudienceForSpaceAlphaOutput {\n"); + sb.append(" audience: ").append(toIndentedString(audience)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("audience"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("audience"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateAudienceForSpaceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAudienceForSpaceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateAudienceForSpaceAlphaOutput is" + + " not found in the empty JSON string", + UpdateAudienceForSpaceAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateAudienceForSpaceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateAudienceForSpaceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateAudienceForSpaceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `audience` + AudienceSummary.validateJsonElement(jsonObj.get("audience")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAudienceForSpaceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAudienceForSpaceAlphaOutput' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateAudienceForSpaceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAudienceForSpaceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateAudienceForSpaceAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateAudienceForSpaceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAudienceForSpaceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * UpdateAudienceForSpaceAlphaOutput + */ + public static UpdateAudienceForSpaceAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAudienceForSpaceAlphaOutput.class); + } + + /** + * Convert an instance of UpdateAudienceForSpaceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateComputedTraitForSpace200Response.java b/src/main/java/com/segment/publicapi/models/UpdateComputedTraitForSpace200Response.java new file mode 100644 index 00000000..fb5185d2 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateComputedTraitForSpace200Response.java @@ -0,0 +1,204 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** UpdateComputedTraitForSpace200Response */ +public class UpdateComputedTraitForSpace200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateComputedTraitForSpaceAlphaOutput data; + + public UpdateComputedTraitForSpace200Response() {} + + public UpdateComputedTraitForSpace200Response data( + UpdateComputedTraitForSpaceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateComputedTraitForSpaceAlphaOutput getData() { + return data; + } + + public void setData(UpdateComputedTraitForSpaceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateComputedTraitForSpace200Response updateComputedTraitForSpace200Response = + (UpdateComputedTraitForSpace200Response) o; + return Objects.equals(this.data, updateComputedTraitForSpace200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateComputedTraitForSpace200Response {\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 + * UpdateComputedTraitForSpace200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateComputedTraitForSpace200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateComputedTraitForSpace200Response" + + " is not found in the empty JSON string", + UpdateComputedTraitForSpace200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateComputedTraitForSpace200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateComputedTraitForSpace200Response` 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()) { + UpdateComputedTraitForSpaceAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateComputedTraitForSpace200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateComputedTraitForSpace200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateComputedTraitForSpace200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateComputedTraitForSpace200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateComputedTraitForSpace200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateComputedTraitForSpace200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateComputedTraitForSpace200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateComputedTraitForSpace200Response + */ + public static UpdateComputedTraitForSpace200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateComputedTraitForSpace200Response.class); + } + + /** + * Convert an instance of UpdateComputedTraitForSpace200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateComputedTraitForSpaceAlphaInput.java b/src/main/java/com/segment/publicapi/models/UpdateComputedTraitForSpaceAlphaInput.java new file mode 100644 index 00000000..6b9ee176 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateComputedTraitForSpaceAlphaInput.java @@ -0,0 +1,305 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Input to update a computed trait. */ +public class UpdateComputedTraitForSpaceAlphaInput { + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + + @SerializedName(SERIALIZED_NAME_DEFINITION) + private TraitDefinition definition; + + public UpdateComputedTraitForSpaceAlphaInput() {} + + public UpdateComputedTraitForSpaceAlphaInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Enabled/disabled status for the computed trait. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public UpdateComputedTraitForSpaceAlphaInput name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the computation. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UpdateComputedTraitForSpaceAlphaInput description(String description) { + + this.description = description; + return this; + } + + /** + * The description of the computation. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public UpdateComputedTraitForSpaceAlphaInput definition(TraitDefinition definition) { + + this.definition = definition; + return this; + } + + /** + * Get definition + * + * @return definition + */ + @javax.annotation.Nullable + public TraitDefinition getDefinition() { + return definition; + } + + public void setDefinition(TraitDefinition definition) { + this.definition = definition; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateComputedTraitForSpaceAlphaInput updateComputedTraitForSpaceAlphaInput = + (UpdateComputedTraitForSpaceAlphaInput) o; + return Objects.equals(this.enabled, updateComputedTraitForSpaceAlphaInput.enabled) + && Objects.equals(this.name, updateComputedTraitForSpaceAlphaInput.name) + && Objects.equals( + this.description, updateComputedTraitForSpaceAlphaInput.description) + && Objects.equals( + this.definition, updateComputedTraitForSpaceAlphaInput.definition); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, name, description, definition); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateComputedTraitForSpaceAlphaInput {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("enabled"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("definition"); + + // 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 + * UpdateComputedTraitForSpaceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateComputedTraitForSpaceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateComputedTraitForSpaceAlphaInput" + + " is not found in the empty JSON string", + UpdateComputedTraitForSpaceAlphaInput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateComputedTraitForSpaceAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateComputedTraitForSpaceAlphaInput` 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())); + } + 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())); + } + // validate the optional field `definition` + if (jsonObj.get("definition") != null && !jsonObj.get("definition").isJsonNull()) { + TraitDefinition.validateJsonElement(jsonObj.get("definition")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateComputedTraitForSpaceAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateComputedTraitForSpaceAlphaInput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateComputedTraitForSpaceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateComputedTraitForSpaceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateComputedTraitForSpaceAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateComputedTraitForSpaceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateComputedTraitForSpaceAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * UpdateComputedTraitForSpaceAlphaInput + */ + public static UpdateComputedTraitForSpaceAlphaInput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateComputedTraitForSpaceAlphaInput.class); + } + + /** + * Convert an instance of UpdateComputedTraitForSpaceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateComputedTraitForSpaceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/UpdateComputedTraitForSpaceAlphaOutput.java new file mode 100644 index 00000000..c276cb5f --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateComputedTraitForSpaceAlphaOutput.java @@ -0,0 +1,214 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Computed Trait output for get and update. */ +public class UpdateComputedTraitForSpaceAlphaOutput { + public static final String SERIALIZED_NAME_COMPUTED_TRAIT = "computedTrait"; + + @SerializedName(SERIALIZED_NAME_COMPUTED_TRAIT) + private ComputedTraitSummary computedTrait; + + public UpdateComputedTraitForSpaceAlphaOutput() {} + + public UpdateComputedTraitForSpaceAlphaOutput computedTrait( + ComputedTraitSummary computedTrait) { + + this.computedTrait = computedTrait; + return this; + } + + /** + * Get computedTrait + * + * @return computedTrait + */ + @javax.annotation.Nonnull + public ComputedTraitSummary getComputedTrait() { + return computedTrait; + } + + public void setComputedTrait(ComputedTraitSummary computedTrait) { + this.computedTrait = computedTrait; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateComputedTraitForSpaceAlphaOutput updateComputedTraitForSpaceAlphaOutput = + (UpdateComputedTraitForSpaceAlphaOutput) o; + return Objects.equals( + this.computedTrait, updateComputedTraitForSpaceAlphaOutput.computedTrait); + } + + @Override + public int hashCode() { + return Objects.hash(computedTrait); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateComputedTraitForSpaceAlphaOutput {\n"); + sb.append(" computedTrait: ").append(toIndentedString(computedTrait)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("computedTrait"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("computedTrait"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateComputedTraitForSpaceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateComputedTraitForSpaceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateComputedTraitForSpaceAlphaOutput" + + " is not found in the empty JSON string", + UpdateComputedTraitForSpaceAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateComputedTraitForSpaceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateComputedTraitForSpaceAlphaOutput` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateComputedTraitForSpaceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `computedTrait` + ComputedTraitSummary.validateJsonElement(jsonObj.get("computedTrait")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateComputedTraitForSpaceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateComputedTraitForSpaceAlphaOutput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateComputedTraitForSpaceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateComputedTraitForSpaceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateComputedTraitForSpaceAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateComputedTraitForSpaceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateComputedTraitForSpaceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * UpdateComputedTraitForSpaceAlphaOutput + */ + public static UpdateComputedTraitForSpaceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateComputedTraitForSpaceAlphaOutput.class); + } + + /** + * Convert an instance of UpdateComputedTraitForSpaceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateDestination200Response.java b/src/main/java/com/segment/publicapi/models/UpdateDestination200Response.java index e286c87e..db0f0dfe 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateDestination200Response.java +++ b/src/main/java/com/segment/publicapi/models/UpdateDestination200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,190 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateDestinationV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateDestination200Response - */ - +/** UpdateDestination200Response */ public class UpdateDestination200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateDestinationV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateDestination200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateDestinationV1Output data; - public UpdateDestination200Response data(UpdateDestinationV1Output data) { - - this.data = data; - return this; - } + public UpdateDestination200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateDestination200Response data(UpdateDestinationV1Output data) { - public UpdateDestinationV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateDestinationV1Output getData() { + return data; + } - public void setData(UpdateDestinationV1Output data) { - this.data = data; - } + public void setData(UpdateDestinationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateDestination200Response updateDestination200Response = + (UpdateDestination200Response) o; + return Objects.equals(this.data, updateDestination200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateDestination200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateDestination200Response updateDestination200Response = (UpdateDestination200Response) o; - return Objects.equals(this.data, updateDestination200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateDestination200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateDestination200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateDestination200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateDestination200Response is not found in the empty JSON string", UpdateDestination200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateDestination200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateDestination200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateDestination200Response is not" + + " found in the empty JSON string", + UpdateDestination200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateDestination200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateDestination200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateDestination200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateDestination200Response` 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()) { + UpdateDestinationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateDestination200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateDestination200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateDestination200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateDestination200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateDestination200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateDestination200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateDestination200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateDestination200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateDestination200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateDestination200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateDestination200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateDestination200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateDestination200Response + */ + public static UpdateDestination200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateDestination200Response.class); } - } - - /** - * Create an instance of UpdateDestination200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateDestination200Response - * @throws IOException if the JSON string is invalid with respect to UpdateDestination200Response - */ - public static UpdateDestination200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateDestination200Response.class); - } - - /** - * Convert an instance of UpdateDestination200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateDestination200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateDestinationV1Input.java b/src/main/java/com/segment/publicapi/models/UpdateDestinationV1Input.java index e26cca07..4463a95c 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateDestinationV1Input.java +++ b/src/main/java/com/segment/publicapi/models/UpdateDestinationV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,282 +9,276 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Objects; +import java.util.Set; 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; +/** Updates a single Destination by its id. */ +public class UpdateDestinationV1Input { + public static final String SERIALIZED_NAME_NAME = "name"; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; -import com.segment.publicapi.JSON; + public static final String SERIALIZED_NAME_ENABLED = "enabled"; -/** - * Updates a single Destination by its id. - */ -@ApiModel(description = "Updates a single Destination by its id.") + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; -public class UpdateDestinationV1Input { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings = new HashMap<>(); - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings = null; + public UpdateDestinationV1Input() {} - public UpdateDestinationV1Input() { - } + public UpdateDestinationV1Input name(String name) { - public UpdateDestinationV1Input name(String name) { - - this.name = name; - return this; - } + this.name = name; + return this; + } - /** - * Defines the display name of the Destination. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Defines the display name of the Destination. Config API note: equal to `displayName`.") + /** + * Defines the display name of the Destination. Config API note: equal to + * `displayName`. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - public String getName() { - return name; - } + public void setName(String name) { + this.name = name; + } + public UpdateDestinationV1Input enabled(Boolean enabled) { - public void setName(String name) { - this.name = name; - } + this.enabled = enabled; + return this; + } + /** + * Whether this Destination should receive data. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } - public UpdateDestinationV1Input enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - /** - * Whether this Destination should receive data. - * @return enabled - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this Destination should receive data.") + public UpdateDestinationV1Input settings(Map settings) { - public Boolean getEnabled() { - return enabled; - } + this.settings = settings; + return this; + } + public UpdateDestinationV1Input putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + /** + * An optional object that contains settings for the Destination based on the + * \"required\" and \"advanced\" settings present in the Destination + * metadata. Config API note: equal to `config`. + * + * @return settings + */ + @javax.annotation.Nullable + public Map getSettings() { + return settings; + } + public void setSettings(Map settings) { + this.settings = settings; + } - public UpdateDestinationV1Input settings(Map settings) { - - this.settings = settings; - return this; - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateDestinationV1Input updateDestinationV1Input = (UpdateDestinationV1Input) o; + return Objects.equals(this.name, updateDestinationV1Input.name) + && Objects.equals(this.enabled, updateDestinationV1Input.enabled) + && Objects.equals(this.settings, updateDestinationV1Input.settings); + } - public UpdateDestinationV1Input putSettingsItem(String key, Object settingsItem) { - if (this.settings == null) { - this.settings = new HashMap<>(); + 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())); } - this.settings.put(key, settingsItem); - return this; - } - /** - * An optional object that contains settings for the Destination based on the \"required\" and \"advanced\" settings present in the Destination metadata. Config API note: equal to `config`. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An optional object that contains settings for the Destination based on the \"required\" and \"advanced\" settings present in the Destination metadata. Config API note: equal to `config`.") + @Override + public int hashCode() { + return Objects.hash(name, enabled, settings); + } - public Map getSettings() { - return settings; - } + 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 UpdateDestinationV1Input {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public void setSettings(Map settings) { - this.settings = settings; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("enabled"); + openapiFields.add("settings"); - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateDestinationV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateDestinationV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateDestinationV1Input is not found" + + " in the empty JSON string", + UpdateDestinationV1Input.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateDestinationV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateDestinationV1Input` 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())); + } } - UpdateDestinationV1Input updateDestinationV1Input = (UpdateDestinationV1Input) o; - return Objects.equals(this.name, updateDestinationV1Input.name) && - Objects.equals(this.enabled, updateDestinationV1Input.enabled) && - Objects.equals(this.settings, updateDestinationV1Input.settings); - } - - 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(name, enabled, settings); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateDestinationV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateDestinationV1Input' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateDestinationV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateDestinationV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateDestinationV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateDestinationV1Input {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + /** + * Create an instance of UpdateDestinationV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateDestinationV1Input + * @throws IOException if the JSON string is invalid with respect to UpdateDestinationV1Input + */ + public static UpdateDestinationV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateDestinationV1Input.class); } - return o.toString().replace("\n", "\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("enabled"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateDestinationV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateDestinationV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateDestinationV1Input is not found in the empty JSON string", UpdateDestinationV1Input.openapiRequiredFields.toString())); - } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateDestinationV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateDestinationV1Input` properties. JSON: %s", entry.getKey(), jsonObj.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 (!UpdateDestinationV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateDestinationV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateDestinationV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateDestinationV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateDestinationV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + /** + * Convert an instance of UpdateDestinationV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); } - } - - /** - * Create an instance of UpdateDestinationV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateDestinationV1Input - * @throws IOException if the JSON string is invalid with respect to UpdateDestinationV1Input - */ - public static UpdateDestinationV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateDestinationV1Input.class); - } - - /** - * Convert an instance of UpdateDestinationV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } } - diff --git a/src/main/java/com/segment/publicapi/models/UpdateDestinationV1Output.java b/src/main/java/com/segment/publicapi/models/UpdateDestinationV1Output.java index 9bc7514b..7e057514 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateDestinationV1Output.java +++ b/src/main/java/com/segment/publicapi/models/UpdateDestinationV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Destination1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the updated Destination. - */ -@ApiModel(description = "Returns the updated Destination.") - +/** Returns the updated Destination. */ public class UpdateDestinationV1Output { - public static final String SERIALIZED_NAME_DESTINATION = "destination"; - @SerializedName(SERIALIZED_NAME_DESTINATION) - private Destination1 destination; + public static final String SERIALIZED_NAME_DESTINATION = "destination"; - public UpdateDestinationV1Output() { - } + @SerializedName(SERIALIZED_NAME_DESTINATION) + private DestinationV1 destination; - public UpdateDestinationV1Output destination(Destination1 destination) { - - this.destination = destination; - return this; - } + public UpdateDestinationV1Output() {} - /** - * Get destination - * @return destination - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public UpdateDestinationV1Output destination(DestinationV1 destination) { - public Destination1 getDestination() { - return destination; - } + this.destination = destination; + return this; + } + /** + * Get destination + * + * @return destination + */ + @javax.annotation.Nonnull + public DestinationV1 getDestination() { + return destination; + } - public void setDestination(Destination1 destination) { - this.destination = destination; - } + public void setDestination(DestinationV1 destination) { + this.destination = destination; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateDestinationV1Output updateDestinationV1Output = (UpdateDestinationV1Output) o; + return Objects.equals(this.destination, updateDestinationV1Output.destination); + } + @Override + public int hashCode() { + return Objects.hash(destination); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateDestinationV1Output {\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateDestinationV1Output updateDestinationV1Output = (UpdateDestinationV1Output) o; - return Objects.equals(this.destination, updateDestinationV1Output.destination); - } - - @Override - public int hashCode() { - return Objects.hash(destination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateDestinationV1Output {\n"); - sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("destination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("destination"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("destination"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("destination"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateDestinationV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateDestinationV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateDestinationV1Output is not found in the empty JSON string", UpdateDestinationV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateDestinationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateDestinationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateDestinationV1Output is not found" + + " in the empty JSON string", + UpdateDestinationV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateDestinationV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateDestinationV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateDestinationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateDestinationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateDestinationV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateDestinationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `destination` + DestinationV1.validateJsonElement(jsonObj.get("destination")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateDestinationV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateDestinationV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateDestinationV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateDestinationV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateDestinationV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateDestinationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateDestinationV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateDestinationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateDestinationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateDestinationV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateDestinationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateDestinationV1Output + * @throws IOException if the JSON string is invalid with respect to UpdateDestinationV1Output + */ + public static UpdateDestinationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateDestinationV1Output.class); } - } - - /** - * Create an instance of UpdateDestinationV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateDestinationV1Output - * @throws IOException if the JSON string is invalid with respect to UpdateDestinationV1Output - */ - public static UpdateDestinationV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateDestinationV1Output.class); - } - - /** - * Convert an instance of UpdateDestinationV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateDestinationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateFilterById200Response.java b/src/main/java/com/segment/publicapi/models/UpdateFilterById200Response.java new file mode 100644 index 00000000..a03bf7ca --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateFilterById200Response.java @@ -0,0 +1,195 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** UpdateFilterById200Response */ +public class UpdateFilterById200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateFilterByIdOutput data; + + public UpdateFilterById200Response() {} + + public UpdateFilterById200Response data(UpdateFilterByIdOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateFilterByIdOutput getData() { + return data; + } + + public void setData(UpdateFilterByIdOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFilterById200Response updateFilterById200Response = (UpdateFilterById200Response) o; + return Objects.equals(this.data, updateFilterById200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFilterById200Response {\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 + * UpdateFilterById200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFilterById200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateFilterById200Response is not" + + " found in the empty JSON string", + UpdateFilterById200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFilterById200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateFilterById200Response` 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()) { + UpdateFilterByIdOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFilterById200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFilterById200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateFilterById200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFilterById200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFilterById200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateFilterById200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFilterById200Response + * @throws IOException if the JSON string is invalid with respect to UpdateFilterById200Response + */ + public static UpdateFilterById200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFilterById200Response.class); + } + + /** + * Convert an instance of UpdateFilterById200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateFilterByIdInput.java b/src/main/java/com/segment/publicapi/models/UpdateFilterByIdInput.java new file mode 100644 index 00000000..bb1cced4 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateFilterByIdInput.java @@ -0,0 +1,371 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Input for UpdateFilterById. */ +public class UpdateFilterByIdInput { + public static final String SERIALIZED_NAME_INTEGRATION_ID = "integrationId"; + + @SerializedName(SERIALIZED_NAME_INTEGRATION_ID) + private String integrationId; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_IF = "if"; + + @SerializedName(SERIALIZED_NAME_IF) + private String _if; + + public static final String SERIALIZED_NAME_DROP = "drop"; + + @SerializedName(SERIALIZED_NAME_DROP) + private Boolean drop; + + public UpdateFilterByIdInput() {} + + public UpdateFilterByIdInput integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The Integration id of the resource. + * + * @return integrationId + */ + @javax.annotation.Nonnull + public String getIntegrationId() { + return integrationId; + } + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + public UpdateFilterByIdInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Whether the filter is enabled. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public UpdateFilterByIdInput name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the filter. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UpdateFilterByIdInput description(String description) { + + this.description = description; + return this; + } + + /** + * The description of the filter. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public UpdateFilterByIdInput _if(String _if) { + + this._if = _if; + return this; + } + + /** + * The \"if\" statement for a filter. + * + * @return _if + */ + @javax.annotation.Nullable + public String getIf() { + return _if; + } + + public void setIf(String _if) { + this._if = _if; + } + + public UpdateFilterByIdInput drop(Boolean drop) { + + this.drop = drop; + return this; + } + + /** + * Whether the event is dropped. + * + * @return drop + */ + @javax.annotation.Nullable + public Boolean getDrop() { + return drop; + } + + public void setDrop(Boolean drop) { + this.drop = drop; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFilterByIdInput updateFilterByIdInput = (UpdateFilterByIdInput) o; + return Objects.equals(this.integrationId, updateFilterByIdInput.integrationId) + && Objects.equals(this.enabled, updateFilterByIdInput.enabled) + && Objects.equals(this.name, updateFilterByIdInput.name) + && Objects.equals(this.description, updateFilterByIdInput.description) + && Objects.equals(this._if, updateFilterByIdInput._if) + && Objects.equals(this.drop, updateFilterByIdInput.drop); + } + + @Override + public int hashCode() { + return Objects.hash(integrationId, enabled, name, description, _if, drop); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFilterByIdInput {\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" drop: ").append(toIndentedString(drop)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("integrationId"); + openapiFields.add("enabled"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("if"); + openapiFields.add("drop"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("integrationId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateFilterByIdInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFilterByIdInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateFilterByIdInput is not found in" + + " the empty JSON string", + UpdateFilterByIdInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFilterByIdInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateFilterByIdInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateFilterByIdInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("integrationId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `integrationId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("integrationId").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("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("if") != null && !jsonObj.get("if").isJsonNull()) + && !jsonObj.get("if").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `if` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("if").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFilterByIdInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFilterByIdInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateFilterByIdInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFilterByIdInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFilterByIdInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateFilterByIdInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFilterByIdInput + * @throws IOException if the JSON string is invalid with respect to UpdateFilterByIdInput + */ + public static UpdateFilterByIdInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFilterByIdInput.class); + } + + /** + * Convert an instance of UpdateFilterByIdInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateFilterByIdOutput.java b/src/main/java/com/segment/publicapi/models/UpdateFilterByIdOutput.java new file mode 100644 index 00000000..1edaca75 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateFilterByIdOutput.java @@ -0,0 +1,202 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Output for UpdateFilterById. */ +public class UpdateFilterByIdOutput { + public static final String SERIALIZED_NAME_FILTER = "filter"; + + @SerializedName(SERIALIZED_NAME_FILTER) + private Filter filter; + + public UpdateFilterByIdOutput() {} + + public UpdateFilterByIdOutput filter(Filter filter) { + + this.filter = filter; + return this; + } + + /** + * Get filter + * + * @return filter + */ + @javax.annotation.Nonnull + public Filter getFilter() { + return filter; + } + + public void setFilter(Filter filter) { + this.filter = filter; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFilterByIdOutput updateFilterByIdOutput = (UpdateFilterByIdOutput) o; + return Objects.equals(this.filter, updateFilterByIdOutput.filter); + } + + @Override + public int hashCode() { + return Objects.hash(filter); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFilterByIdOutput {\n"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("filter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("filter"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateFilterByIdOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFilterByIdOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateFilterByIdOutput is not found in" + + " the empty JSON string", + UpdateFilterByIdOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFilterByIdOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateFilterByIdOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateFilterByIdOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `filter` + Filter.validateJsonElement(jsonObj.get("filter")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFilterByIdOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFilterByIdOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateFilterByIdOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFilterByIdOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFilterByIdOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateFilterByIdOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFilterByIdOutput + * @throws IOException if the JSON string is invalid with respect to UpdateFilterByIdOutput + */ + public static UpdateFilterByIdOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFilterByIdOutput.class); + } + + /** + * Convert an instance of UpdateFilterByIdOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateFilterForDestination200Response.java b/src/main/java/com/segment/publicapi/models/UpdateFilterForDestination200Response.java index ca8a3b38..2b94f5f2 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateFilterForDestination200Response.java +++ b/src/main/java/com/segment/publicapi/models/UpdateFilterForDestination200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateFilterForDestinationV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateFilterForDestination200Response - */ - +/** UpdateFilterForDestination200Response */ public class UpdateFilterForDestination200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateFilterForDestinationV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateFilterForDestination200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateFilterForDestinationV1Output data; - public UpdateFilterForDestination200Response data(UpdateFilterForDestinationV1Output data) { - - this.data = data; - return this; - } + public UpdateFilterForDestination200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateFilterForDestination200Response data(UpdateFilterForDestinationV1Output data) { - public UpdateFilterForDestinationV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateFilterForDestinationV1Output getData() { + return data; + } - public void setData(UpdateFilterForDestinationV1Output data) { - this.data = data; - } + public void setData(UpdateFilterForDestinationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFilterForDestination200Response updateFilterForDestination200Response = + (UpdateFilterForDestination200Response) o; + return Objects.equals(this.data, updateFilterForDestination200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFilterForDestination200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateFilterForDestination200Response updateFilterForDestination200Response = (UpdateFilterForDestination200Response) o; - return Objects.equals(this.data, updateFilterForDestination200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateFilterForDestination200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateFilterForDestination200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateFilterForDestination200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateFilterForDestination200Response is not found in the empty JSON string", UpdateFilterForDestination200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateFilterForDestination200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFilterForDestination200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateFilterForDestination200Response" + + " is not found in the empty JSON string", + UpdateFilterForDestination200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateFilterForDestination200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFilterForDestination200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFilterForDestination200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateFilterForDestination200Response` 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()) { + UpdateFilterForDestinationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateFilterForDestination200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateFilterForDestination200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateFilterForDestination200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateFilterForDestination200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateFilterForDestination200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFilterForDestination200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFilterForDestination200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateFilterForDestination200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateFilterForDestination200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFilterForDestination200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateFilterForDestination200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFilterForDestination200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateFilterForDestination200Response + */ + public static UpdateFilterForDestination200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFilterForDestination200Response.class); } - } - - /** - * Create an instance of UpdateFilterForDestination200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateFilterForDestination200Response - * @throws IOException if the JSON string is invalid with respect to UpdateFilterForDestination200Response - */ - public static UpdateFilterForDestination200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateFilterForDestination200Response.class); - } - - /** - * Convert an instance of UpdateFilterForDestination200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateFilterForDestination200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateFilterForDestinationV1Input.java b/src/main/java/com/segment/publicapi/models/UpdateFilterForDestinationV1Input.java index bfbc5c8a..a47abf86 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateFilterForDestinationV1Input.java +++ b/src/main/java/com/segment/publicapi/models/UpdateFilterForDestinationV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,358 +9,372 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.DestinationFilterActionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; +import org.openapitools.jackson.nullable.JsonNullable; -import com.segment.publicapi.JSON; - -/** - * Input for UpdateDestinationFilterV1. - */ -@ApiModel(description = "Input for UpdateDestinationFilterV1.") - +/** Input for UpdateDestinationFilterV1. */ public class UpdateFilterForDestinationV1Input { - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; - - public static final String SERIALIZED_NAME_ACTIONS = "actions"; - @SerializedName(SERIALIZED_NAME_ACTIONS) - private List actions = null; + public static final String SERIALIZED_NAME_IF = "if"; - public static final String SERIALIZED_NAME_TITLE = "title"; - @SerializedName(SERIALIZED_NAME_TITLE) - private String title; + @SerializedName(SERIALIZED_NAME_IF) + private String _if; - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + public static final String SERIALIZED_NAME_ACTIONS = "actions"; - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + @SerializedName(SERIALIZED_NAME_ACTIONS) + private List actions; - public UpdateFilterForDestinationV1Input() { - } + public static final String SERIALIZED_NAME_TITLE = "title"; - public UpdateFilterForDestinationV1Input _if(String _if) { - - this._if = _if; - return this; - } + @SerializedName(SERIALIZED_NAME_TITLE) + private String title; - /** - * The FQL if condition to update. - * @return _if - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The FQL if condition to update.") + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - public String getIf() { - return _if; - } + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public void setIf(String _if) { - this._if = _if; - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + public UpdateFilterForDestinationV1Input() {} - public UpdateFilterForDestinationV1Input actions(List actions) { - - this.actions = actions; - return this; - } + public UpdateFilterForDestinationV1Input _if(String _if) { - public UpdateFilterForDestinationV1Input addActionsItem(DestinationFilterActionV1 actionsItem) { - if (this.actions == null) { - this.actions = new ArrayList<>(); + this._if = _if; + return this; } - this.actions.add(actionsItem); - return this; - } - - /** - * Actions for this Destination filter. - * @return actions - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Actions for this Destination filter.") - - public List getActions() { - return actions; - } + /** + * The FQL if condition to update. + * + * @return _if + */ + @javax.annotation.Nullable + public String getIf() { + return _if; + } - public void setActions(List actions) { - this.actions = actions; - } + public void setIf(String _if) { + this._if = _if; + } + public UpdateFilterForDestinationV1Input actions(List actions) { - public UpdateFilterForDestinationV1Input title(String title) { - - this.title = title; - return this; - } + this.actions = actions; + return this; + } - /** - * The title to update. - * @return title - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The title to update.") + public UpdateFilterForDestinationV1Input addActionsItem(DestinationFilterActionV1 actionsItem) { + if (this.actions == null) { + this.actions = new ArrayList<>(); + } + this.actions.add(actionsItem); + return this; + } - public String getTitle() { - return title; - } + /** + * Actions for this Destination filter. + * + * @return actions + */ + @javax.annotation.Nullable + public List getActions() { + return actions; + } + public void setActions(List actions) { + this.actions = actions; + } - public void setTitle(String title) { - this.title = title; - } + public UpdateFilterForDestinationV1Input title(String title) { + this.title = title; + return this; + } - public UpdateFilterForDestinationV1Input description(String description) { - - this.description = description; - return this; - } + /** + * The title to update. + * + * @return title + */ + @javax.annotation.Nullable + public String getTitle() { + return title; + } - /** - * The description of this filter. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The description of this filter.") + public void setTitle(String title) { + this.title = title; + } - public String getDescription() { - return description; - } + public UpdateFilterForDestinationV1Input description(String description) { + this.description = description; + return this; + } - public void setDescription(String description) { - this.description = description; - } + /** + * The description of this filter. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } - public UpdateFilterForDestinationV1Input enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public UpdateFilterForDestinationV1Input enabled(Boolean enabled) { - /** - * When set to true, this Destination filter is active. - * @return enabled - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "When set to true, this Destination filter is active.") + this.enabled = enabled; + return this; + } - public Boolean getEnabled() { - return enabled; - } + /** + * When set to true, this Destination filter is active. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input = + (UpdateFilterForDestinationV1Input) o; + return Objects.equals(this._if, updateFilterForDestinationV1Input._if) + && Objects.equals(this.actions, updateFilterForDestinationV1Input.actions) + && Objects.equals(this.title, updateFilterForDestinationV1Input.title) + && Objects.equals(this.description, updateFilterForDestinationV1Input.description) + && Objects.equals(this.enabled, updateFilterForDestinationV1Input.enabled); + } + 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(_if, actions, title, description, enabled); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFilterForDestinationV1Input {\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append("}"); + return sb.toString(); } - UpdateFilterForDestinationV1Input updateFilterForDestinationV1Input = (UpdateFilterForDestinationV1Input) o; - return Objects.equals(this._if, updateFilterForDestinationV1Input._if) && - Objects.equals(this.actions, updateFilterForDestinationV1Input.actions) && - Objects.equals(this.title, updateFilterForDestinationV1Input.title) && - Objects.equals(this.description, updateFilterForDestinationV1Input.description) && - Objects.equals(this.enabled, updateFilterForDestinationV1Input.enabled); - } - - 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(_if, actions, title, description, enabled); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateFilterForDestinationV1Input {\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); - sb.append(" title: ").append(toIndentedString(title)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("if"); + openapiFields.add("actions"); + openapiFields.add("title"); + openapiFields.add("description"); + openapiFields.add("enabled"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("if"); - openapiFields.add("actions"); - openapiFields.add("title"); - openapiFields.add("description"); - openapiFields.add("enabled"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateFilterForDestinationV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateFilterForDestinationV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateFilterForDestinationV1Input is not found in the empty JSON string", UpdateFilterForDestinationV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateFilterForDestinationV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFilterForDestinationV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateFilterForDestinationV1Input is" + + " not found in the empty JSON string", + UpdateFilterForDestinationV1Input.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateFilterForDestinationV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFilterForDestinationV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFilterForDestinationV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateFilterForDestinationV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - if ((jsonObj.get("if") != null && !jsonObj.get("if").isJsonNull()) && !jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - if (jsonObj.get("actions") != null && !jsonObj.get("actions").isJsonNull()) { - JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); - if (jsonArrayactions != null) { - // ensure the json data is an array - if (!jsonObj.get("actions").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `actions` to be an array in the JSON string but got `%s`", jsonObj.get("actions").toString())); - } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("if") != null && !jsonObj.get("if").isJsonNull()) + && !jsonObj.get("if").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `if` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("if").toString())); + } + if (jsonObj.get("actions") != null && !jsonObj.get("actions").isJsonNull()) { + JsonArray jsonArrayactions = jsonObj.getAsJsonArray("actions"); + if (jsonArrayactions != null) { + // ensure the json data is an array + if (!jsonObj.get("actions").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `actions` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("actions").toString())); + } + + // validate the optional field `actions` (array) + for (int i = 0; i < jsonArrayactions.size(); i++) { + DestinationFilterActionV1.validateJsonElement(jsonArrayactions.get(i)); + } + ; + } + } + 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("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 (!UpdateFilterForDestinationV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFilterForDestinationV1Input' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateFilterForDestinationV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFilterForDestinationV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFilterForDestinationV1Input read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("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 (!UpdateFilterForDestinationV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateFilterForDestinationV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateFilterForDestinationV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateFilterForDestinationV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateFilterForDestinationV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of UpdateFilterForDestinationV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateFilterForDestinationV1Input - * @throws IOException if the JSON string is invalid with respect to UpdateFilterForDestinationV1Input - */ - public static UpdateFilterForDestinationV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateFilterForDestinationV1Input.class); - } - - /** - * Convert an instance of UpdateFilterForDestinationV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of UpdateFilterForDestinationV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFilterForDestinationV1Input + * @throws IOException if the JSON string is invalid with respect to + * UpdateFilterForDestinationV1Input + */ + public static UpdateFilterForDestinationV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFilterForDestinationV1Input.class); + } + + /** + * Convert an instance of UpdateFilterForDestinationV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateFilterForDestinationV1Output.java b/src/main/java/com/segment/publicapi/models/UpdateFilterForDestinationV1Output.java index b5a8c638..26a2e048 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateFilterForDestinationV1Output.java +++ b/src/main/java/com/segment/publicapi/models/UpdateFilterForDestinationV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,202 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Filter3; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Output for UpdateDestinationFilterV1. - */ -@ApiModel(description = "Output for UpdateDestinationFilterV1.") - +/** Output for UpdateDestinationFilterV1. */ public class UpdateFilterForDestinationV1Output { - public static final String SERIALIZED_NAME_FILTER = "filter"; - @SerializedName(SERIALIZED_NAME_FILTER) - private Filter3 filter; + public static final String SERIALIZED_NAME_FILTER = "filter"; - public UpdateFilterForDestinationV1Output() { - } + @SerializedName(SERIALIZED_NAME_FILTER) + private DestinationFilterV1 filter; - public UpdateFilterForDestinationV1Output filter(Filter3 filter) { - - this.filter = filter; - return this; - } + public UpdateFilterForDestinationV1Output() {} - /** - * Get filter - * @return filter - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public UpdateFilterForDestinationV1Output filter(DestinationFilterV1 filter) { - public Filter3 getFilter() { - return filter; - } + this.filter = filter; + return this; + } + /** + * Get filter + * + * @return filter + */ + @javax.annotation.Nonnull + public DestinationFilterV1 getFilter() { + return filter; + } - public void setFilter(Filter3 filter) { - this.filter = filter; - } + public void setFilter(DestinationFilterV1 filter) { + this.filter = filter; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFilterForDestinationV1Output updateFilterForDestinationV1Output = + (UpdateFilterForDestinationV1Output) o; + return Objects.equals(this.filter, updateFilterForDestinationV1Output.filter); + } + @Override + public int hashCode() { + return Objects.hash(filter); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFilterForDestinationV1Output {\n"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateFilterForDestinationV1Output updateFilterForDestinationV1Output = (UpdateFilterForDestinationV1Output) o; - return Objects.equals(this.filter, updateFilterForDestinationV1Output.filter); - } - - @Override - public int hashCode() { - return Objects.hash(filter); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateFilterForDestinationV1Output {\n"); - sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("filter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("filter"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("filter"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("filter"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateFilterForDestinationV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateFilterForDestinationV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateFilterForDestinationV1Output is not found in the empty JSON string", UpdateFilterForDestinationV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateFilterForDestinationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFilterForDestinationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateFilterForDestinationV1Output is" + + " not found in the empty JSON string", + UpdateFilterForDestinationV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateFilterForDestinationV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFilterForDestinationV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFilterForDestinationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateFilterForDestinationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateFilterForDestinationV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateFilterForDestinationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `filter` + DestinationFilterV1.validateJsonElement(jsonObj.get("filter")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateFilterForDestinationV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateFilterForDestinationV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateFilterForDestinationV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateFilterForDestinationV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateFilterForDestinationV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFilterForDestinationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFilterForDestinationV1Output' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateFilterForDestinationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFilterForDestinationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFilterForDestinationV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateFilterForDestinationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFilterForDestinationV1Output + * @throws IOException if the JSON string is invalid with respect to + * UpdateFilterForDestinationV1Output + */ + public static UpdateFilterForDestinationV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFilterForDestinationV1Output.class); } - } - - /** - * Create an instance of UpdateFilterForDestinationV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateFilterForDestinationV1Output - * @throws IOException if the JSON string is invalid with respect to UpdateFilterForDestinationV1Output - */ - public static UpdateFilterForDestinationV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateFilterForDestinationV1Output.class); - } - - /** - * Convert an instance of UpdateFilterForDestinationV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateFilterForDestinationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateFunction200Response.java b/src/main/java/com/segment/publicapi/models/UpdateFunction200Response.java index fac650a7..835c952e 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateFunction200Response.java +++ b/src/main/java/com/segment/publicapi/models/UpdateFunction200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateFunctionV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateFunction200Response - */ - +/** UpdateFunction200Response */ public class UpdateFunction200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateFunctionV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateFunction200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateFunctionV1Output data; - public UpdateFunction200Response data(UpdateFunctionV1Output data) { - - this.data = data; - return this; - } + public UpdateFunction200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateFunction200Response data(UpdateFunctionV1Output data) { - public UpdateFunctionV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateFunctionV1Output getData() { + return data; + } - public void setData(UpdateFunctionV1Output data) { - this.data = data; - } + public void setData(UpdateFunctionV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFunction200Response updateFunction200Response = (UpdateFunction200Response) o; + return Objects.equals(this.data, updateFunction200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFunction200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateFunction200Response updateFunction200Response = (UpdateFunction200Response) o; - return Objects.equals(this.data, updateFunction200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateFunction200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateFunction200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateFunction200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateFunction200Response is not found in the empty JSON string", UpdateFunction200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateFunction200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFunction200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateFunction200Response is not found" + + " in the empty JSON string", + UpdateFunction200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateFunction200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFunction200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFunction200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateFunction200Response` 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()) { + UpdateFunctionV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateFunction200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateFunction200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateFunction200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateFunction200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateFunction200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFunction200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFunction200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateFunction200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFunction200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFunction200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateFunction200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFunction200Response + * @throws IOException if the JSON string is invalid with respect to UpdateFunction200Response + */ + public static UpdateFunction200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFunction200Response.class); } - } - - /** - * Create an instance of UpdateFunction200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateFunction200Response - * @throws IOException if the JSON string is invalid with respect to UpdateFunction200Response - */ - public static UpdateFunction200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateFunction200Response.class); - } - - /** - * Convert an instance of UpdateFunction200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateFunction200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateFunctionV1Input.java b/src/main/java/com/segment/publicapi/models/UpdateFunctionV1Input.java index a35eb50c..7f54eb2e 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateFunctionV1Input.java +++ b/src/main/java/com/segment/publicapi/models/UpdateFunctionV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,349 +9,355 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.FunctionSettingV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Update a Function. - */ -@ApiModel(description = "Update a Function.") - +/** Update a Function. */ public class UpdateFunctionV1Input { - public static final String SERIALIZED_NAME_CODE = "code"; - @SerializedName(SERIALIZED_NAME_CODE) - private String code; + public static final String SERIALIZED_NAME_CODE = "code"; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private List settings = null; + @SerializedName(SERIALIZED_NAME_CODE) + private String code; - public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; - @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) - private String displayName; + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - public static final String SERIALIZED_NAME_LOGO_URL = "logoUrl"; - @SerializedName(SERIALIZED_NAME_LOGO_URL) - private String logoUrl; + @SerializedName(SERIALIZED_NAME_SETTINGS) + private List settings; - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; - public UpdateFunctionV1Input() { - } + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + private String displayName; - public UpdateFunctionV1Input code(String code) { - - this.code = code; - return this; - } + public static final String SERIALIZED_NAME_LOGO_URL = "logoUrl"; - /** - * The Function code. - * @return code - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Function code.") + @SerializedName(SERIALIZED_NAME_LOGO_URL) + private String logoUrl; - public String getCode() { - return code; - } + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - public void setCode(String code) { - this.code = code; - } + public UpdateFunctionV1Input() {} + public UpdateFunctionV1Input code(String code) { - public UpdateFunctionV1Input settings(List settings) { - - this.settings = settings; - return this; - } + this.code = code; + return this; + } - public UpdateFunctionV1Input addSettingsItem(FunctionSettingV1 settingsItem) { - if (this.settings == null) { - this.settings = new ArrayList<>(); + /** + * The Function code. + * + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; } - this.settings.add(settingsItem); - return this; - } - /** - * The list of settings for this Function. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The list of settings for this Function.") + public void setCode(String code) { + this.code = code; + } - public List getSettings() { - return settings; - } + public UpdateFunctionV1Input settings(List settings) { + this.settings = settings; + return this; + } - public void setSettings(List settings) { - this.settings = settings; - } + public UpdateFunctionV1Input addSettingsItem(FunctionSettingV1 settingsItem) { + if (this.settings == null) { + this.settings = new ArrayList<>(); + } + this.settings.add(settingsItem); + return this; + } + /** + * The list of settings for this Function. + * + * @return settings + */ + @javax.annotation.Nullable + public List getSettings() { + return settings; + } - public UpdateFunctionV1Input displayName(String displayName) { - - this.displayName = displayName; - return this; - } + public void setSettings(List settings) { + this.settings = settings; + } - /** - * A display name for this Function. - * @return displayName - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A display name for this Function.") + public UpdateFunctionV1Input displayName(String displayName) { - public String getDisplayName() { - return displayName; - } + this.displayName = displayName; + return this; + } + /** + * A display name for this Function. + * + * @return displayName + */ + @javax.annotation.Nullable + public String getDisplayName() { + return displayName; + } - public void setDisplayName(String displayName) { - this.displayName = displayName; - } + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + public UpdateFunctionV1Input logoUrl(String logoUrl) { - public UpdateFunctionV1Input logoUrl(String logoUrl) { - - this.logoUrl = logoUrl; - return this; - } + this.logoUrl = logoUrl; + return this; + } - /** - * A logo for this Function. - * @return logoUrl - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A logo for this Function.") + /** + * A logo for this Function. + * + * @return logoUrl + */ + @javax.annotation.Nullable + public String getLogoUrl() { + return logoUrl; + } - public String getLogoUrl() { - return logoUrl; - } + public void setLogoUrl(String logoUrl) { + this.logoUrl = logoUrl; + } + public UpdateFunctionV1Input description(String description) { - public void setLogoUrl(String logoUrl) { - this.logoUrl = logoUrl; - } + this.description = description; + return this; + } + /** + * A description for this Function. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } - public UpdateFunctionV1Input description(String description) { - - this.description = description; - return this; - } + public void setDescription(String description) { + this.description = description; + } - /** - * A description for this Function. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A description for this Function.") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFunctionV1Input updateFunctionV1Input = (UpdateFunctionV1Input) o; + return Objects.equals(this.code, updateFunctionV1Input.code) + && Objects.equals(this.settings, updateFunctionV1Input.settings) + && Objects.equals(this.displayName, updateFunctionV1Input.displayName) + && Objects.equals(this.logoUrl, updateFunctionV1Input.logoUrl) + && Objects.equals(this.description, updateFunctionV1Input.description); + } - public String getDescription() { - return description; - } + @Override + public int hashCode() { + return Objects.hash(code, settings, displayName, logoUrl, description); + } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFunctionV1Input {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" logoUrl: ").append(toIndentedString(logoUrl)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public void setDescription(String description) { - this.description = description; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("settings"); + openapiFields.add("displayName"); + openapiFields.add("logoUrl"); + openapiFields.add("description"); - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateFunctionV1Input updateFunctionV1Input = (UpdateFunctionV1Input) o; - return Objects.equals(this.code, updateFunctionV1Input.code) && - Objects.equals(this.settings, updateFunctionV1Input.settings) && - Objects.equals(this.displayName, updateFunctionV1Input.displayName) && - Objects.equals(this.logoUrl, updateFunctionV1Input.logoUrl) && - Objects.equals(this.description, updateFunctionV1Input.description); - } - - @Override - public int hashCode() { - return Objects.hash(code, settings, displayName, logoUrl, description); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateFunctionV1Input {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); - sb.append(" logoUrl: ").append(toIndentedString(logoUrl)).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("code"); - openapiFields.add("settings"); - openapiFields.add("displayName"); - openapiFields.add("logoUrl"); - openapiFields.add("description"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateFunctionV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateFunctionV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateFunctionV1Input is not found in the empty JSON string", UpdateFunctionV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateFunctionV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFunctionV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateFunctionV1Input is not found in" + + " the empty JSON string", + UpdateFunctionV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateFunctionV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFunctionV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFunctionV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateFunctionV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); - } - if (jsonObj.get("settings") != null && !jsonObj.get("settings").isJsonNull()) { - JsonArray jsonArraysettings = jsonObj.getAsJsonArray("settings"); - if (jsonArraysettings != null) { - // ensure the json data is an array - if (!jsonObj.get("settings").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `settings` to be an array in the JSON string but got `%s`", jsonObj.get("settings").toString())); - } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) + && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if (jsonObj.get("settings") != null && !jsonObj.get("settings").isJsonNull()) { + JsonArray jsonArraysettings = jsonObj.getAsJsonArray("settings"); + if (jsonArraysettings != null) { + // ensure the json data is an array + if (!jsonObj.get("settings").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `settings` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("settings").toString())); + } + + // validate the optional field `settings` (array) + for (int i = 0; i < jsonArraysettings.size(); i++) { + FunctionSettingV1.validateJsonElement(jsonArraysettings.get(i)); + } + ; + } + } + if ((jsonObj.get("displayName") != null && !jsonObj.get("displayName").isJsonNull()) + && !jsonObj.get("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `displayName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("displayName").toString())); + } + if ((jsonObj.get("logoUrl") != null && !jsonObj.get("logoUrl").isJsonNull()) + && !jsonObj.get("logoUrl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `logoUrl` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("logoUrl").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 (!UpdateFunctionV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFunctionV1Input' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateFunctionV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFunctionV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFunctionV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - if ((jsonObj.get("displayName") != null && !jsonObj.get("displayName").isJsonNull()) && !jsonObj.get("displayName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayName").toString())); - } - if ((jsonObj.get("logoUrl") != null && !jsonObj.get("logoUrl").isJsonNull()) && !jsonObj.get("logoUrl").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `logoUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("logoUrl").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 (!UpdateFunctionV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateFunctionV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateFunctionV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateFunctionV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateFunctionV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of UpdateFunctionV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateFunctionV1Input - * @throws IOException if the JSON string is invalid with respect to UpdateFunctionV1Input - */ - public static UpdateFunctionV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateFunctionV1Input.class); - } - - /** - * Convert an instance of UpdateFunctionV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of UpdateFunctionV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFunctionV1Input + * @throws IOException if the JSON string is invalid with respect to UpdateFunctionV1Input + */ + public static UpdateFunctionV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFunctionV1Input.class); + } + + /** + * Convert an instance of UpdateFunctionV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateFunctionV1Output.java b/src/main/java/com/segment/publicapi/models/UpdateFunctionV1Output.java index dcc2c3c1..a3d1c738 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateFunctionV1Output.java +++ b/src/main/java/com/segment/publicapi/models/UpdateFunctionV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Function2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Create a Function. - */ -@ApiModel(description = "Create a Function.") - +/** Create a Function. */ public class UpdateFunctionV1Output { - public static final String SERIALIZED_NAME_FUNCTION = "function"; - @SerializedName(SERIALIZED_NAME_FUNCTION) - private Function2 function; + public static final String SERIALIZED_NAME_FUNCTION = "function"; - public UpdateFunctionV1Output() { - } + @SerializedName(SERIALIZED_NAME_FUNCTION) + private FunctionV1 function; - public UpdateFunctionV1Output function(Function2 function) { - - this.function = function; - return this; - } + public UpdateFunctionV1Output() {} - /** - * Get function - * @return function - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public UpdateFunctionV1Output function(FunctionV1 function) { - public Function2 getFunction() { - return function; - } + this.function = function; + return this; + } + /** + * Get function + * + * @return function + */ + @javax.annotation.Nonnull + public FunctionV1 getFunction() { + return function; + } - public void setFunction(Function2 function) { - this.function = function; - } + public void setFunction(FunctionV1 function) { + this.function = function; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFunctionV1Output updateFunctionV1Output = (UpdateFunctionV1Output) o; + return Objects.equals(this.function, updateFunctionV1Output.function); + } + @Override + public int hashCode() { + return Objects.hash(function); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFunctionV1Output {\n"); + sb.append(" function: ").append(toIndentedString(function)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateFunctionV1Output updateFunctionV1Output = (UpdateFunctionV1Output) o; - return Objects.equals(this.function, updateFunctionV1Output.function); - } - - @Override - public int hashCode() { - return Objects.hash(function); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateFunctionV1Output {\n"); - sb.append(" function: ").append(toIndentedString(function)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("function"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("function"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("function"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("function"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateFunctionV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateFunctionV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateFunctionV1Output is not found in the empty JSON string", UpdateFunctionV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateFunctionV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFunctionV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateFunctionV1Output is not found in" + + " the empty JSON string", + UpdateFunctionV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateFunctionV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFunctionV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFunctionV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateFunctionV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateFunctionV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateFunctionV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `function` + FunctionV1.validateJsonElement(jsonObj.get("function")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateFunctionV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateFunctionV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateFunctionV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateFunctionV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateFunctionV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFunctionV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFunctionV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateFunctionV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFunctionV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFunctionV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateFunctionV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFunctionV1Output + * @throws IOException if the JSON string is invalid with respect to UpdateFunctionV1Output + */ + public static UpdateFunctionV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFunctionV1Output.class); } - } - - /** - * Create an instance of UpdateFunctionV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateFunctionV1Output - * @throws IOException if the JSON string is invalid with respect to UpdateFunctionV1Output - */ - public static UpdateFunctionV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateFunctionV1Output.class); - } - - /** - * Convert an instance of UpdateFunctionV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateFunctionV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateGroupSubscriptionStatusResponse.java b/src/main/java/com/segment/publicapi/models/UpdateGroupSubscriptionStatusResponse.java new file mode 100644 index 00000000..90a9181b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateGroupSubscriptionStatusResponse.java @@ -0,0 +1,338 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** UpdateGroupSubscriptionStatusResponse */ +public class UpdateGroupSubscriptionStatusResponse { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + /** The user subscribed, unsubscribed, or on initial status. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + DID_NOT_SUBSCRIBE("DID_NOT_SUBSCRIBE"), + + SUBSCRIBED("SUBSCRIBED"), + + UNSUBSCRIBED("UNSUBSCRIBED"); + + 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_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public UpdateGroupSubscriptionStatusResponse() {} + + public UpdateGroupSubscriptionStatusResponse name(String name) { + + this.name = name; + return this; + } + + /** + * Name of the group. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UpdateGroupSubscriptionStatusResponse status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The user subscribed, unsubscribed, or on initial status. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public UpdateGroupSubscriptionStatusResponse id(String id) { + + this.id = id; + return this; + } + + /** + * The group 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; + } + UpdateGroupSubscriptionStatusResponse updateGroupSubscriptionStatusResponse = + (UpdateGroupSubscriptionStatusResponse) o; + return Objects.equals(this.name, updateGroupSubscriptionStatusResponse.name) + && Objects.equals(this.status, updateGroupSubscriptionStatusResponse.status) + && Objects.equals(this.id, updateGroupSubscriptionStatusResponse.id); + } + + @Override + public int hashCode() { + return Objects.hash(name, status, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateGroupSubscriptionStatusResponse {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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("status"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("status"); + 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 + * UpdateGroupSubscriptionStatusResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateGroupSubscriptionStatusResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateGroupSubscriptionStatusResponse" + + " is not found in the empty JSON string", + UpdateGroupSubscriptionStatusResponse.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateGroupSubscriptionStatusResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateGroupSubscriptionStatusResponse` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateGroupSubscriptionStatusResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("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 (!UpdateGroupSubscriptionStatusResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateGroupSubscriptionStatusResponse' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateGroupSubscriptionStatusResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateGroupSubscriptionStatusResponse value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateGroupSubscriptionStatusResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateGroupSubscriptionStatusResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateGroupSubscriptionStatusResponse + * @throws IOException if the JSON string is invalid with respect to + * UpdateGroupSubscriptionStatusResponse + */ + public static UpdateGroupSubscriptionStatusResponse fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateGroupSubscriptionStatusResponse.class); + } + + /** + * Convert an instance of UpdateGroupSubscriptionStatusResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateInsertFunctionInstance200Response.java b/src/main/java/com/segment/publicapi/models/UpdateInsertFunctionInstance200Response.java new file mode 100644 index 00000000..a97f0d28 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateInsertFunctionInstance200Response.java @@ -0,0 +1,206 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** UpdateInsertFunctionInstance200Response */ +public class UpdateInsertFunctionInstance200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateInsertFunctionInstanceAlphaOutput data; + + public UpdateInsertFunctionInstance200Response() {} + + public UpdateInsertFunctionInstance200Response data( + UpdateInsertFunctionInstanceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateInsertFunctionInstanceAlphaOutput getData() { + return data; + } + + public void setData(UpdateInsertFunctionInstanceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateInsertFunctionInstance200Response updateInsertFunctionInstance200Response = + (UpdateInsertFunctionInstance200Response) o; + return Objects.equals(this.data, updateInsertFunctionInstance200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateInsertFunctionInstance200Response {\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 + * UpdateInsertFunctionInstance200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateInsertFunctionInstance200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateInsertFunctionInstance200Response is not found in the" + + " empty JSON string", + UpdateInsertFunctionInstance200Response.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateInsertFunctionInstance200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateInsertFunctionInstance200Response` 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()) { + UpdateInsertFunctionInstanceAlphaOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateInsertFunctionInstance200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'UpdateInsertFunctionInstance200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateInsertFunctionInstance200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateInsertFunctionInstance200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateInsertFunctionInstance200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateInsertFunctionInstance200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateInsertFunctionInstance200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateInsertFunctionInstance200Response + */ + public static UpdateInsertFunctionInstance200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateInsertFunctionInstance200Response.class); + } + + /** + * Convert an instance of UpdateInsertFunctionInstance200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateInsertFunctionInstanceAlphaInput.java b/src/main/java/com/segment/publicapi/models/UpdateInsertFunctionInstanceAlphaInput.java new file mode 100644 index 00000000..37d61c5a --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateInsertFunctionInstanceAlphaInput.java @@ -0,0 +1,284 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Updates an insert Function instance. */ +public class UpdateInsertFunctionInstanceAlphaInput { + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_SETTINGS = "settings"; + + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings = new HashMap<>(); + + public UpdateInsertFunctionInstanceAlphaInput() {} + + public UpdateInsertFunctionInstanceAlphaInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Whether this insert Function instance should be enabled for the Destination. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public UpdateInsertFunctionInstanceAlphaInput name(String name) { + + this.name = name; + return this; + } + + /** + * Defines the display name of the insert Function instance. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UpdateInsertFunctionInstanceAlphaInput settings(Map settings) { + + this.settings = settings; + return this; + } + + public UpdateInsertFunctionInstanceAlphaInput putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + + /** + * An object that contains settings for this insert Function instance based on the settings + * present in the insert Function class. + * + * @return settings + */ + @javax.annotation.Nonnull + public Map getSettings() { + return settings; + } + + public void setSettings(Map settings) { + this.settings = settings; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateInsertFunctionInstanceAlphaInput updateInsertFunctionInstanceAlphaInput = + (UpdateInsertFunctionInstanceAlphaInput) o; + return Objects.equals(this.enabled, updateInsertFunctionInstanceAlphaInput.enabled) + && Objects.equals(this.name, updateInsertFunctionInstanceAlphaInput.name) + && Objects.equals(this.settings, updateInsertFunctionInstanceAlphaInput.settings); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, name, settings); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateInsertFunctionInstanceAlphaInput {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("enabled"); + openapiFields.add("name"); + openapiFields.add("settings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("settings"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateInsertFunctionInstanceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateInsertFunctionInstanceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateInsertFunctionInstanceAlphaInput" + + " is not found in the empty JSON string", + UpdateInsertFunctionInstanceAlphaInput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateInsertFunctionInstanceAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateInsertFunctionInstanceAlphaInput` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateInsertFunctionInstanceAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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") != 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 (!UpdateInsertFunctionInstanceAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateInsertFunctionInstanceAlphaInput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateInsertFunctionInstanceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateInsertFunctionInstanceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateInsertFunctionInstanceAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateInsertFunctionInstanceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateInsertFunctionInstanceAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * UpdateInsertFunctionInstanceAlphaInput + */ + public static UpdateInsertFunctionInstanceAlphaInput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateInsertFunctionInstanceAlphaInput.class); + } + + /** + * Convert an instance of UpdateInsertFunctionInstanceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateInsertFunctionInstanceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/UpdateInsertFunctionInstanceAlphaOutput.java new file mode 100644 index 00000000..1cf277da --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateInsertFunctionInstanceAlphaOutput.java @@ -0,0 +1,219 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Returns the updated insert Function instance. */ +public class UpdateInsertFunctionInstanceAlphaOutput { + public static final String SERIALIZED_NAME_INSERT_FUNCTION_INSTANCE = "insertFunctionInstance"; + + @SerializedName(SERIALIZED_NAME_INSERT_FUNCTION_INSTANCE) + private InsertFunctionInstanceAlpha insertFunctionInstance; + + public UpdateInsertFunctionInstanceAlphaOutput() {} + + public UpdateInsertFunctionInstanceAlphaOutput insertFunctionInstance( + InsertFunctionInstanceAlpha insertFunctionInstance) { + + this.insertFunctionInstance = insertFunctionInstance; + return this; + } + + /** + * Get insertFunctionInstance + * + * @return insertFunctionInstance + */ + @javax.annotation.Nonnull + public InsertFunctionInstanceAlpha getInsertFunctionInstance() { + return insertFunctionInstance; + } + + public void setInsertFunctionInstance(InsertFunctionInstanceAlpha insertFunctionInstance) { + this.insertFunctionInstance = insertFunctionInstance; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateInsertFunctionInstanceAlphaOutput updateInsertFunctionInstanceAlphaOutput = + (UpdateInsertFunctionInstanceAlphaOutput) o; + return Objects.equals( + this.insertFunctionInstance, + updateInsertFunctionInstanceAlphaOutput.insertFunctionInstance); + } + + @Override + public int hashCode() { + return Objects.hash(insertFunctionInstance); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateInsertFunctionInstanceAlphaOutput {\n"); + sb.append(" insertFunctionInstance: ") + .append(toIndentedString(insertFunctionInstance)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("insertFunctionInstance"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("insertFunctionInstance"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateInsertFunctionInstanceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateInsertFunctionInstanceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateInsertFunctionInstanceAlphaOutput is not found in the" + + " empty JSON string", + UpdateInsertFunctionInstanceAlphaOutput.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateInsertFunctionInstanceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateInsertFunctionInstanceAlphaOutput` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateInsertFunctionInstanceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `insertFunctionInstance` + InsertFunctionInstanceAlpha.validateJsonElement(jsonObj.get("insertFunctionInstance")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateInsertFunctionInstanceAlphaOutput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'UpdateInsertFunctionInstanceAlphaOutput' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateInsertFunctionInstanceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateInsertFunctionInstanceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateInsertFunctionInstanceAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateInsertFunctionInstanceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateInsertFunctionInstanceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * UpdateInsertFunctionInstanceAlphaOutput + */ + public static UpdateInsertFunctionInstanceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateInsertFunctionInstanceAlphaOutput.class); + } + + /** + * Convert an instance of UpdateInsertFunctionInstanceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateProfilesWarehouseForSpaceWarehouse200Response.java b/src/main/java/com/segment/publicapi/models/UpdateProfilesWarehouseForSpaceWarehouse200Response.java new file mode 100644 index 00000000..3621dee8 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateProfilesWarehouseForSpaceWarehouse200Response.java @@ -0,0 +1,216 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** UpdateProfilesWarehouseForSpaceWarehouse200Response */ +public class UpdateProfilesWarehouseForSpaceWarehouse200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput data; + + public UpdateProfilesWarehouseForSpaceWarehouse200Response() {} + + public UpdateProfilesWarehouseForSpaceWarehouse200Response data( + UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput getData() { + return data; + } + + public void setData(UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateProfilesWarehouseForSpaceWarehouse200Response + updateProfilesWarehouseForSpaceWarehouse200Response = + (UpdateProfilesWarehouseForSpaceWarehouse200Response) o; + return Objects.equals(this.data, updateProfilesWarehouseForSpaceWarehouse200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateProfilesWarehouseForSpaceWarehouse200Response {\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 + * UpdateProfilesWarehouseForSpaceWarehouse200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateProfilesWarehouseForSpaceWarehouse200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateProfilesWarehouseForSpaceWarehouse200Response is not" + + " found in the empty JSON string", + UpdateProfilesWarehouseForSpaceWarehouse200Response + .openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateProfilesWarehouseForSpaceWarehouse200Response.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateProfilesWarehouseForSpaceWarehouse200Response`" + + " 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()) { + UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput.validateJsonElement( + jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateProfilesWarehouseForSpaceWarehouse200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'UpdateProfilesWarehouseForSpaceWarehouse200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + UpdateProfilesWarehouseForSpaceWarehouse200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + UpdateProfilesWarehouseForSpaceWarehouse200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateProfilesWarehouseForSpaceWarehouse200Response read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateProfilesWarehouseForSpaceWarehouse200Response given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of UpdateProfilesWarehouseForSpaceWarehouse200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateProfilesWarehouseForSpaceWarehouse200Response + */ + public static UpdateProfilesWarehouseForSpaceWarehouse200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, UpdateProfilesWarehouseForSpaceWarehouse200Response.class); + } + + /** + * Convert an instance of UpdateProfilesWarehouseForSpaceWarehouse200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateProfilesWarehouseForSpaceWarehouseAlphaInput.java b/src/main/java/com/segment/publicapi/models/UpdateProfilesWarehouseForSpaceWarehouseAlphaInput.java new file mode 100644 index 00000000..c15650b3 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateProfilesWarehouseForSpaceWarehouseAlphaInput.java @@ -0,0 +1,337 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Updates a Profiles Warehouse based on a set of parameters. */ +public class UpdateProfilesWarehouseForSpaceWarehouseAlphaInput { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_SETTINGS = "settings"; + + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; + + public static final String SERIALIZED_NAME_SCHEMA_NAME = "schemaName"; + + @SerializedName(SERIALIZED_NAME_SCHEMA_NAME) + private String schemaName; + + public UpdateProfilesWarehouseForSpaceWarehouseAlphaInput() {} + + public UpdateProfilesWarehouseForSpaceWarehouseAlphaInput name(String name) { + + this.name = name; + return this; + } + + /** + * An optional human-readable name for this Warehouse. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UpdateProfilesWarehouseForSpaceWarehouseAlphaInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Enable to allow this Warehouse to receive data. Defaults to true. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public UpdateProfilesWarehouseForSpaceWarehouseAlphaInput settings( + Map settings) { + + this.settings = settings; + return this; + } + + public UpdateProfilesWarehouseForSpaceWarehouseAlphaInput putSettingsItem( + String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + + /** + * A key-value object that contains instance-specific Warehouse settings. + * + * @return settings + */ + @javax.annotation.Nonnull + public Map getSettings() { + return settings; + } + + public void setSettings(Map settings) { + this.settings = settings; + } + + public UpdateProfilesWarehouseForSpaceWarehouseAlphaInput schemaName(String schemaName) { + + this.schemaName = schemaName; + return this; + } + + /** + * The custom schema name that Segment uses on the Warehouse side. The space slug value is + * default otherwise. + * + * @return schemaName + */ + @javax.annotation.Nullable + public String getSchemaName() { + return schemaName; + } + + public void setSchemaName(String schemaName) { + this.schemaName = schemaName; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateProfilesWarehouseForSpaceWarehouseAlphaInput + updateProfilesWarehouseForSpaceWarehouseAlphaInput = + (UpdateProfilesWarehouseForSpaceWarehouseAlphaInput) o; + return Objects.equals(this.name, updateProfilesWarehouseForSpaceWarehouseAlphaInput.name) + && Objects.equals( + this.enabled, updateProfilesWarehouseForSpaceWarehouseAlphaInput.enabled) + && Objects.equals( + this.settings, updateProfilesWarehouseForSpaceWarehouseAlphaInput.settings) + && Objects.equals( + this.schemaName, + updateProfilesWarehouseForSpaceWarehouseAlphaInput.schemaName); + } + + @Override + public int hashCode() { + return Objects.hash(name, enabled, settings, schemaName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateProfilesWarehouseForSpaceWarehouseAlphaInput {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" schemaName: ").append(toIndentedString(schemaName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("enabled"); + openapiFields.add("settings"); + openapiFields.add("schemaName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("settings"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateProfilesWarehouseForSpaceWarehouseAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateProfilesWarehouseForSpaceWarehouseAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateProfilesWarehouseForSpaceWarehouseAlphaInput is not" + + " found in the empty JSON string", + UpdateProfilesWarehouseForSpaceWarehouseAlphaInput + .openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateProfilesWarehouseForSpaceWarehouseAlphaInput.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateProfilesWarehouseForSpaceWarehouseAlphaInput`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + UpdateProfilesWarehouseForSpaceWarehouseAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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") != 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("schemaName") != null && !jsonObj.get("schemaName").isJsonNull()) + && !jsonObj.get("schemaName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `schemaName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("schemaName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateProfilesWarehouseForSpaceWarehouseAlphaInput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'UpdateProfilesWarehouseForSpaceWarehouseAlphaInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + UpdateProfilesWarehouseForSpaceWarehouseAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + UpdateProfilesWarehouseForSpaceWarehouseAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateProfilesWarehouseForSpaceWarehouseAlphaInput read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateProfilesWarehouseForSpaceWarehouseAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateProfilesWarehouseForSpaceWarehouseAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * UpdateProfilesWarehouseForSpaceWarehouseAlphaInput + */ + public static UpdateProfilesWarehouseForSpaceWarehouseAlphaInput fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, UpdateProfilesWarehouseForSpaceWarehouseAlphaInput.class); + } + + /** + * Convert an instance of UpdateProfilesWarehouseForSpaceWarehouseAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput.java b/src/main/java/com/segment/publicapi/models/UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput.java new file mode 100644 index 00000000..ec966015 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput.java @@ -0,0 +1,229 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Returns the updated Warehouse. */ +public class UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput { + public static final String SERIALIZED_NAME_PROFILES_WAREHOUSE = "profilesWarehouse"; + + @SerializedName(SERIALIZED_NAME_PROFILES_WAREHOUSE) + private ProfilesWarehouseAlpha profilesWarehouse; + + public UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput() {} + + public UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput profilesWarehouse( + ProfilesWarehouseAlpha profilesWarehouse) { + + this.profilesWarehouse = profilesWarehouse; + return this; + } + + /** + * Get profilesWarehouse + * + * @return profilesWarehouse + */ + @javax.annotation.Nonnull + public ProfilesWarehouseAlpha getProfilesWarehouse() { + return profilesWarehouse; + } + + public void setProfilesWarehouse(ProfilesWarehouseAlpha profilesWarehouse) { + this.profilesWarehouse = profilesWarehouse; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput + updateProfilesWarehouseForSpaceWarehouseAlphaOutput = + (UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput) o; + return Objects.equals( + this.profilesWarehouse, + updateProfilesWarehouseForSpaceWarehouseAlphaOutput.profilesWarehouse); + } + + @Override + public int hashCode() { + return Objects.hash(profilesWarehouse); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput {\n"); + sb.append(" profilesWarehouse: ") + .append(toIndentedString(profilesWarehouse)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("profilesWarehouse"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("profilesWarehouse"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput is not" + + " found in the empty JSON string", + UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput + .openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `profilesWarehouse` + ProfilesWarehouseAlpha.validateJsonElement(jsonObj.get("profilesWarehouse")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput given an JSON + * string + * + * @param jsonString JSON string + * @return An instance of UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput + */ + public static UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput.class); + } + + /** + * Convert an instance of UpdateProfilesWarehouseForSpaceWarehouseAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateReverseEtlModel200Response.java b/src/main/java/com/segment/publicapi/models/UpdateReverseEtlModel200Response.java new file mode 100644 index 00000000..9c76a99d --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateReverseEtlModel200Response.java @@ -0,0 +1,199 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** UpdateReverseEtlModel200Response */ +public class UpdateReverseEtlModel200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateReverseEtlModelOutput data; + + public UpdateReverseEtlModel200Response() {} + + public UpdateReverseEtlModel200Response data(UpdateReverseEtlModelOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateReverseEtlModelOutput getData() { + return data; + } + + public void setData(UpdateReverseEtlModelOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateReverseEtlModel200Response updateReverseEtlModel200Response = + (UpdateReverseEtlModel200Response) o; + return Objects.equals(this.data, updateReverseEtlModel200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateReverseEtlModel200Response {\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 + * UpdateReverseEtlModel200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateReverseEtlModel200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateReverseEtlModel200Response is" + + " not found in the empty JSON string", + UpdateReverseEtlModel200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateReverseEtlModel200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateReverseEtlModel200Response` 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()) { + UpdateReverseEtlModelOutput.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateReverseEtlModel200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateReverseEtlModel200Response' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateReverseEtlModel200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateReverseEtlModel200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateReverseEtlModel200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateReverseEtlModel200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateReverseEtlModel200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateReverseEtlModel200Response + */ + public static UpdateReverseEtlModel200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateReverseEtlModel200Response.class); + } + + /** + * Convert an instance of UpdateReverseEtlModel200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateReverseEtlModelInput.java b/src/main/java/com/segment/publicapi/models/UpdateReverseEtlModelInput.java new file mode 100644 index 00000000..fac4a9aa --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateReverseEtlModelInput.java @@ -0,0 +1,341 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Defines how to update an existing Model. */ +public class UpdateReverseEtlModelInput { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_QUERY = "query"; + + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + + public static final String SERIALIZED_NAME_QUERY_IDENTIFIER_COLUMN = "queryIdentifierColumn"; + + @SerializedName(SERIALIZED_NAME_QUERY_IDENTIFIER_COLUMN) + private String queryIdentifierColumn; + + public UpdateReverseEtlModelInput() {} + + public UpdateReverseEtlModelInput name(String name) { + + this.name = name; + return this; + } + + /** + * A short, human-readable description of the Model. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UpdateReverseEtlModelInput description(String description) { + + this.description = description; + return this; + } + + /** + * A longer, more descriptive explanation of the Model. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public UpdateReverseEtlModelInput enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Indicates whether the Model should have syncs enabled. When disabled, no syncs will be + * triggered, regardless of the enabled status of the attached destinations/subscriptions. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public UpdateReverseEtlModelInput query(String query) { + + this.query = query; + return this; + } + + /** + * The SQL query that will be executed to extract data from the connected Source. + * + * @return query + */ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public UpdateReverseEtlModelInput queryIdentifierColumn(String queryIdentifierColumn) { + + this.queryIdentifierColumn = queryIdentifierColumn; + return this; + } + + /** + * Indicates the column named in `query` that should be used to uniquely identify the + * extracted records. + * + * @return queryIdentifierColumn + */ + @javax.annotation.Nullable + public String getQueryIdentifierColumn() { + return queryIdentifierColumn; + } + + public void setQueryIdentifierColumn(String queryIdentifierColumn) { + this.queryIdentifierColumn = queryIdentifierColumn; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateReverseEtlModelInput updateReverseEtlModelInput = (UpdateReverseEtlModelInput) o; + return Objects.equals(this.name, updateReverseEtlModelInput.name) + && Objects.equals(this.description, updateReverseEtlModelInput.description) + && Objects.equals(this.enabled, updateReverseEtlModelInput.enabled) + && Objects.equals(this.query, updateReverseEtlModelInput.query) + && Objects.equals( + this.queryIdentifierColumn, + updateReverseEtlModelInput.queryIdentifierColumn); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, enabled, query, queryIdentifierColumn); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateReverseEtlModelInput {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" queryIdentifierColumn: ") + .append(toIndentedString(queryIdentifierColumn)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("description"); + openapiFields.add("enabled"); + openapiFields.add("query"); + openapiFields.add("queryIdentifierColumn"); + + // 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 UpdateReverseEtlModelInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateReverseEtlModelInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateReverseEtlModelInput is not" + + " found in the empty JSON string", + UpdateReverseEtlModelInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateReverseEtlModelInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateReverseEtlModelInput` 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())); + } + 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("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("queryIdentifierColumn") != null + && !jsonObj.get("queryIdentifierColumn").isJsonNull()) + && !jsonObj.get("queryIdentifierColumn").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `queryIdentifierColumn` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("queryIdentifierColumn").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateReverseEtlModelInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateReverseEtlModelInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateReverseEtlModelInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateReverseEtlModelInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateReverseEtlModelInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateReverseEtlModelInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateReverseEtlModelInput + * @throws IOException if the JSON string is invalid with respect to UpdateReverseEtlModelInput + */ + public static UpdateReverseEtlModelInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateReverseEtlModelInput.class); + } + + /** + * Convert an instance of UpdateReverseEtlModelInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateReverseEtlModelOutput.java b/src/main/java/com/segment/publicapi/models/UpdateReverseEtlModelOutput.java new file mode 100644 index 00000000..cce40081 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateReverseEtlModelOutput.java @@ -0,0 +1,204 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Defines the results of updating a Model. */ +public class UpdateReverseEtlModelOutput { + public static final String SERIALIZED_NAME_REVERSE_ETL_MODEL = "reverseEtlModel"; + + @SerializedName(SERIALIZED_NAME_REVERSE_ETL_MODEL) + private ReverseEtlModel reverseEtlModel; + + public UpdateReverseEtlModelOutput() {} + + public UpdateReverseEtlModelOutput reverseEtlModel(ReverseEtlModel reverseEtlModel) { + + this.reverseEtlModel = reverseEtlModel; + return this; + } + + /** + * Get reverseEtlModel + * + * @return reverseEtlModel + */ + @javax.annotation.Nonnull + public ReverseEtlModel getReverseEtlModel() { + return reverseEtlModel; + } + + public void setReverseEtlModel(ReverseEtlModel reverseEtlModel) { + this.reverseEtlModel = reverseEtlModel; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateReverseEtlModelOutput updateReverseEtlModelOutput = (UpdateReverseEtlModelOutput) o; + return Objects.equals(this.reverseEtlModel, updateReverseEtlModelOutput.reverseEtlModel); + } + + @Override + public int hashCode() { + return Objects.hash(reverseEtlModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateReverseEtlModelOutput {\n"); + sb.append(" reverseEtlModel: ").append(toIndentedString(reverseEtlModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reverseEtlModel"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("reverseEtlModel"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateReverseEtlModelOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateReverseEtlModelOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateReverseEtlModelOutput is not" + + " found in the empty JSON string", + UpdateReverseEtlModelOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateReverseEtlModelOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateReverseEtlModelOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateReverseEtlModelOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `reverseEtlModel` + ReverseEtlModel.validateJsonElement(jsonObj.get("reverseEtlModel")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateReverseEtlModelOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateReverseEtlModelOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateReverseEtlModelOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateReverseEtlModelOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateReverseEtlModelOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateReverseEtlModelOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateReverseEtlModelOutput + * @throws IOException if the JSON string is invalid with respect to UpdateReverseEtlModelOutput + */ + public static UpdateReverseEtlModelOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateReverseEtlModelOutput.class); + } + + /** + * Convert an instance of UpdateReverseEtlModelOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateRulesInTrackingPlan200Response.java b/src/main/java/com/segment/publicapi/models/UpdateRulesInTrackingPlan200Response.java index 2fe515a6..4e52dd76 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateRulesInTrackingPlan200Response.java +++ b/src/main/java/com/segment/publicapi/models/UpdateRulesInTrackingPlan200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateRulesInTrackingPlanV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateRulesInTrackingPlan200Response - */ - +/** UpdateRulesInTrackingPlan200Response */ public class UpdateRulesInTrackingPlan200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateRulesInTrackingPlanV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateRulesInTrackingPlan200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateRulesInTrackingPlanV1Output data; - public UpdateRulesInTrackingPlan200Response data(UpdateRulesInTrackingPlanV1Output data) { - - this.data = data; - return this; - } + public UpdateRulesInTrackingPlan200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateRulesInTrackingPlan200Response data(UpdateRulesInTrackingPlanV1Output data) { - public UpdateRulesInTrackingPlanV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateRulesInTrackingPlanV1Output getData() { + return data; + } - public void setData(UpdateRulesInTrackingPlanV1Output data) { - this.data = data; - } + public void setData(UpdateRulesInTrackingPlanV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateRulesInTrackingPlan200Response updateRulesInTrackingPlan200Response = + (UpdateRulesInTrackingPlan200Response) o; + return Objects.equals(this.data, updateRulesInTrackingPlan200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateRulesInTrackingPlan200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateRulesInTrackingPlan200Response updateRulesInTrackingPlan200Response = (UpdateRulesInTrackingPlan200Response) o; - return Objects.equals(this.data, updateRulesInTrackingPlan200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateRulesInTrackingPlan200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateRulesInTrackingPlan200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateRulesInTrackingPlan200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateRulesInTrackingPlan200Response is not found in the empty JSON string", UpdateRulesInTrackingPlan200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateRulesInTrackingPlan200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateRulesInTrackingPlan200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateRulesInTrackingPlan200Response" + + " is not found in the empty JSON string", + UpdateRulesInTrackingPlan200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateRulesInTrackingPlan200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateRulesInTrackingPlan200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateRulesInTrackingPlan200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateRulesInTrackingPlan200Response` 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()) { + UpdateRulesInTrackingPlanV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateRulesInTrackingPlan200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateRulesInTrackingPlan200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateRulesInTrackingPlan200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateRulesInTrackingPlan200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateRulesInTrackingPlan200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateRulesInTrackingPlan200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateRulesInTrackingPlan200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateRulesInTrackingPlan200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateRulesInTrackingPlan200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateRulesInTrackingPlan200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateRulesInTrackingPlan200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateRulesInTrackingPlan200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateRulesInTrackingPlan200Response + */ + public static UpdateRulesInTrackingPlan200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateRulesInTrackingPlan200Response.class); } - } - - /** - * Create an instance of UpdateRulesInTrackingPlan200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateRulesInTrackingPlan200Response - * @throws IOException if the JSON string is invalid with respect to UpdateRulesInTrackingPlan200Response - */ - public static UpdateRulesInTrackingPlan200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateRulesInTrackingPlan200Response.class); - } - - /** - * Convert an instance of UpdateRulesInTrackingPlan200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateRulesInTrackingPlan200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateRulesInTrackingPlanV1Input.java b/src/main/java/com/segment/publicapi/models/UpdateRulesInTrackingPlanV1Input.java index 4ea75dfb..fefa57e3 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateRulesInTrackingPlanV1Input.java +++ b/src/main/java/com/segment/publicapi/models/UpdateRulesInTrackingPlanV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,217 +9,224 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpsertRuleV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Updates Tracking Plan rules. Non-existent rules are added. */ +public class UpdateRulesInTrackingPlanV1Input { + public static final String SERIALIZED_NAME_RULES = "rules"; -/** - * Updates Tracking Plan rules. Non-existent rules are added. - */ -@ApiModel(description = "Updates Tracking Plan rules. Non-existent rules are added.") + @SerializedName(SERIALIZED_NAME_RULES) + private List rules = new ArrayList<>(); -public class UpdateRulesInTrackingPlanV1Input { - public static final String SERIALIZED_NAME_RULES = "rules"; - @SerializedName(SERIALIZED_NAME_RULES) - private List rules = null; - - public UpdateRulesInTrackingPlanV1Input() { - } - - public UpdateRulesInTrackingPlanV1Input rules(List rules) { - - this.rules = rules; - return this; - } - - public UpdateRulesInTrackingPlanV1Input addRulesItem(UpsertRuleV1 rulesItem) { - if (this.rules == null) { - this.rules = new ArrayList<>(); - } - this.rules.add(rulesItem); - return this; - } + public UpdateRulesInTrackingPlanV1Input() {} - /** - * Rules to update or insert. - * @return rules - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Rules to update or insert.") + public UpdateRulesInTrackingPlanV1Input rules(List rules) { - public List getRules() { - return rules; - } + this.rules = rules; + return this; + } + public UpdateRulesInTrackingPlanV1Input addRulesItem(UpsertRuleV1 rulesItem) { + if (this.rules == null) { + this.rules = new ArrayList<>(); + } + this.rules.add(rulesItem); + return this; + } - public void setRules(List rules) { - this.rules = rules; - } + /** + * Rules to update or insert. + * + * @return rules + */ + @javax.annotation.Nonnull + public List getRules() { + return rules; + } + public void setRules(List rules) { + this.rules = rules; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input = + (UpdateRulesInTrackingPlanV1Input) o; + return Objects.equals(this.rules, updateRulesInTrackingPlanV1Input.rules); + } + + @Override + public int hashCode() { + return Objects.hash(rules); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateRulesInTrackingPlanV1Input {\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateRulesInTrackingPlanV1Input updateRulesInTrackingPlanV1Input = (UpdateRulesInTrackingPlanV1Input) o; - return Objects.equals(this.rules, updateRulesInTrackingPlanV1Input.rules); - } - - @Override - public int hashCode() { - return Objects.hash(rules); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateRulesInTrackingPlanV1Input {\n"); - sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rules"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("rules"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("rules"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateRulesInTrackingPlanV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateRulesInTrackingPlanV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateRulesInTrackingPlanV1Input is not found in the empty JSON string", UpdateRulesInTrackingPlanV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateRulesInTrackingPlanV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateRulesInTrackingPlanV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateRulesInTrackingPlanV1Input is" + + " not found in the empty JSON string", + UpdateRulesInTrackingPlanV1Input.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateRulesInTrackingPlanV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateRulesInTrackingPlanV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateRulesInTrackingPlanV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateRulesInTrackingPlanV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateRulesInTrackingPlanV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("rules").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `rules` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("rules").toString())); } - } - if (jsonObj.get("rules") != null && !jsonObj.get("rules").isJsonNull()) { + JsonArray jsonArrayrules = jsonObj.getAsJsonArray("rules"); - if (jsonArrayrules != null) { - // ensure the json data is an array - if (!jsonObj.get("rules").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `rules` to be an array in the JSON string but got `%s`", jsonObj.get("rules").toString())); - } + // validate the required field `rules` (array) + for (int i = 0; i < jsonArrayrules.size(); i++) { + UpsertRuleV1.validateJsonElement(jsonArrayrules.get(i)); } - } - } + ; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateRulesInTrackingPlanV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateRulesInTrackingPlanV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateRulesInTrackingPlanV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateRulesInTrackingPlanV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateRulesInTrackingPlanV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateRulesInTrackingPlanV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateRulesInTrackingPlanV1Input' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateRulesInTrackingPlanV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateRulesInTrackingPlanV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateRulesInTrackingPlanV1Input read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateRulesInTrackingPlanV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateRulesInTrackingPlanV1Input + * @throws IOException if the JSON string is invalid with respect to + * UpdateRulesInTrackingPlanV1Input + */ + public static UpdateRulesInTrackingPlanV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateRulesInTrackingPlanV1Input.class); } - } - - /** - * Create an instance of UpdateRulesInTrackingPlanV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateRulesInTrackingPlanV1Input - * @throws IOException if the JSON string is invalid with respect to UpdateRulesInTrackingPlanV1Input - */ - public static UpdateRulesInTrackingPlanV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateRulesInTrackingPlanV1Input.class); - } - - /** - * Convert an instance of UpdateRulesInTrackingPlanV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateRulesInTrackingPlanV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateRulesInTrackingPlanV1Output.java b/src/main/java/com/segment/publicapi/models/UpdateRulesInTrackingPlanV1Output.java index 7291c755..68a8eb42 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateRulesInTrackingPlanV1Output.java +++ b/src/main/java/com/segment/publicapi/models/UpdateRulesInTrackingPlanV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,251 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Updates Tracking Plan rules. Non-existent rules are added. - */ -@ApiModel(description = "Updates Tracking Plan rules. Non-existent rules are added.") - +/** Updates Tracking Plan rules. Non-existent rules are added. */ public class UpdateRulesInTrackingPlanV1Output { - /** - * The operation status. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The operation status. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public UpdateRulesInTrackingPlanV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public UpdateRulesInTrackingPlanV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public UpdateRulesInTrackingPlanV1Output() {} - /** - * The operation status. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The operation status.") + public UpdateRulesInTrackingPlanV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The operation status. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + UpdateRulesInTrackingPlanV1Output updateRulesInTrackingPlanV1Output = + (UpdateRulesInTrackingPlanV1Output) o; + return Objects.equals(this.status, updateRulesInTrackingPlanV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateRulesInTrackingPlanV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateRulesInTrackingPlanV1Output updateRulesInTrackingPlanV1Output = (UpdateRulesInTrackingPlanV1Output) o; - return Objects.equals(this.status, updateRulesInTrackingPlanV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateRulesInTrackingPlanV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateRulesInTrackingPlanV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateRulesInTrackingPlanV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateRulesInTrackingPlanV1Output is not found in the empty JSON string", UpdateRulesInTrackingPlanV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateRulesInTrackingPlanV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateRulesInTrackingPlanV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateRulesInTrackingPlanV1Output is" + + " not found in the empty JSON string", + UpdateRulesInTrackingPlanV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateRulesInTrackingPlanV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateRulesInTrackingPlanV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateRulesInTrackingPlanV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateRulesInTrackingPlanV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateRulesInTrackingPlanV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateRulesInTrackingPlanV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!UpdateRulesInTrackingPlanV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateRulesInTrackingPlanV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateRulesInTrackingPlanV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateRulesInTrackingPlanV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateRulesInTrackingPlanV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of UpdateRulesInTrackingPlanV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateRulesInTrackingPlanV1Output - * @throws IOException if the JSON string is invalid with respect to UpdateRulesInTrackingPlanV1Output - */ - public static UpdateRulesInTrackingPlanV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateRulesInTrackingPlanV1Output.class); - } - - /** - * Convert an instance of UpdateRulesInTrackingPlanV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateRulesInTrackingPlanV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateRulesInTrackingPlanV1Output' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateRulesInTrackingPlanV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateRulesInTrackingPlanV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateRulesInTrackingPlanV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateRulesInTrackingPlanV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateRulesInTrackingPlanV1Output + * @throws IOException if the JSON string is invalid with respect to + * UpdateRulesInTrackingPlanV1Output + */ + public static UpdateRulesInTrackingPlanV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateRulesInTrackingPlanV1Output.class); + } + + /** + * Convert an instance of UpdateRulesInTrackingPlanV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSchemaSettingsInSource200Response.java b/src/main/java/com/segment/publicapi/models/UpdateSchemaSettingsInSource200Response.java index 5d834d77..61b1ff19 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSchemaSettingsInSource200Response.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSchemaSettingsInSource200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,197 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateSchemaSettingsInSourceV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateSchemaSettingsInSource200Response - */ - +/** UpdateSchemaSettingsInSource200Response */ public class UpdateSchemaSettingsInSource200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateSchemaSettingsInSourceV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateSchemaSettingsInSource200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateSchemaSettingsInSourceV1Output data; - public UpdateSchemaSettingsInSource200Response data(UpdateSchemaSettingsInSourceV1Output data) { - - this.data = data; - return this; - } + public UpdateSchemaSettingsInSource200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateSchemaSettingsInSource200Response data(UpdateSchemaSettingsInSourceV1Output data) { - public UpdateSchemaSettingsInSourceV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateSchemaSettingsInSourceV1Output getData() { + return data; + } - public void setData(UpdateSchemaSettingsInSourceV1Output data) { - this.data = data; - } + public void setData(UpdateSchemaSettingsInSourceV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSchemaSettingsInSource200Response updateSchemaSettingsInSource200Response = + (UpdateSchemaSettingsInSource200Response) o; + return Objects.equals(this.data, updateSchemaSettingsInSource200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSchemaSettingsInSource200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSchemaSettingsInSource200Response updateSchemaSettingsInSource200Response = (UpdateSchemaSettingsInSource200Response) o; - return Objects.equals(this.data, updateSchemaSettingsInSource200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSchemaSettingsInSource200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSchemaSettingsInSource200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSchemaSettingsInSource200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSchemaSettingsInSource200Response is not found in the empty JSON string", UpdateSchemaSettingsInSource200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateSchemaSettingsInSource200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSchemaSettingsInSource200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateSchemaSettingsInSource200Response is not found in the" + + " empty JSON string", + UpdateSchemaSettingsInSource200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSchemaSettingsInSource200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSchemaSettingsInSource200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSchemaSettingsInSource200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSchemaSettingsInSource200Response` 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()) { + UpdateSchemaSettingsInSourceV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSchemaSettingsInSource200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSchemaSettingsInSource200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSchemaSettingsInSource200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSchemaSettingsInSource200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSchemaSettingsInSource200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSchemaSettingsInSource200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'UpdateSchemaSettingsInSource200Response' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateSchemaSettingsInSource200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateSchemaSettingsInSource200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSchemaSettingsInSource200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSchemaSettingsInSource200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSchemaSettingsInSource200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateSchemaSettingsInSource200Response + */ + public static UpdateSchemaSettingsInSource200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSchemaSettingsInSource200Response.class); } - } - - /** - * Create an instance of UpdateSchemaSettingsInSource200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSchemaSettingsInSource200Response - * @throws IOException if the JSON string is invalid with respect to UpdateSchemaSettingsInSource200Response - */ - public static UpdateSchemaSettingsInSource200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSchemaSettingsInSource200Response.class); - } - - /** - * Convert an instance of UpdateSchemaSettingsInSource200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateSchemaSettingsInSource200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSchemaSettingsInSourceV1Input.java b/src/main/java/com/segment/publicapi/models/UpdateSchemaSettingsInSourceV1Input.java index cbb3546a..a6c02ab8 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSchemaSettingsInSourceV1Input.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSchemaSettingsInSourceV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,326 +9,343 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Group; -import com.segment.publicapi.models.Identify; -import com.segment.publicapi.models.Track; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Input to update a Source's settings. */ +public class UpdateSchemaSettingsInSourceV1Input { + public static final String SERIALIZED_NAME_TRACK = "track"; -/** - * Input to update a Source's settings. - */ -@ApiModel(description = "Input to update a Source's settings.") + @SerializedName(SERIALIZED_NAME_TRACK) + private TrackSourceSettingsV1 track; -public class UpdateSchemaSettingsInSourceV1Input { - public static final String SERIALIZED_NAME_TRACK = "track"; - @SerializedName(SERIALIZED_NAME_TRACK) - private Track track; - - public static final String SERIALIZED_NAME_IDENTIFY = "identify"; - @SerializedName(SERIALIZED_NAME_IDENTIFY) - private Identify identify; - - public static final String SERIALIZED_NAME_GROUP = "group"; - @SerializedName(SERIALIZED_NAME_GROUP) - private Group group; + public static final String SERIALIZED_NAME_IDENTIFY = "identify"; - public static final String SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO = "forwardingViolationsTo"; - @SerializedName(SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO) - private String forwardingViolationsTo; + @SerializedName(SERIALIZED_NAME_IDENTIFY) + private IdentifySourceSettingsV1 identify; - public static final String SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO = "forwardingBlockedEventsTo"; - @SerializedName(SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO) - private String forwardingBlockedEventsTo; + public static final String SERIALIZED_NAME_GROUP = "group"; - public UpdateSchemaSettingsInSourceV1Input() { - } + @SerializedName(SERIALIZED_NAME_GROUP) + private GroupSourceSettingsV1 group; - public UpdateSchemaSettingsInSourceV1Input track(Track track) { - - this.track = track; - return this; - } + public static final String SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO = "forwardingViolationsTo"; - /** - * Get track - * @return track - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + @SerializedName(SERIALIZED_NAME_FORWARDING_VIOLATIONS_TO) + private String forwardingViolationsTo; - public Track getTrack() { - return track; - } + public static final String SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO = + "forwardingBlockedEventsTo"; + @SerializedName(SERIALIZED_NAME_FORWARDING_BLOCKED_EVENTS_TO) + private String forwardingBlockedEventsTo; - public void setTrack(Track track) { - this.track = track; - } + public UpdateSchemaSettingsInSourceV1Input() {} + public UpdateSchemaSettingsInSourceV1Input track(TrackSourceSettingsV1 track) { - public UpdateSchemaSettingsInSourceV1Input identify(Identify identify) { - - this.identify = identify; - return this; - } + this.track = track; + return this; + } - /** - * Get identify - * @return identify - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + /** + * Get track + * + * @return track + */ + @javax.annotation.Nullable + public TrackSourceSettingsV1 getTrack() { + return track; + } - public Identify getIdentify() { - return identify; - } + public void setTrack(TrackSourceSettingsV1 track) { + this.track = track; + } + public UpdateSchemaSettingsInSourceV1Input identify(IdentifySourceSettingsV1 identify) { - public void setIdentify(Identify identify) { - this.identify = identify; - } + this.identify = identify; + return this; + } + /** + * Get identify + * + * @return identify + */ + @javax.annotation.Nullable + public IdentifySourceSettingsV1 getIdentify() { + return identify; + } + + public void setIdentify(IdentifySourceSettingsV1 identify) { + this.identify = identify; + } - public UpdateSchemaSettingsInSourceV1Input group(Group group) { - - this.group = group; - return this; - } + public UpdateSchemaSettingsInSourceV1Input group(GroupSourceSettingsV1 group) { - /** - * Get group - * @return group - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + this.group = group; + return this; + } - public Group getGroup() { - return group; - } + /** + * Get group + * + * @return group + */ + @javax.annotation.Nullable + public GroupSourceSettingsV1 getGroup() { + return group; + } + + public void setGroup(GroupSourceSettingsV1 group) { + this.group = group; + } + public UpdateSchemaSettingsInSourceV1Input forwardingViolationsTo( + String forwardingViolationsTo) { - public void setGroup(Group group) { - this.group = group; - } + this.forwardingViolationsTo = forwardingViolationsTo; + return this; + } + /** + * Source id to forward violations to. + * + * @return forwardingViolationsTo + */ + @javax.annotation.Nullable + public String getForwardingViolationsTo() { + return forwardingViolationsTo; + } - public UpdateSchemaSettingsInSourceV1Input forwardingViolationsTo(String forwardingViolationsTo) { - - this.forwardingViolationsTo = forwardingViolationsTo; - return this; - } + public void setForwardingViolationsTo(String forwardingViolationsTo) { + this.forwardingViolationsTo = forwardingViolationsTo; + } - /** - * Source id to forward violations to. - * @return forwardingViolationsTo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Source id to forward violations to.") + public UpdateSchemaSettingsInSourceV1Input forwardingBlockedEventsTo( + String forwardingBlockedEventsTo) { - public String getForwardingViolationsTo() { - return forwardingViolationsTo; - } + this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; + return this; + } + /** + * Source id to forward blocked events to. + * + * @return forwardingBlockedEventsTo + */ + @javax.annotation.Nullable + public String getForwardingBlockedEventsTo() { + return forwardingBlockedEventsTo; + } - public void setForwardingViolationsTo(String forwardingViolationsTo) { - this.forwardingViolationsTo = forwardingViolationsTo; - } + public void setForwardingBlockedEventsTo(String forwardingBlockedEventsTo) { + this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input = + (UpdateSchemaSettingsInSourceV1Input) o; + return Objects.equals(this.track, updateSchemaSettingsInSourceV1Input.track) + && Objects.equals(this.identify, updateSchemaSettingsInSourceV1Input.identify) + && Objects.equals(this.group, updateSchemaSettingsInSourceV1Input.group) + && Objects.equals( + this.forwardingViolationsTo, + updateSchemaSettingsInSourceV1Input.forwardingViolationsTo) + && Objects.equals( + this.forwardingBlockedEventsTo, + updateSchemaSettingsInSourceV1Input.forwardingBlockedEventsTo); + } - public UpdateSchemaSettingsInSourceV1Input forwardingBlockedEventsTo(String forwardingBlockedEventsTo) { - - this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; - return this; - } + @Override + public int hashCode() { + return Objects.hash( + track, identify, group, forwardingViolationsTo, forwardingBlockedEventsTo); + } - /** - * Source id to forward blocked events to. - * @return forwardingBlockedEventsTo - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Source id to forward blocked events to.") + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSchemaSettingsInSourceV1Input {\n"); + sb.append(" track: ").append(toIndentedString(track)).append("\n"); + sb.append(" identify: ").append(toIndentedString(identify)).append("\n"); + sb.append(" group: ").append(toIndentedString(group)).append("\n"); + sb.append(" forwardingViolationsTo: ") + .append(toIndentedString(forwardingViolationsTo)) + .append("\n"); + sb.append(" forwardingBlockedEventsTo: ") + .append(toIndentedString(forwardingBlockedEventsTo)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } - public String getForwardingBlockedEventsTo() { - return forwardingBlockedEventsTo; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public void setForwardingBlockedEventsTo(String forwardingBlockedEventsTo) { - this.forwardingBlockedEventsTo = forwardingBlockedEventsTo; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("track"); + openapiFields.add("identify"); + openapiFields.add("group"); + openapiFields.add("forwardingViolationsTo"); + openapiFields.add("forwardingBlockedEventsTo"); + // 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 + * UpdateSchemaSettingsInSourceV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSchemaSettingsInSourceV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateSchemaSettingsInSourceV1Input is" + + " not found in the empty JSON string", + UpdateSchemaSettingsInSourceV1Input.openapiRequiredFields + .toString())); + } + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSchemaSettingsInSourceV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSchemaSettingsInSourceV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `track` + if (jsonObj.get("track") != null && !jsonObj.get("track").isJsonNull()) { + TrackSourceSettingsV1.validateJsonElement(jsonObj.get("track")); + } + // validate the optional field `identify` + if (jsonObj.get("identify") != null && !jsonObj.get("identify").isJsonNull()) { + IdentifySourceSettingsV1.validateJsonElement(jsonObj.get("identify")); + } + // validate the optional field `group` + if (jsonObj.get("group") != null && !jsonObj.get("group").isJsonNull()) { + GroupSourceSettingsV1.validateJsonElement(jsonObj.get("group")); + } + if ((jsonObj.get("forwardingViolationsTo") != null + && !jsonObj.get("forwardingViolationsTo").isJsonNull()) + && !jsonObj.get("forwardingViolationsTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `forwardingViolationsTo` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("forwardingViolationsTo").toString())); + } + if ((jsonObj.get("forwardingBlockedEventsTo") != null + && !jsonObj.get("forwardingBlockedEventsTo").isJsonNull()) + && !jsonObj.get("forwardingBlockedEventsTo").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `forwardingBlockedEventsTo` to be a primitive type" + + " in the JSON string but got `%s`", + jsonObj.get("forwardingBlockedEventsTo").toString())); + } } - if (o == null || getClass() != o.getClass()) { - return false; + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSchemaSettingsInSourceV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSchemaSettingsInSourceV1Input' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateSchemaSettingsInSourceV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSchemaSettingsInSourceV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSchemaSettingsInSourceV1Input read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } } - UpdateSchemaSettingsInSourceV1Input updateSchemaSettingsInSourceV1Input = (UpdateSchemaSettingsInSourceV1Input) o; - return Objects.equals(this.track, updateSchemaSettingsInSourceV1Input.track) && - Objects.equals(this.identify, updateSchemaSettingsInSourceV1Input.identify) && - Objects.equals(this.group, updateSchemaSettingsInSourceV1Input.group) && - Objects.equals(this.forwardingViolationsTo, updateSchemaSettingsInSourceV1Input.forwardingViolationsTo) && - Objects.equals(this.forwardingBlockedEventsTo, updateSchemaSettingsInSourceV1Input.forwardingBlockedEventsTo); - } - - @Override - public int hashCode() { - return Objects.hash(track, identify, group, forwardingViolationsTo, forwardingBlockedEventsTo); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSchemaSettingsInSourceV1Input {\n"); - sb.append(" track: ").append(toIndentedString(track)).append("\n"); - sb.append(" identify: ").append(toIndentedString(identify)).append("\n"); - sb.append(" group: ").append(toIndentedString(group)).append("\n"); - sb.append(" forwardingViolationsTo: ").append(toIndentedString(forwardingViolationsTo)).append("\n"); - sb.append(" forwardingBlockedEventsTo: ").append(toIndentedString(forwardingBlockedEventsTo)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + /** + * Create an instance of UpdateSchemaSettingsInSourceV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSchemaSettingsInSourceV1Input + * @throws IOException if the JSON string is invalid with respect to + * UpdateSchemaSettingsInSourceV1Input + */ + public static UpdateSchemaSettingsInSourceV1Input fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSchemaSettingsInSourceV1Input.class); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("track"); - openapiFields.add("identify"); - openapiFields.add("group"); - openapiFields.add("forwardingViolationsTo"); - openapiFields.add("forwardingBlockedEventsTo"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSchemaSettingsInSourceV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSchemaSettingsInSourceV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSchemaSettingsInSourceV1Input is not found in the empty JSON string", UpdateSchemaSettingsInSourceV1Input.openapiRequiredFields.toString())); - } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSchemaSettingsInSourceV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSchemaSettingsInSourceV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - if ((jsonObj.get("forwardingViolationsTo") != null && !jsonObj.get("forwardingViolationsTo").isJsonNull()) && !jsonObj.get("forwardingViolationsTo").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `forwardingViolationsTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("forwardingViolationsTo").toString())); - } - if ((jsonObj.get("forwardingBlockedEventsTo") != null && !jsonObj.get("forwardingBlockedEventsTo").isJsonNull()) && !jsonObj.get("forwardingBlockedEventsTo").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `forwardingBlockedEventsTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("forwardingBlockedEventsTo").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSchemaSettingsInSourceV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSchemaSettingsInSourceV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSchemaSettingsInSourceV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSchemaSettingsInSourceV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSchemaSettingsInSourceV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + /** + * Convert an instance of UpdateSchemaSettingsInSourceV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); } - } - - /** - * Create an instance of UpdateSchemaSettingsInSourceV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSchemaSettingsInSourceV1Input - * @throws IOException if the JSON string is invalid with respect to UpdateSchemaSettingsInSourceV1Input - */ - public static UpdateSchemaSettingsInSourceV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSchemaSettingsInSourceV1Input.class); - } - - /** - * Convert an instance of UpdateSchemaSettingsInSourceV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } } - diff --git a/src/main/java/com/segment/publicapi/models/UpdateSchemaSettingsInSourceV1Output.java b/src/main/java/com/segment/publicapi/models/UpdateSchemaSettingsInSourceV1Output.java index cc6dc8fd..896f610c 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSchemaSettingsInSourceV1Output.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSchemaSettingsInSourceV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,240 +9,241 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Settings1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Output of the Source with updated settings. - */ -@ApiModel(description = "Output of the Source with updated settings.") - +/** Output of the Source with updated settings. */ public class UpdateSchemaSettingsInSourceV1Output { - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Settings1 settings; + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - public UpdateSchemaSettingsInSourceV1Output() { - } + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; - public UpdateSchemaSettingsInSourceV1Output sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - /** - * The id of the updated Source. Config API note: analogous to `parent` and `name`. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the updated Source. Config API note: analogous to `parent` and `name`.") + @SerializedName(SERIALIZED_NAME_SETTINGS) + private SourceSettingsOutputV1 settings; - public String getSourceId() { - return sourceId; - } + public UpdateSchemaSettingsInSourceV1Output() {} + public UpdateSchemaSettingsInSourceV1Output sourceId(String sourceId) { - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + this.sourceId = sourceId; + return this; + } + /** + * The id of the updated Source. Config API note: analogous to `parent` and + * `name`. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } - public UpdateSchemaSettingsInSourceV1Output settings(Settings1 settings) { - - this.settings = settings; - return this; - } + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } - /** - * Get settings - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public UpdateSchemaSettingsInSourceV1Output settings(SourceSettingsOutputV1 settings) { - public Settings1 getSettings() { - return settings; - } + this.settings = settings; + return this; + } + /** + * Get settings + * + * @return settings + */ + @javax.annotation.Nonnull + public SourceSettingsOutputV1 getSettings() { + return settings; + } - public void setSettings(Settings1 settings) { - this.settings = settings; - } + public void setSettings(SourceSettingsOutputV1 settings) { + this.settings = settings; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSchemaSettingsInSourceV1Output updateSchemaSettingsInSourceV1Output = + (UpdateSchemaSettingsInSourceV1Output) o; + return Objects.equals(this.sourceId, updateSchemaSettingsInSourceV1Output.sourceId) + && Objects.equals(this.settings, updateSchemaSettingsInSourceV1Output.settings); + } + @Override + public int hashCode() { + return Objects.hash(sourceId, settings); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSchemaSettingsInSourceV1Output {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSchemaSettingsInSourceV1Output updateSchemaSettingsInSourceV1Output = (UpdateSchemaSettingsInSourceV1Output) o; - return Objects.equals(this.sourceId, updateSchemaSettingsInSourceV1Output.sourceId) && - Objects.equals(this.settings, updateSchemaSettingsInSourceV1Output.settings); - } - - @Override - public int hashCode() { - return Objects.hash(sourceId, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSchemaSettingsInSourceV1Output {\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + openapiFields.add("settings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("settings"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourceId"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("settings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSchemaSettingsInSourceV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSchemaSettingsInSourceV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSchemaSettingsInSourceV1Output is not found in the empty JSON string", UpdateSchemaSettingsInSourceV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateSchemaSettingsInSourceV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSchemaSettingsInSourceV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateSchemaSettingsInSourceV1Output" + + " is not found in the empty JSON string", + UpdateSchemaSettingsInSourceV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSchemaSettingsInSourceV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSchemaSettingsInSourceV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSchemaSettingsInSourceV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSchemaSettingsInSourceV1Output` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateSchemaSettingsInSourceV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSchemaSettingsInSourceV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } } - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSchemaSettingsInSourceV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSchemaSettingsInSourceV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSchemaSettingsInSourceV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSchemaSettingsInSourceV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSchemaSettingsInSourceV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + // validate the required field `settings` + SourceSettingsOutputV1.validateJsonElement(jsonObj.get("settings")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSchemaSettingsInSourceV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSchemaSettingsInSourceV1Output' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateSchemaSettingsInSourceV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateSchemaSettingsInSourceV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSchemaSettingsInSourceV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSchemaSettingsInSourceV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSchemaSettingsInSourceV1Output + * @throws IOException if the JSON string is invalid with respect to + * UpdateSchemaSettingsInSourceV1Output + */ + public static UpdateSchemaSettingsInSourceV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSchemaSettingsInSourceV1Output.class); } - } - - /** - * Create an instance of UpdateSchemaSettingsInSourceV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSchemaSettingsInSourceV1Output - * @throws IOException if the JSON string is invalid with respect to UpdateSchemaSettingsInSourceV1Output - */ - public static UpdateSchemaSettingsInSourceV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSchemaSettingsInSourceV1Output.class); - } - - /** - * Convert an instance of UpdateSchemaSettingsInSourceV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateSchemaSettingsInSourceV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouse200Response.java b/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouse200Response.java index 6a49848a..c5f6a5ae 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouse200Response.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouse200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,200 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateSelectiveSyncForWarehouseV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateSelectiveSyncForWarehouse200Response - */ - +/** UpdateSelectiveSyncForWarehouse200Response */ public class UpdateSelectiveSyncForWarehouse200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateSelectiveSyncForWarehouseV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateSelectiveSyncForWarehouse200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateSelectiveSyncForWarehouseV1Output data; - public UpdateSelectiveSyncForWarehouse200Response data(UpdateSelectiveSyncForWarehouseV1Output data) { - - this.data = data; - return this; - } + public UpdateSelectiveSyncForWarehouse200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateSelectiveSyncForWarehouse200Response data( + UpdateSelectiveSyncForWarehouseV1Output data) { - public UpdateSelectiveSyncForWarehouseV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateSelectiveSyncForWarehouseV1Output getData() { + return data; + } - public void setData(UpdateSelectiveSyncForWarehouseV1Output data) { - this.data = data; - } + public void setData(UpdateSelectiveSyncForWarehouseV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSelectiveSyncForWarehouse200Response updateSelectiveSyncForWarehouse200Response = + (UpdateSelectiveSyncForWarehouse200Response) o; + return Objects.equals(this.data, updateSelectiveSyncForWarehouse200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSelectiveSyncForWarehouse200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSelectiveSyncForWarehouse200Response updateSelectiveSyncForWarehouse200Response = (UpdateSelectiveSyncForWarehouse200Response) o; - return Objects.equals(this.data, updateSelectiveSyncForWarehouse200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSelectiveSyncForWarehouse200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSelectiveSyncForWarehouse200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSelectiveSyncForWarehouse200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSelectiveSyncForWarehouse200Response is not found in the empty JSON string", UpdateSelectiveSyncForWarehouse200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateSelectiveSyncForWarehouse200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSelectiveSyncForWarehouse200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateSelectiveSyncForWarehouse200Response is not found in" + + " the empty JSON string", + UpdateSelectiveSyncForWarehouse200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSelectiveSyncForWarehouse200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSelectiveSyncForWarehouse200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSelectiveSyncForWarehouse200Response.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSelectiveSyncForWarehouse200Response` 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()) { + UpdateSelectiveSyncForWarehouseV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSelectiveSyncForWarehouse200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSelectiveSyncForWarehouse200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSelectiveSyncForWarehouse200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSelectiveSyncForWarehouse200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSelectiveSyncForWarehouse200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSelectiveSyncForWarehouse200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'UpdateSelectiveSyncForWarehouse200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateSelectiveSyncForWarehouse200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateSelectiveSyncForWarehouse200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSelectiveSyncForWarehouse200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSelectiveSyncForWarehouse200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSelectiveSyncForWarehouse200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateSelectiveSyncForWarehouse200Response + */ + public static UpdateSelectiveSyncForWarehouse200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, UpdateSelectiveSyncForWarehouse200Response.class); } - } - - /** - * Create an instance of UpdateSelectiveSyncForWarehouse200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSelectiveSyncForWarehouse200Response - * @throws IOException if the JSON string is invalid with respect to UpdateSelectiveSyncForWarehouse200Response - */ - public static UpdateSelectiveSyncForWarehouse200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSelectiveSyncForWarehouse200Response.class); - } - - /** - * Convert an instance of UpdateSelectiveSyncForWarehouse200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateSelectiveSyncForWarehouse200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseAndSpace200Response.java b/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseAndSpace200Response.java new file mode 100644 index 00000000..69dc40dd --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseAndSpace200Response.java @@ -0,0 +1,215 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** UpdateSelectiveSyncForWarehouseAndSpace200Response */ +public class UpdateSelectiveSyncForWarehouseAndSpace200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput data; + + public UpdateSelectiveSyncForWarehouseAndSpace200Response() {} + + public UpdateSelectiveSyncForWarehouseAndSpace200Response data( + UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput data) { + + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput getData() { + return data; + } + + public void setData(UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSelectiveSyncForWarehouseAndSpace200Response + updateSelectiveSyncForWarehouseAndSpace200Response = + (UpdateSelectiveSyncForWarehouseAndSpace200Response) o; + return Objects.equals(this.data, updateSelectiveSyncForWarehouseAndSpace200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSelectiveSyncForWarehouseAndSpace200Response {\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 + * UpdateSelectiveSyncForWarehouseAndSpace200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSelectiveSyncForWarehouseAndSpace200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateSelectiveSyncForWarehouseAndSpace200Response is not" + + " found in the empty JSON string", + UpdateSelectiveSyncForWarehouseAndSpace200Response + .openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSelectiveSyncForWarehouseAndSpace200Response.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSelectiveSyncForWarehouseAndSpace200Response`" + + " 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()) { + UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput.validateJsonElement( + jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSelectiveSyncForWarehouseAndSpace200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'UpdateSelectiveSyncForWarehouseAndSpace200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + UpdateSelectiveSyncForWarehouseAndSpace200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + UpdateSelectiveSyncForWarehouseAndSpace200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSelectiveSyncForWarehouseAndSpace200Response read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSelectiveSyncForWarehouseAndSpace200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSelectiveSyncForWarehouseAndSpace200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateSelectiveSyncForWarehouseAndSpace200Response + */ + public static UpdateSelectiveSyncForWarehouseAndSpace200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, UpdateSelectiveSyncForWarehouseAndSpace200Response.class); + } + + /** + * Convert an instance of UpdateSelectiveSyncForWarehouseAndSpace200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput.java b/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput.java new file mode 100644 index 00000000..2f439a98 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput.java @@ -0,0 +1,275 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Updates the schema for a Space Warehouse connection. */ +public class UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput { + public static final String SERIALIZED_NAME_SYNC_OVERRIDES = "syncOverrides"; + + @SerializedName(SERIALIZED_NAME_SYNC_OVERRIDES) + private List syncOverrides; + + public static final String SERIALIZED_NAME_ENABLE_EVENT_TABLES = "enableEventTables"; + + @SerializedName(SERIALIZED_NAME_ENABLE_EVENT_TABLES) + private Boolean enableEventTables; + + public UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput() {} + + public UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput syncOverrides( + List syncOverrides) { + + this.syncOverrides = syncOverrides; + return this; + } + + public UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput addSyncOverridesItem( + SpaceWarehouseSchemaOverride syncOverridesItem) { + if (this.syncOverrides == null) { + this.syncOverrides = new ArrayList<>(); + } + this.syncOverrides.add(syncOverridesItem); + return this; + } + + /** + * A list of sync Schema overrides to apply to this Space Warehouse. Note: Selective Sync is not + * supported if the enableEventTables flag is false. + * + * @return syncOverrides + */ + @javax.annotation.Nullable + public List getSyncOverrides() { + return syncOverrides; + } + + public void setSyncOverrides(List syncOverrides) { + this.syncOverrides = syncOverrides; + } + + public UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput enableEventTables( + Boolean enableEventTables) { + + this.enableEventTables = enableEventTables; + return this; + } + + /** + * A flag to enable or disable all event Tables. This field is optional. + * + * @return enableEventTables + */ + @javax.annotation.Nullable + public Boolean getEnableEventTables() { + return enableEventTables; + } + + public void setEnableEventTables(Boolean enableEventTables) { + this.enableEventTables = enableEventTables; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput + updateSelectiveSyncForWarehouseAndSpaceAlphaInput = + (UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput) o; + return Objects.equals( + this.syncOverrides, + updateSelectiveSyncForWarehouseAndSpaceAlphaInput.syncOverrides) + && Objects.equals( + this.enableEventTables, + updateSelectiveSyncForWarehouseAndSpaceAlphaInput.enableEventTables); + } + + @Override + public int hashCode() { + return Objects.hash(syncOverrides, enableEventTables); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput {\n"); + sb.append(" syncOverrides: ").append(toIndentedString(syncOverrides)).append("\n"); + sb.append(" enableEventTables: ") + .append(toIndentedString(enableEventTables)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("syncOverrides"); + openapiFields.add("enableEventTables"); + + // 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 + * UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput is not" + + " found in the empty JSON string", + UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput + .openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("syncOverrides") != null && !jsonObj.get("syncOverrides").isJsonNull()) { + JsonArray jsonArraysyncOverrides = jsonObj.getAsJsonArray("syncOverrides"); + if (jsonArraysyncOverrides != null) { + // ensure the json data is an array + if (!jsonObj.get("syncOverrides").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `syncOverrides` to be an array in the JSON" + + " string but got `%s`", + jsonObj.get("syncOverrides").toString())); + } + + // validate the optional field `syncOverrides` (array) + for (int i = 0; i < jsonArraysyncOverrides.size(); i++) { + SpaceWarehouseSchemaOverride.validateJsonElement(jsonArraysyncOverrides.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get(UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput + */ + public static UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput.class); + } + + /** + * Convert an instance of UpdateSelectiveSyncForWarehouseAndSpaceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput.java new file mode 100644 index 00000000..eb4c1718 --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput.java @@ -0,0 +1,276 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Results from a SelectiveSync patch to a Space Warehouse connection. */ +public class UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput { + /** Status of the update operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + UNCHANGED("UNCHANGED"), + + UPDATED("UPDATED"); + + 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 UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput() {} + + public UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Status of the update operation. + * + * @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; + } + UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput + updateSelectiveSyncForWarehouseAndSpaceAlphaOutput = + (UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput) o; + return Objects.equals( + this.status, updateSelectiveSyncForWarehouseAndSpaceAlphaOutput.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput {\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(); + 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 + * UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput is not" + + " found in the empty JSON string", + UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput + .openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, + TypeToken.get( + UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, + UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput read( + JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput + */ + public static UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput.class); + } + + /** + * Convert an instance of UpdateSelectiveSyncForWarehouseAndSpaceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseV1Input.java b/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseV1Input.java index c9c044be..9bc694de 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseV1Input.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,217 +9,231 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.WarehouseSyncOverrideV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Updates the schema for a Warehouse/sources pair. */ +public class UpdateSelectiveSyncForWarehouseV1Input { + public static final String SERIALIZED_NAME_SYNC_OVERRIDES = "syncOverrides"; -/** - * Updates the schema for a Warehouse/sources pair. - */ -@ApiModel(description = "Updates the schema for a Warehouse/sources pair.") + @SerializedName(SERIALIZED_NAME_SYNC_OVERRIDES) + private List syncOverrides = new ArrayList<>(); -public class UpdateSelectiveSyncForWarehouseV1Input { - public static final String SERIALIZED_NAME_SYNC_OVERRIDES = "syncOverrides"; - @SerializedName(SERIALIZED_NAME_SYNC_OVERRIDES) - private List syncOverrides = null; - - public UpdateSelectiveSyncForWarehouseV1Input() { - } - - public UpdateSelectiveSyncForWarehouseV1Input syncOverrides(List syncOverrides) { - - this.syncOverrides = syncOverrides; - return this; - } - - public UpdateSelectiveSyncForWarehouseV1Input addSyncOverridesItem(WarehouseSyncOverrideV1 syncOverridesItem) { - if (this.syncOverrides == null) { - this.syncOverrides = new ArrayList<>(); - } - this.syncOverrides.add(syncOverridesItem); - return this; - } + public UpdateSelectiveSyncForWarehouseV1Input() {} - /** - * A list of sync schema overrides to apply to this Warehouse. - * @return syncOverrides - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A list of sync schema overrides to apply to this Warehouse.") + public UpdateSelectiveSyncForWarehouseV1Input syncOverrides( + List syncOverrides) { - public List getSyncOverrides() { - return syncOverrides; - } + this.syncOverrides = syncOverrides; + return this; + } + public UpdateSelectiveSyncForWarehouseV1Input addSyncOverridesItem( + WarehouseSyncOverrideV1 syncOverridesItem) { + if (this.syncOverrides == null) { + this.syncOverrides = new ArrayList<>(); + } + this.syncOverrides.add(syncOverridesItem); + return this; + } - public void setSyncOverrides(List syncOverrides) { - this.syncOverrides = syncOverrides; - } + /** + * A list of sync schema overrides to apply to this Warehouse. + * + * @return syncOverrides + */ + @javax.annotation.Nonnull + public List getSyncOverrides() { + return syncOverrides; + } + public void setSyncOverrides(List syncOverrides) { + this.syncOverrides = syncOverrides; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input = + (UpdateSelectiveSyncForWarehouseV1Input) o; + return Objects.equals( + this.syncOverrides, updateSelectiveSyncForWarehouseV1Input.syncOverrides); + } + + @Override + public int hashCode() { + return Objects.hash(syncOverrides); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSelectiveSyncForWarehouseV1Input {\n"); + sb.append(" syncOverrides: ").append(toIndentedString(syncOverrides)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSelectiveSyncForWarehouseV1Input updateSelectiveSyncForWarehouseV1Input = (UpdateSelectiveSyncForWarehouseV1Input) o; - return Objects.equals(this.syncOverrides, updateSelectiveSyncForWarehouseV1Input.syncOverrides); - } - - @Override - public int hashCode() { - return Objects.hash(syncOverrides); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSelectiveSyncForWarehouseV1Input {\n"); - sb.append(" syncOverrides: ").append(toIndentedString(syncOverrides)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("syncOverrides"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("syncOverrides"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("syncOverrides"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSelectiveSyncForWarehouseV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSelectiveSyncForWarehouseV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSelectiveSyncForWarehouseV1Input is not found in the empty JSON string", UpdateSelectiveSyncForWarehouseV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateSelectiveSyncForWarehouseV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSelectiveSyncForWarehouseV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateSelectiveSyncForWarehouseV1Input" + + " is not found in the empty JSON string", + UpdateSelectiveSyncForWarehouseV1Input.openapiRequiredFields + .toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSelectiveSyncForWarehouseV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSelectiveSyncForWarehouseV1Input` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSelectiveSyncForWarehouseV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSelectiveSyncForWarehouseV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSelectiveSyncForWarehouseV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("syncOverrides").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `syncOverrides` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("syncOverrides").toString())); } - } - if (jsonObj.get("syncOverrides") != null && !jsonObj.get("syncOverrides").isJsonNull()) { + JsonArray jsonArraysyncOverrides = jsonObj.getAsJsonArray("syncOverrides"); - if (jsonArraysyncOverrides != null) { - // ensure the json data is an array - if (!jsonObj.get("syncOverrides").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `syncOverrides` to be an array in the JSON string but got `%s`", jsonObj.get("syncOverrides").toString())); - } + // validate the required field `syncOverrides` (array) + for (int i = 0; i < jsonArraysyncOverrides.size(); i++) { + WarehouseSyncOverrideV1.validateJsonElement(jsonArraysyncOverrides.get(i)); } - } - } + ; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSelectiveSyncForWarehouseV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSelectiveSyncForWarehouseV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSelectiveSyncForWarehouseV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSelectiveSyncForWarehouseV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSelectiveSyncForWarehouseV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSelectiveSyncForWarehouseV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSelectiveSyncForWarehouseV1Input' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateSelectiveSyncForWarehouseV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateSelectiveSyncForWarehouseV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSelectiveSyncForWarehouseV1Input read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSelectiveSyncForWarehouseV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSelectiveSyncForWarehouseV1Input + * @throws IOException if the JSON string is invalid with respect to + * UpdateSelectiveSyncForWarehouseV1Input + */ + public static UpdateSelectiveSyncForWarehouseV1Input fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSelectiveSyncForWarehouseV1Input.class); } - } - - /** - * Create an instance of UpdateSelectiveSyncForWarehouseV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSelectiveSyncForWarehouseV1Input - * @throws IOException if the JSON string is invalid with respect to UpdateSelectiveSyncForWarehouseV1Input - */ - public static UpdateSelectiveSyncForWarehouseV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSelectiveSyncForWarehouseV1Input.class); - } - - /** - * Convert an instance of UpdateSelectiveSyncForWarehouseV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateSelectiveSyncForWarehouseV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseV1Output.java b/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseV1Output.java index 14d8a0f8..d51612ae 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseV1Output.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSelectiveSyncForWarehouseV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,299 +9,309 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Results from updating the schema for a Warehouse/source pair. */ +public class UpdateSelectiveSyncForWarehouseV1Output { + /** Status of the update operation. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + UNCHANGED("UNCHANGED"), -/** - * Results from updating the schema for a Warehouse/source pair. - */ -@ApiModel(description = "Results from updating the schema for a Warehouse/source pair.") + UPDATED("UPDATED"); -public class UpdateSelectiveSyncForWarehouseV1Output { - /** - * Status of the update operation. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - UNCHANGED("UNCHANGED"), - - UPDATED("UPDATED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } + private String value; - public String getValue() { - return value; - } + StatusEnum(String value) { + this.value = value; + } - @Override - public String toString() { - return String.valueOf(value); - } + public String getValue() { + return value; + } - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; + @Override + public String toString() { + return String.valueOf(value); } - } - 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 StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status; + 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_WARNINGS = "warnings"; - @SerializedName(SERIALIZED_NAME_WARNINGS) - private List warnings = new ArrayList<>(); + public static final String SERIALIZED_NAME_STATUS = "status"; - public UpdateSelectiveSyncForWarehouseV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public UpdateSelectiveSyncForWarehouseV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public static final String SERIALIZED_NAME_WARNINGS = "warnings"; - /** - * Status of the update operation. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Status of the update operation.") + @SerializedName(SERIALIZED_NAME_WARNINGS) + private List warnings = new ArrayList<>(); - public StatusEnum getStatus() { - return status; - } + public UpdateSelectiveSyncForWarehouseV1Output() {} + public UpdateSelectiveSyncForWarehouseV1Output status(StatusEnum status) { - public void setStatus(StatusEnum status) { - this.status = status; - } + this.status = status; + return this; + } + /** + * Status of the update operation. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public UpdateSelectiveSyncForWarehouseV1Output warnings(List warnings) { - - this.warnings = warnings; - return this; - } + public void setStatus(StatusEnum status) { + this.status = status; + } - public UpdateSelectiveSyncForWarehouseV1Output addWarningsItem(String warningsItem) { - this.warnings.add(warningsItem); - return this; - } + public UpdateSelectiveSyncForWarehouseV1Output warnings(List warnings) { - /** - * Warnings returned by the operation. - * @return warnings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Warnings returned by the operation.") + this.warnings = warnings; + return this; + } - public List getWarnings() { - return warnings; - } + public UpdateSelectiveSyncForWarehouseV1Output addWarningsItem(String warningsItem) { + if (this.warnings == null) { + this.warnings = new ArrayList<>(); + } + this.warnings.add(warningsItem); + return this; + } + /** + * Warnings returned by the operation. + * + * @return warnings + */ + @javax.annotation.Nonnull + public List getWarnings() { + return warnings; + } - public void setWarnings(List warnings) { - this.warnings = warnings; - } + public void setWarnings(List warnings) { + this.warnings = warnings; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSelectiveSyncForWarehouseV1Output updateSelectiveSyncForWarehouseV1Output = + (UpdateSelectiveSyncForWarehouseV1Output) o; + return Objects.equals(this.status, updateSelectiveSyncForWarehouseV1Output.status) + && Objects.equals(this.warnings, updateSelectiveSyncForWarehouseV1Output.warnings); + } + @Override + public int hashCode() { + return Objects.hash(status, warnings); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSelectiveSyncForWarehouseV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" warnings: ").append(toIndentedString(warnings)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSelectiveSyncForWarehouseV1Output updateSelectiveSyncForWarehouseV1Output = (UpdateSelectiveSyncForWarehouseV1Output) o; - return Objects.equals(this.status, updateSelectiveSyncForWarehouseV1Output.status) && - Objects.equals(this.warnings, updateSelectiveSyncForWarehouseV1Output.warnings); - } - - @Override - public int hashCode() { - return Objects.hash(status, warnings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSelectiveSyncForWarehouseV1Output {\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" warnings: ").append(toIndentedString(warnings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("warnings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("warnings"); } - return o.toString().replace("\n", "\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("warnings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("status"); - openapiRequiredFields.add("warnings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSelectiveSyncForWarehouseV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSelectiveSyncForWarehouseV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSelectiveSyncForWarehouseV1Output is not found in the empty JSON string", UpdateSelectiveSyncForWarehouseV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateSelectiveSyncForWarehouseV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSelectiveSyncForWarehouseV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateSelectiveSyncForWarehouseV1Output is not found in the" + + " empty JSON string", + UpdateSelectiveSyncForWarehouseV1Output.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSelectiveSyncForWarehouseV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSelectiveSyncForWarehouseV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSelectiveSyncForWarehouseV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSelectiveSyncForWarehouseV1Output` properties. JSON:" + + " %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateSelectiveSyncForWarehouseV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSelectiveSyncForWarehouseV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + // ensure the required json array is present + if (jsonObj.get("warnings") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got" + + " `null`"); + } else if (!jsonObj.get("warnings").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `warnings` to be an array in the JSON string but" + + " got `%s`", + jsonObj.get("warnings").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSelectiveSyncForWarehouseV1Output.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes 'UpdateSelectiveSyncForWarehouseV1Output' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateSelectiveSyncForWarehouseV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateSelectiveSyncForWarehouseV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSelectiveSyncForWarehouseV1Output read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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())); - } - // ensure the required json array is present - if (jsonObj.get("warnings") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("warnings").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `warnings` to be an array in the JSON string but got `%s`", jsonObj.get("warnings").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSelectiveSyncForWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSelectiveSyncForWarehouseV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSelectiveSyncForWarehouseV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSelectiveSyncForWarehouseV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSelectiveSyncForWarehouseV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of UpdateSelectiveSyncForWarehouseV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSelectiveSyncForWarehouseV1Output - * @throws IOException if the JSON string is invalid with respect to UpdateSelectiveSyncForWarehouseV1Output - */ - public static UpdateSelectiveSyncForWarehouseV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSelectiveSyncForWarehouseV1Output.class); - } - - /** - * Convert an instance of UpdateSelectiveSyncForWarehouseV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of UpdateSelectiveSyncForWarehouseV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSelectiveSyncForWarehouseV1Output + * @throws IOException if the JSON string is invalid with respect to + * UpdateSelectiveSyncForWarehouseV1Output + */ + public static UpdateSelectiveSyncForWarehouseV1Output fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSelectiveSyncForWarehouseV1Output.class); + } + + /** + * Convert an instance of UpdateSelectiveSyncForWarehouseV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSource200Response.java b/src/main/java/com/segment/publicapi/models/UpdateSource200Response.java index 8898664d..10c6f161 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSource200Response.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSource200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateSourceAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateSource200Response - */ - +/** UpdateSource200Response */ public class UpdateSource200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateSourceAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateSource200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateSourceV1Output data; - public UpdateSource200Response data(UpdateSourceAlphaOutput data) { - - this.data = data; - return this; - } + public UpdateSource200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateSource200Response data(UpdateSourceV1Output data) { - public UpdateSourceAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateSourceV1Output getData() { + return data; + } - public void setData(UpdateSourceAlphaOutput data) { - this.data = data; - } + public void setData(UpdateSourceV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSource200Response updateSource200Response = (UpdateSource200Response) o; + return Objects.equals(this.data, updateSource200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSource200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSource200Response updateSource200Response = (UpdateSource200Response) o; - return Objects.equals(this.data, updateSource200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSource200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSource200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSource200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSource200Response is not found in the empty JSON string", UpdateSource200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSource200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSource200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateSource200Response is not found" + + " in the empty JSON string", + UpdateSource200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSource200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSource200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSource200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSource200Response` 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()) { + UpdateSourceV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSource200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSource200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSource200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSource200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSource200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSource200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSource200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateSource200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSource200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSource200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSource200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSource200Response + * @throws IOException if the JSON string is invalid with respect to UpdateSource200Response + */ + public static UpdateSource200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSource200Response.class); } - } - - /** - * Create an instance of UpdateSource200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSource200Response - * @throws IOException if the JSON string is invalid with respect to UpdateSource200Response - */ - public static UpdateSource200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSource200Response.class); - } - - /** - * Convert an instance of UpdateSource200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateSource200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSource200Response1.java b/src/main/java/com/segment/publicapi/models/UpdateSource200Response1.java index 1cf72525..fb34e091 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSource200Response1.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSource200Response1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateSourceV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateSource200Response1 - */ - +/** UpdateSource200Response1 */ public class UpdateSource200Response1 { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateSourceV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateSource200Response1() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateSourceAlphaOutput data; - public UpdateSource200Response1 data(UpdateSourceV1Output data) { - - this.data = data; - return this; - } + public UpdateSource200Response1() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateSource200Response1 data(UpdateSourceAlphaOutput data) { - public UpdateSourceV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateSourceAlphaOutput getData() { + return data; + } - public void setData(UpdateSourceV1Output data) { - this.data = data; - } + public void setData(UpdateSourceAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSource200Response1 updateSource200Response1 = (UpdateSource200Response1) o; + return Objects.equals(this.data, updateSource200Response1.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSource200Response1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSource200Response1 updateSource200Response1 = (UpdateSource200Response1) o; - return Objects.equals(this.data, updateSource200Response1.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSource200Response1 {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSource200Response1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSource200Response1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSource200Response1 is not found in the empty JSON string", UpdateSource200Response1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSource200Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSource200Response1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateSource200Response1 is not found" + + " in the empty JSON string", + UpdateSource200Response1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSource200Response1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSource200Response1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSource200Response1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSource200Response1` 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()) { + UpdateSourceAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSource200Response1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSource200Response1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSource200Response1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSource200Response1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSource200Response1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSource200Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSource200Response1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateSource200Response1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSource200Response1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSource200Response1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSource200Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSource200Response1 + * @throws IOException if the JSON string is invalid with respect to UpdateSource200Response1 + */ + public static UpdateSource200Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSource200Response1.class); } - } - - /** - * Create an instance of UpdateSource200Response1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSource200Response1 - * @throws IOException if the JSON string is invalid with respect to UpdateSource200Response1 - */ - public static UpdateSource200Response1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSource200Response1.class); - } - - /** - * Convert an instance of UpdateSource200Response1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateSource200Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSourceAlphaInput.java b/src/main/java/com/segment/publicapi/models/UpdateSourceAlphaInput.java index 57e7da6b..d925e072 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSourceAlphaInput.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSourceAlphaInput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,294 +9,292 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Updates an existing Source based on a set of parameters. - */ -@ApiModel(description = "Updates an existing Source based on a set of parameters.") - +/** Updates an existing Source based on a set of parameters. */ public class UpdateSourceAlphaInput { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public UpdateSourceAlphaInput() { - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public UpdateSourceAlphaInput name(String name) { - - this.name = name; - return this; - } + public static final String SERIALIZED_NAME_SLUG = "slug"; - /** - * An optional human-readable name to associate with the Source. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An optional human-readable name to associate with the Source. Config API note: equal to `displayName`.") + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; - public String getName() { - return name; - } + public static final String SERIALIZED_NAME_SETTINGS = "settings"; + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; - public void setName(String name) { - this.name = name; - } + public UpdateSourceAlphaInput() {} + public UpdateSourceAlphaInput name(String name) { - public UpdateSourceAlphaInput enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Enable to allow the Source to send data. - * @return enabled - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow the Source to send data.") + this.name = name; + return this; + } - public Boolean getEnabled() { - return enabled; - } + /** + * An optional human-readable name to associate with the Source. Config API note: equal to + * `displayName`. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public UpdateSourceAlphaInput enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } - public UpdateSourceAlphaInput slug(String slug) { - - this.slug = slug; - return this; - } + /** + * Enable to allow the Source to send data. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } - /** - * The slug that identifies the Source. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The slug that identifies the Source. Config API note: equal to `name`.") + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public String getSlug() { - return slug; - } + public UpdateSourceAlphaInput slug(String slug) { + this.slug = slug; + return this; + } - public void setSlug(String slug) { - this.slug = slug; - } + /** + * The slug that identifies the Source. Config API note: equal to `name`. + * + * @return slug + */ + @javax.annotation.Nullable + public String getSlug() { + return slug; + } + public void setSlug(String slug) { + this.slug = slug; + } - public UpdateSourceAlphaInput settings(Map settings) { - - this.settings = settings; - return this; - } + public UpdateSourceAlphaInput settings(Map settings) { - /** - * A key-value object that contains instance-specific settings for the Source. Different kinds of Sources require different kinds of input. The settings input for a Source comes from the `options` object associated with this instance of a Source. You can find the full list of required settings by accessing the Sources catalog endpoint under `/catalog/sources`. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A key-value object that contains instance-specific settings for the Source. Different kinds of Sources require different kinds of input. The settings input for a Source comes from the `options` object associated with this instance of a Source. You can find the full list of required settings by accessing the Sources catalog endpoint under `/catalog/sources`.") + this.settings = settings; + return this; + } - public Map getSettings() { - return settings; - } + public UpdateSourceAlphaInput putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + /** + * A key-value object that contains instance-specific settings for a Source. The + * `options` field in the Source metadata defines the schema of this object. + * + * @return settings + */ + @javax.annotation.Nullable + public Map getSettings() { + return settings; + } - public void setSettings(Map settings) { - this.settings = settings; - } + public void setSettings(Map settings) { + this.settings = settings; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSourceAlphaInput updateSourceAlphaInput = (UpdateSourceAlphaInput) o; + return Objects.equals(this.name, updateSourceAlphaInput.name) + && Objects.equals(this.enabled, updateSourceAlphaInput.enabled) + && Objects.equals(this.slug, updateSourceAlphaInput.slug) + && Objects.equals(this.settings, updateSourceAlphaInput.settings); + } + @Override + public int hashCode() { + return Objects.hash(name, enabled, slug, settings); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSourceAlphaInput {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSourceAlphaInput updateSourceAlphaInput = (UpdateSourceAlphaInput) o; - return Objects.equals(this.name, updateSourceAlphaInput.name) && - Objects.equals(this.enabled, updateSourceAlphaInput.enabled) && - Objects.equals(this.slug, updateSourceAlphaInput.slug) && - Objects.equals(this.settings, updateSourceAlphaInput.settings); - } - - @Override - public int hashCode() { - return Objects.hash(name, enabled, slug, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSourceAlphaInput {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("enabled"); + openapiFields.add("slug"); + openapiFields.add("settings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); } - return o.toString().replace("\n", "\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("enabled"); - openapiFields.add("slug"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSourceAlphaInput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSourceAlphaInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSourceAlphaInput is not found in the empty JSON string", UpdateSourceAlphaInput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSourceAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSourceAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateSourceAlphaInput is not found in" + + " the empty JSON string", + UpdateSourceAlphaInput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSourceAlphaInput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSourceAlphaInput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSourceAlphaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSourceAlphaInput` 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())); + } + if ((jsonObj.get("slug") != null && !jsonObj.get("slug").isJsonNull()) + && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").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("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSourceAlphaInput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSourceAlphaInput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSourceAlphaInput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSourceAlphaInput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSourceAlphaInput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of UpdateSourceAlphaInput given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSourceAlphaInput - * @throws IOException if the JSON string is invalid with respect to UpdateSourceAlphaInput - */ - public static UpdateSourceAlphaInput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSourceAlphaInput.class); - } - - /** - * Convert an instance of UpdateSourceAlphaInput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSourceAlphaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSourceAlphaInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateSourceAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSourceAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSourceAlphaInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSourceAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSourceAlphaInput + * @throws IOException if the JSON string is invalid with respect to UpdateSourceAlphaInput + */ + public static UpdateSourceAlphaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSourceAlphaInput.class); + } + + /** + * Convert an instance of UpdateSourceAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSourceAlphaOutput.java b/src/main/java/com/segment/publicapi/models/UpdateSourceAlphaOutput.java index 65525c17..ce115c25 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSourceAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSourceAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Source3; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the updated Source. - */ -@ApiModel(description = "Returns the updated Source.") - +/** Returns the updated Source. */ public class UpdateSourceAlphaOutput { - public static final String SERIALIZED_NAME_SOURCE = "source"; - @SerializedName(SERIALIZED_NAME_SOURCE) - private Source3 source; + public static final String SERIALIZED_NAME_SOURCE = "source"; - public UpdateSourceAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_SOURCE) + private SourceAlpha source; - public UpdateSourceAlphaOutput source(Source3 source) { - - this.source = source; - return this; - } + public UpdateSourceAlphaOutput() {} - /** - * Get source - * @return source - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public UpdateSourceAlphaOutput source(SourceAlpha source) { - public Source3 getSource() { - return source; - } + this.source = source; + return this; + } + /** + * Get source + * + * @return source + */ + @javax.annotation.Nonnull + public SourceAlpha getSource() { + return source; + } - public void setSource(Source3 source) { - this.source = source; - } + public void setSource(SourceAlpha source) { + this.source = source; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSourceAlphaOutput updateSourceAlphaOutput = (UpdateSourceAlphaOutput) o; + return Objects.equals(this.source, updateSourceAlphaOutput.source); + } + @Override + public int hashCode() { + return Objects.hash(source); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSourceAlphaOutput {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSourceAlphaOutput updateSourceAlphaOutput = (UpdateSourceAlphaOutput) o; - return Objects.equals(this.source, updateSourceAlphaOutput.source); - } - - @Override - public int hashCode() { - return Objects.hash(source); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSourceAlphaOutput {\n"); - sb.append(" source: ").append(toIndentedString(source)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); } - return o.toString().replace("\n", "\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"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("source"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSourceAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSourceAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSourceAlphaOutput is not found in the empty JSON string", UpdateSourceAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSourceAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSourceAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateSourceAlphaOutput is not found" + + " in the empty JSON string", + UpdateSourceAlphaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSourceAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSourceAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSourceAlphaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSourceAlphaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateSourceAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSourceAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `source` + SourceAlpha.validateJsonElement(jsonObj.get("source")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSourceAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSourceAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSourceAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSourceAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSourceAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSourceAlphaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSourceAlphaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateSourceAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSourceAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSourceAlphaOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSourceAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSourceAlphaOutput + * @throws IOException if the JSON string is invalid with respect to UpdateSourceAlphaOutput + */ + public static UpdateSourceAlphaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSourceAlphaOutput.class); } - } - - /** - * Create an instance of UpdateSourceAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSourceAlphaOutput - * @throws IOException if the JSON string is invalid with respect to UpdateSourceAlphaOutput - */ - public static UpdateSourceAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSourceAlphaOutput.class); - } - - /** - * Convert an instance of UpdateSourceAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateSourceAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSourceV1Input.java b/src/main/java/com/segment/publicapi/models/UpdateSourceV1Input.java index 22c5ef3b..9caf0943 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSourceV1Input.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSourceV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,294 +9,292 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Updates an existing Source based on a set of parameters. - */ -@ApiModel(description = "Updates an existing Source based on a set of parameters.") - +/** Updates an existing Source based on a set of parameters. */ public class UpdateSourceV1Input { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public UpdateSourceV1Input() { - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public UpdateSourceV1Input name(String name) { - - this.name = name; - return this; - } + public static final String SERIALIZED_NAME_SLUG = "slug"; - /** - * An optional human-readable name to associate with the Source. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An optional human-readable name to associate with the Source. Config API note: equal to `displayName`.") + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; - public String getName() { - return name; - } + public static final String SERIALIZED_NAME_SETTINGS = "settings"; + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; - public void setName(String name) { - this.name = name; - } + public UpdateSourceV1Input() {} + public UpdateSourceV1Input name(String name) { - public UpdateSourceV1Input enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * Enable to allow the Source to send data. - * @return enabled - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow the Source to send data.") + this.name = name; + return this; + } - public Boolean getEnabled() { - return enabled; - } + /** + * An optional human-readable name to associate with the Source. Config API note: equal to + * `displayName`. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public UpdateSourceV1Input enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } - public UpdateSourceV1Input slug(String slug) { - - this.slug = slug; - return this; - } + /** + * Enable to allow the Source to send data. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } - /** - * The slug that identifies the Source. Config API note: equal to `name`. - * @return slug - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The slug that identifies the Source. Config API note: equal to `name`.") + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public String getSlug() { - return slug; - } + public UpdateSourceV1Input slug(String slug) { + this.slug = slug; + return this; + } - public void setSlug(String slug) { - this.slug = slug; - } + /** + * The slug that identifies the Source. Config API note: equal to `name`. + * + * @return slug + */ + @javax.annotation.Nullable + public String getSlug() { + return slug; + } + public void setSlug(String slug) { + this.slug = slug; + } - public UpdateSourceV1Input settings(Map settings) { - - this.settings = settings; - return this; - } + public UpdateSourceV1Input settings(Map settings) { - /** - * A key-value object that contains instance-specific settings for the Source. Different kinds of Sources require different kinds of input. The settings input for a Source comes from the `options` object associated with this instance of a Source. You can find the full list of required settings by accessing the Sources catalog endpoint under `/catalog/sources`. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A key-value object that contains instance-specific settings for the Source. Different kinds of Sources require different kinds of input. The settings input for a Source comes from the `options` object associated with this instance of a Source. You can find the full list of required settings by accessing the Sources catalog endpoint under `/catalog/sources`.") + this.settings = settings; + return this; + } - public Map getSettings() { - return settings; - } + public UpdateSourceV1Input putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + /** + * A key-value object that contains instance-specific settings for a Source. The + * `options` field in the Source metadata defines the schema of this object. + * + * @return settings + */ + @javax.annotation.Nullable + public Map getSettings() { + return settings; + } - public void setSettings(Map settings) { - this.settings = settings; - } + public void setSettings(Map settings) { + this.settings = settings; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSourceV1Input updateSourceV1Input = (UpdateSourceV1Input) o; + return Objects.equals(this.name, updateSourceV1Input.name) + && Objects.equals(this.enabled, updateSourceV1Input.enabled) + && Objects.equals(this.slug, updateSourceV1Input.slug) + && Objects.equals(this.settings, updateSourceV1Input.settings); + } + @Override + public int hashCode() { + return Objects.hash(name, enabled, slug, settings); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSourceV1Input {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSourceV1Input updateSourceV1Input = (UpdateSourceV1Input) o; - return Objects.equals(this.name, updateSourceV1Input.name) && - Objects.equals(this.enabled, updateSourceV1Input.enabled) && - Objects.equals(this.slug, updateSourceV1Input.slug) && - Objects.equals(this.settings, updateSourceV1Input.settings); - } - - @Override - public int hashCode() { - return Objects.hash(name, enabled, slug, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSourceV1Input {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("enabled"); + openapiFields.add("slug"); + openapiFields.add("settings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); } - return o.toString().replace("\n", "\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("enabled"); - openapiFields.add("slug"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSourceV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSourceV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSourceV1Input is not found in the empty JSON string", UpdateSourceV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSourceV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSourceV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateSourceV1Input is not found in" + + " the empty JSON string", + UpdateSourceV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSourceV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSourceV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSourceV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSourceV1Input` 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())); + } + if ((jsonObj.get("slug") != null && !jsonObj.get("slug").isJsonNull()) + && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").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("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSourceV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSourceV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSourceV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSourceV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSourceV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of UpdateSourceV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSourceV1Input - * @throws IOException if the JSON string is invalid with respect to UpdateSourceV1Input - */ - public static UpdateSourceV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSourceV1Input.class); - } - - /** - * Convert an instance of UpdateSourceV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSourceV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSourceV1Input' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateSourceV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSourceV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSourceV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSourceV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSourceV1Input + * @throws IOException if the JSON string is invalid with respect to UpdateSourceV1Input + */ + public static UpdateSourceV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSourceV1Input.class); + } + + /** + * Convert an instance of UpdateSourceV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSourceV1Output.java b/src/main/java/com/segment/publicapi/models/UpdateSourceV1Output.java index eaa01298..d44aea75 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSourceV1Output.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSourceV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,194 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Source6; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the updated Source. - */ -@ApiModel(description = "Returns the updated Source.") - +/** Returns the updated Source. */ public class UpdateSourceV1Output { - public static final String SERIALIZED_NAME_SOURCE = "source"; - @SerializedName(SERIALIZED_NAME_SOURCE) - private Source6 source; + public static final String SERIALIZED_NAME_SOURCE = "source"; - public UpdateSourceV1Output() { - } + @SerializedName(SERIALIZED_NAME_SOURCE) + private SourceV1 source; - public UpdateSourceV1Output source(Source6 source) { - - this.source = source; - return this; - } + public UpdateSourceV1Output() {} - /** - * Get source - * @return source - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public UpdateSourceV1Output source(SourceV1 source) { - public Source6 getSource() { - return source; - } + this.source = source; + return this; + } + /** + * Get source + * + * @return source + */ + @javax.annotation.Nonnull + public SourceV1 getSource() { + return source; + } - public void setSource(Source6 source) { - this.source = source; - } + public void setSource(SourceV1 source) { + this.source = source; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSourceV1Output updateSourceV1Output = (UpdateSourceV1Output) o; + return Objects.equals(this.source, updateSourceV1Output.source); + } + @Override + public int hashCode() { + return Objects.hash(source); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSourceV1Output {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSourceV1Output updateSourceV1Output = (UpdateSourceV1Output) o; - return Objects.equals(this.source, updateSourceV1Output.source); - } - - @Override - public int hashCode() { - return Objects.hash(source); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSourceV1Output {\n"); - sb.append(" source: ").append(toIndentedString(source)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); } - return o.toString().replace("\n", "\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"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("source"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSourceV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSourceV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSourceV1Output is not found in the empty JSON string", UpdateSourceV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSourceV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSourceV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateSourceV1Output is not found in" + + " the empty JSON string", + UpdateSourceV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSourceV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSourceV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSourceV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSourceV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateSourceV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSourceV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `source` + SourceV1.validateJsonElement(jsonObj.get("source")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSourceV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSourceV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSourceV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSourceV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSourceV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSourceV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSourceV1Output' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateSourceV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSourceV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSourceV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSourceV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSourceV1Output + * @throws IOException if the JSON string is invalid with respect to UpdateSourceV1Output + */ + public static UpdateSourceV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSourceV1Output.class); } - } - - /** - * Create an instance of UpdateSourceV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSourceV1Output - * @throws IOException if the JSON string is invalid with respect to UpdateSourceV1Output - */ - public static UpdateSourceV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSourceV1Output.class); - } - - /** - * Convert an instance of UpdateSourceV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateSourceV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSubscriptionForDestination200Response.java b/src/main/java/com/segment/publicapi/models/UpdateSubscriptionForDestination200Response.java index 7435105c..41a3ad4a 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSubscriptionForDestination200Response.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSubscriptionForDestination200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,200 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateSubscriptionForDestinationAlphaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateSubscriptionForDestination200Response - */ - +/** UpdateSubscriptionForDestination200Response */ public class UpdateSubscriptionForDestination200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateSubscriptionForDestinationAlphaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateSubscriptionForDestination200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateSubscriptionForDestinationAlphaOutput data; - public UpdateSubscriptionForDestination200Response data(UpdateSubscriptionForDestinationAlphaOutput data) { - - this.data = data; - return this; - } + public UpdateSubscriptionForDestination200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateSubscriptionForDestination200Response data( + UpdateSubscriptionForDestinationAlphaOutput data) { - public UpdateSubscriptionForDestinationAlphaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateSubscriptionForDestinationAlphaOutput getData() { + return data; + } - public void setData(UpdateSubscriptionForDestinationAlphaOutput data) { - this.data = data; - } + public void setData(UpdateSubscriptionForDestinationAlphaOutput data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSubscriptionForDestination200Response updateSubscriptionForDestination200Response = + (UpdateSubscriptionForDestination200Response) o; + return Objects.equals(this.data, updateSubscriptionForDestination200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSubscriptionForDestination200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSubscriptionForDestination200Response updateSubscriptionForDestination200Response = (UpdateSubscriptionForDestination200Response) o; - return Objects.equals(this.data, updateSubscriptionForDestination200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSubscriptionForDestination200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSubscriptionForDestination200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSubscriptionForDestination200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSubscriptionForDestination200Response is not found in the empty JSON string", UpdateSubscriptionForDestination200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateSubscriptionForDestination200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSubscriptionForDestination200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateSubscriptionForDestination200Response is not found in" + + " the empty JSON string", + UpdateSubscriptionForDestination200Response.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSubscriptionForDestination200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSubscriptionForDestination200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSubscriptionForDestination200Response.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSubscriptionForDestination200Response` 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()) { + UpdateSubscriptionForDestinationAlphaOutput.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSubscriptionForDestination200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSubscriptionForDestination200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSubscriptionForDestination200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSubscriptionForDestination200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSubscriptionForDestination200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSubscriptionForDestination200Response.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'UpdateSubscriptionForDestination200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateSubscriptionForDestination200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateSubscriptionForDestination200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSubscriptionForDestination200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSubscriptionForDestination200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSubscriptionForDestination200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateSubscriptionForDestination200Response + */ + public static UpdateSubscriptionForDestination200Response fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, UpdateSubscriptionForDestination200Response.class); } - } - - /** - * Create an instance of UpdateSubscriptionForDestination200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSubscriptionForDestination200Response - * @throws IOException if the JSON string is invalid with respect to UpdateSubscriptionForDestination200Response - */ - public static UpdateSubscriptionForDestination200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSubscriptionForDestination200Response.class); - } - - /** - * Convert an instance of UpdateSubscriptionForDestination200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateSubscriptionForDestination200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSubscriptionForDestinationAlphaInput.java b/src/main/java/com/segment/publicapi/models/UpdateSubscriptionForDestinationAlphaInput.java index 3012f409..087c8149 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSubscriptionForDestinationAlphaInput.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSubscriptionForDestinationAlphaInput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,210 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Input; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The basic input parameters for updating a Destination subscription. - */ -@ApiModel(description = "The basic input parameters for updating a Destination subscription.") - +/** The basic input parameters for updating a Destination subscription. */ public class UpdateSubscriptionForDestinationAlphaInput { - public static final String SERIALIZED_NAME_INPUT = "input"; - @SerializedName(SERIALIZED_NAME_INPUT) - private Input input; + public static final String SERIALIZED_NAME_INPUT = "input"; - public UpdateSubscriptionForDestinationAlphaInput() { - } + @SerializedName(SERIALIZED_NAME_INPUT) + private DestinationSubscriptionUpdateInput input; - public UpdateSubscriptionForDestinationAlphaInput input(Input input) { - - this.input = input; - return this; - } + public UpdateSubscriptionForDestinationAlphaInput() {} - /** - * Get input - * @return input - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public UpdateSubscriptionForDestinationAlphaInput input( + DestinationSubscriptionUpdateInput input) { - public Input getInput() { - return input; - } + this.input = input; + return this; + } + /** + * Get input + * + * @return input + */ + @javax.annotation.Nonnull + public DestinationSubscriptionUpdateInput getInput() { + return input; + } - public void setInput(Input input) { - this.input = input; - } + public void setInput(DestinationSubscriptionUpdateInput input) { + this.input = input; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSubscriptionForDestinationAlphaInput updateSubscriptionForDestinationAlphaInput = + (UpdateSubscriptionForDestinationAlphaInput) o; + return Objects.equals(this.input, updateSubscriptionForDestinationAlphaInput.input); + } + @Override + public int hashCode() { + return Objects.hash(input); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSubscriptionForDestinationAlphaInput {\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSubscriptionForDestinationAlphaInput updateSubscriptionForDestinationAlphaInput = (UpdateSubscriptionForDestinationAlphaInput) o; - return Objects.equals(this.input, updateSubscriptionForDestinationAlphaInput.input); - } - - @Override - public int hashCode() { - return Objects.hash(input); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSubscriptionForDestinationAlphaInput {\n"); - sb.append(" input: ").append(toIndentedString(input)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("input"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("input"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("input"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("input"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSubscriptionForDestinationAlphaInput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSubscriptionForDestinationAlphaInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSubscriptionForDestinationAlphaInput is not found in the empty JSON string", UpdateSubscriptionForDestinationAlphaInput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateSubscriptionForDestinationAlphaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSubscriptionForDestinationAlphaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateSubscriptionForDestinationAlphaInput is not found in" + + " the empty JSON string", + UpdateSubscriptionForDestinationAlphaInput.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSubscriptionForDestinationAlphaInput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSubscriptionForDestinationAlphaInput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSubscriptionForDestinationAlphaInput.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSubscriptionForDestinationAlphaInput` properties." + + " JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateSubscriptionForDestinationAlphaInput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + UpdateSubscriptionForDestinationAlphaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `input` + DestinationSubscriptionUpdateInput.validateJsonElement(jsonObj.get("input")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSubscriptionForDestinationAlphaInput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSubscriptionForDestinationAlphaInput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSubscriptionForDestinationAlphaInput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSubscriptionForDestinationAlphaInput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSubscriptionForDestinationAlphaInput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSubscriptionForDestinationAlphaInput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'UpdateSubscriptionForDestinationAlphaInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateSubscriptionForDestinationAlphaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateSubscriptionForDestinationAlphaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSubscriptionForDestinationAlphaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSubscriptionForDestinationAlphaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSubscriptionForDestinationAlphaInput + * @throws IOException if the JSON string is invalid with respect to + * UpdateSubscriptionForDestinationAlphaInput + */ + public static UpdateSubscriptionForDestinationAlphaInput fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, UpdateSubscriptionForDestinationAlphaInput.class); } - } - - /** - * Create an instance of UpdateSubscriptionForDestinationAlphaInput given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSubscriptionForDestinationAlphaInput - * @throws IOException if the JSON string is invalid with respect to UpdateSubscriptionForDestinationAlphaInput - */ - public static UpdateSubscriptionForDestinationAlphaInput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSubscriptionForDestinationAlphaInput.class); - } - - /** - * Convert an instance of UpdateSubscriptionForDestinationAlphaInput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateSubscriptionForDestinationAlphaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateSubscriptionForDestinationAlphaOutput.java b/src/main/java/com/segment/publicapi/models/UpdateSubscriptionForDestinationAlphaOutput.java index 565ccde8..02076d7c 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateSubscriptionForDestinationAlphaOutput.java +++ b/src/main/java/com/segment/publicapi/models/UpdateSubscriptionForDestinationAlphaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,211 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Subscription; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the updated Destination subscription. - */ -@ApiModel(description = "Returns the updated Destination subscription.") - +/** Returns the updated Destination subscription. */ public class UpdateSubscriptionForDestinationAlphaOutput { - public static final String SERIALIZED_NAME_SUBSCRIPTION = "subscription"; - @SerializedName(SERIALIZED_NAME_SUBSCRIPTION) - private Subscription subscription; + public static final String SERIALIZED_NAME_SUBSCRIPTION = "subscription"; - public UpdateSubscriptionForDestinationAlphaOutput() { - } + @SerializedName(SERIALIZED_NAME_SUBSCRIPTION) + private DestinationSubscription subscription; - public UpdateSubscriptionForDestinationAlphaOutput subscription(Subscription subscription) { - - this.subscription = subscription; - return this; - } + public UpdateSubscriptionForDestinationAlphaOutput() {} - /** - * Get subscription - * @return subscription - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public UpdateSubscriptionForDestinationAlphaOutput subscription( + DestinationSubscription subscription) { - public Subscription getSubscription() { - return subscription; - } + this.subscription = subscription; + return this; + } + /** + * Get subscription + * + * @return subscription + */ + @javax.annotation.Nonnull + public DestinationSubscription getSubscription() { + return subscription; + } - public void setSubscription(Subscription subscription) { - this.subscription = subscription; - } + public void setSubscription(DestinationSubscription subscription) { + this.subscription = subscription; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSubscriptionForDestinationAlphaOutput updateSubscriptionForDestinationAlphaOutput = + (UpdateSubscriptionForDestinationAlphaOutput) o; + return Objects.equals( + this.subscription, updateSubscriptionForDestinationAlphaOutput.subscription); + } + @Override + public int hashCode() { + return Objects.hash(subscription); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSubscriptionForDestinationAlphaOutput {\n"); + sb.append(" subscription: ").append(toIndentedString(subscription)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateSubscriptionForDestinationAlphaOutput updateSubscriptionForDestinationAlphaOutput = (UpdateSubscriptionForDestinationAlphaOutput) o; - return Objects.equals(this.subscription, updateSubscriptionForDestinationAlphaOutput.subscription); - } - - @Override - public int hashCode() { - return Objects.hash(subscription); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSubscriptionForDestinationAlphaOutput {\n"); - sb.append(" subscription: ").append(toIndentedString(subscription)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("subscription"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("subscription"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("subscription"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("subscription"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateSubscriptionForDestinationAlphaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateSubscriptionForDestinationAlphaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSubscriptionForDestinationAlphaOutput is not found in the empty JSON string", UpdateSubscriptionForDestinationAlphaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateSubscriptionForDestinationAlphaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSubscriptionForDestinationAlphaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in" + + " UpdateSubscriptionForDestinationAlphaOutput is not found in" + + " the empty JSON string", + UpdateSubscriptionForDestinationAlphaOutput.openapiRequiredFields + .toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateSubscriptionForDestinationAlphaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSubscriptionForDestinationAlphaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSubscriptionForDestinationAlphaOutput.openapiFields.contains( + entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateSubscriptionForDestinationAlphaOutput` properties." + + " JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateSubscriptionForDestinationAlphaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : + UpdateSubscriptionForDestinationAlphaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `subscription` + DestinationSubscription.validateJsonElement(jsonObj.get("subscription")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSubscriptionForDestinationAlphaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSubscriptionForDestinationAlphaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateSubscriptionForDestinationAlphaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSubscriptionForDestinationAlphaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSubscriptionForDestinationAlphaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSubscriptionForDestinationAlphaOutput.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'UpdateSubscriptionForDestinationAlphaOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateSubscriptionForDestinationAlphaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, UpdateSubscriptionForDestinationAlphaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSubscriptionForDestinationAlphaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSubscriptionForDestinationAlphaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSubscriptionForDestinationAlphaOutput + * @throws IOException if the JSON string is invalid with respect to + * UpdateSubscriptionForDestinationAlphaOutput + */ + public static UpdateSubscriptionForDestinationAlphaOutput fromJson(String jsonString) + throws IOException { + return JSON.getGson() + .fromJson(jsonString, UpdateSubscriptionForDestinationAlphaOutput.class); } - } - - /** - * Create an instance of UpdateSubscriptionForDestinationAlphaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSubscriptionForDestinationAlphaOutput - * @throws IOException if the JSON string is invalid with respect to UpdateSubscriptionForDestinationAlphaOutput - */ - public static UpdateSubscriptionForDestinationAlphaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSubscriptionForDestinationAlphaOutput.class); - } - - /** - * Convert an instance of UpdateSubscriptionForDestinationAlphaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateSubscriptionForDestinationAlphaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateTrackingPlan200Response.java b/src/main/java/com/segment/publicapi/models/UpdateTrackingPlan200Response.java index 97936655..cab8435e 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateTrackingPlan200Response.java +++ b/src/main/java/com/segment/publicapi/models/UpdateTrackingPlan200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateTrackingPlanV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateTrackingPlan200Response - */ - +/** UpdateTrackingPlan200Response */ public class UpdateTrackingPlan200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateTrackingPlanV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateTrackingPlan200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateTrackingPlanV1Output data; - public UpdateTrackingPlan200Response data(UpdateTrackingPlanV1Output data) { - - this.data = data; - return this; - } + public UpdateTrackingPlan200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateTrackingPlan200Response data(UpdateTrackingPlanV1Output data) { - public UpdateTrackingPlanV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateTrackingPlanV1Output getData() { + return data; + } - public void setData(UpdateTrackingPlanV1Output data) { - this.data = data; - } + public void setData(UpdateTrackingPlanV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateTrackingPlan200Response updateTrackingPlan200Response = + (UpdateTrackingPlan200Response) o; + return Objects.equals(this.data, updateTrackingPlan200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTrackingPlan200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateTrackingPlan200Response updateTrackingPlan200Response = (UpdateTrackingPlan200Response) o; - return Objects.equals(this.data, updateTrackingPlan200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateTrackingPlan200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateTrackingPlan200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateTrackingPlan200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateTrackingPlan200Response is not found in the empty JSON string", UpdateTrackingPlan200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateTrackingPlan200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTrackingPlan200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateTrackingPlan200Response is not" + + " found in the empty JSON string", + UpdateTrackingPlan200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateTrackingPlan200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTrackingPlan200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTrackingPlan200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateTrackingPlan200Response` 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()) { + UpdateTrackingPlanV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateTrackingPlan200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateTrackingPlan200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateTrackingPlan200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateTrackingPlan200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateTrackingPlan200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTrackingPlan200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTrackingPlan200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateTrackingPlan200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTrackingPlan200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTrackingPlan200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTrackingPlan200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTrackingPlan200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateTrackingPlan200Response + */ + public static UpdateTrackingPlan200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTrackingPlan200Response.class); } - } - - /** - * Create an instance of UpdateTrackingPlan200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateTrackingPlan200Response - * @throws IOException if the JSON string is invalid with respect to UpdateTrackingPlan200Response - */ - public static UpdateTrackingPlan200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateTrackingPlan200Response.class); - } - - /** - * Convert an instance of UpdateTrackingPlan200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateTrackingPlan200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateTrackingPlanV1Input.java b/src/main/java/com/segment/publicapi/models/UpdateTrackingPlanV1Input.java index e344da4a..2c020d9f 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateTrackingPlanV1Input.java +++ b/src/main/java/com/segment/publicapi/models/UpdateTrackingPlanV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,233 +9,226 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Updates the Workspace's Tracking Plan. - */ -@ApiModel(description = "Updates the Workspace's Tracking Plan.") - +/** Updates the Workspace's Tracking Plan. */ public class UpdateTrackingPlanV1Input { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public UpdateTrackingPlanV1Input() { - } + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - public UpdateTrackingPlanV1Input name(String name) { - - this.name = name; - return this; - } + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - /** - * The Tracking Plan's name. Config API note: equal to `displayName`. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Tracking Plan's name. Config API note: equal to `displayName`.") + public UpdateTrackingPlanV1Input() {} - public String getName() { - return name; - } + public UpdateTrackingPlanV1Input name(String name) { + this.name = name; + return this; + } - public void setName(String name) { - this.name = name; - } - + /** + * The Tracking Plan's name. Config API note: equal to `displayName`. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - public UpdateTrackingPlanV1Input description(String description) { - - this.description = description; - return this; - } + public void setName(String name) { + this.name = name; + } - /** - * The Tracking Plan's description. - * @return description - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The Tracking Plan's description.") + public UpdateTrackingPlanV1Input description(String description) { - public String getDescription() { - return description; - } + this.description = description; + return this; + } + /** + * The Tracking Plan's description. + * + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = 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; + } + UpdateTrackingPlanV1Input updateTrackingPlanV1Input = (UpdateTrackingPlanV1Input) o; + return Objects.equals(this.name, updateTrackingPlanV1Input.name) + && Objects.equals(this.description, updateTrackingPlanV1Input.description); + } + @Override + public int hashCode() { + return Objects.hash(name, description); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTrackingPlanV1Input {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateTrackingPlanV1Input updateTrackingPlanV1Input = (UpdateTrackingPlanV1Input) o; - return Objects.equals(this.name, updateTrackingPlanV1Input.name) && - Objects.equals(this.description, updateTrackingPlanV1Input.description); - } - - @Override - public int hashCode() { - return Objects.hash(name, description); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateTrackingPlanV1Input {\n"); - sb.append(" name: ").append(toIndentedString(name)).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"; + + 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("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); } - return o.toString().replace("\n", "\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("description"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateTrackingPlanV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateTrackingPlanV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateTrackingPlanV1Input is not found in the empty JSON string", UpdateTrackingPlanV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateTrackingPlanV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTrackingPlanV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateTrackingPlanV1Input is not found" + + " in the empty JSON string", + UpdateTrackingPlanV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateTrackingPlanV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTrackingPlanV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTrackingPlanV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateTrackingPlanV1Input` 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())); + } + 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("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("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 (!UpdateTrackingPlanV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateTrackingPlanV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateTrackingPlanV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateTrackingPlanV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateTrackingPlanV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of UpdateTrackingPlanV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateTrackingPlanV1Input - * @throws IOException if the JSON string is invalid with respect to UpdateTrackingPlanV1Input - */ - public static UpdateTrackingPlanV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateTrackingPlanV1Input.class); - } - - /** - * Convert an instance of UpdateTrackingPlanV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTrackingPlanV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTrackingPlanV1Input' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateTrackingPlanV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTrackingPlanV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTrackingPlanV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTrackingPlanV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTrackingPlanV1Input + * @throws IOException if the JSON string is invalid with respect to UpdateTrackingPlanV1Input + */ + public static UpdateTrackingPlanV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTrackingPlanV1Input.class); + } + + /** + * Convert an instance of UpdateTrackingPlanV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateTrackingPlanV1Output.java b/src/main/java/com/segment/publicapi/models/UpdateTrackingPlanV1Output.java index 5c8fc5e4..22a3b9c3 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateTrackingPlanV1Output.java +++ b/src/main/java/com/segment/publicapi/models/UpdateTrackingPlanV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,253 +9,245 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; 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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Result of an UpdateTrackingPlan call. - */ -@ApiModel(description = "Result of an UpdateTrackingPlan call.") - +/** Result of an UpdateTrackingPlan call. */ public class UpdateTrackingPlanV1Output { - /** - * The operation status. - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - SUCCESS("SUCCESS"); + /** The operation status. */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"); - private String value; + private String value; - StatusEnum(String value) { - this.value = value; - } + StatusEnum(String value) { + this.value = value; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - @Override - public String toString() { - return String.valueOf(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; + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - } - 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 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_STATUS = "status"; - public UpdateTrackingPlanV1Output() { - } + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; - public UpdateTrackingPlanV1Output status(StatusEnum status) { - - this.status = status; - return this; - } + public UpdateTrackingPlanV1Output() {} - /** - * The operation status. - * @return status - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The operation status.") + public UpdateTrackingPlanV1Output status(StatusEnum status) { - public StatusEnum getStatus() { - return status; - } + this.status = status; + return this; + } + /** + * The operation status. + * + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } - public void setStatus(StatusEnum status) { - this.status = 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; + } + UpdateTrackingPlanV1Output updateTrackingPlanV1Output = (UpdateTrackingPlanV1Output) o; + return Objects.equals(this.status, updateTrackingPlanV1Output.status); + } + @Override + public int hashCode() { + return Objects.hash(status); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTrackingPlanV1Output {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateTrackingPlanV1Output updateTrackingPlanV1Output = (UpdateTrackingPlanV1Output) o; - return Objects.equals(this.status, updateTrackingPlanV1Output.status); - } - - @Override - public int hashCode() { - return Objects.hash(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateTrackingPlanV1Output {\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"; + + 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(); + openapiRequiredFields.add("status"); } - return o.toString().replace("\n", "\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(); - openapiRequiredFields.add("status"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateTrackingPlanV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateTrackingPlanV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateTrackingPlanV1Output is not found in the empty JSON string", UpdateTrackingPlanV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateTrackingPlanV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTrackingPlanV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateTrackingPlanV1Output is not" + + " found in the empty JSON string", + UpdateTrackingPlanV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateTrackingPlanV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTrackingPlanV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTrackingPlanV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateTrackingPlanV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateTrackingPlanV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateTrackingPlanV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!UpdateTrackingPlanV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateTrackingPlanV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateTrackingPlanV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateTrackingPlanV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateTrackingPlanV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of UpdateTrackingPlanV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateTrackingPlanV1Output - * @throws IOException if the JSON string is invalid with respect to UpdateTrackingPlanV1Output - */ - public static UpdateTrackingPlanV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateTrackingPlanV1Output.class); - } - - /** - * Convert an instance of UpdateTrackingPlanV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTrackingPlanV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTrackingPlanV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateTrackingPlanV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTrackingPlanV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTrackingPlanV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTrackingPlanV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTrackingPlanV1Output + * @throws IOException if the JSON string is invalid with respect to UpdateTrackingPlanV1Output + */ + public static UpdateTrackingPlanV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTrackingPlanV1Output.class); + } + + /** + * Convert an instance of UpdateTrackingPlanV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateTransformation200Response.java b/src/main/java/com/segment/publicapi/models/UpdateTransformation200Response.java index 3f5e6f20..98adc4cb 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateTransformation200Response.java +++ b/src/main/java/com/segment/publicapi/models/UpdateTransformation200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,191 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateTransformationBetaOutput; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateTransformation200Response - */ - +/** UpdateTransformation200Response */ public class UpdateTransformation200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateTransformationBetaOutput data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateTransformation200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateTransformationV1Output data; - public UpdateTransformation200Response data(UpdateTransformationBetaOutput data) { - - this.data = data; - return this; - } + public UpdateTransformation200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateTransformation200Response data(UpdateTransformationV1Output data) { - public UpdateTransformationBetaOutput getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateTransformationV1Output getData() { + return data; + } - public void setData(UpdateTransformationBetaOutput data) { - this.data = data; - } + public void setData(UpdateTransformationV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateTransformation200Response updateTransformation200Response = + (UpdateTransformation200Response) o; + return Objects.equals(this.data, updateTransformation200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTransformation200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateTransformation200Response updateTransformation200Response = (UpdateTransformation200Response) o; - return Objects.equals(this.data, updateTransformation200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateTransformation200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateTransformation200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateTransformation200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateTransformation200Response is not found in the empty JSON string", UpdateTransformation200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateTransformation200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTransformation200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateTransformation200Response is not" + + " found in the empty JSON string", + UpdateTransformation200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateTransformation200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTransformation200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTransformation200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateTransformation200Response` 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()) { + UpdateTransformationV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateTransformation200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateTransformation200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateTransformation200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateTransformation200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateTransformation200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTransformation200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTransformation200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateTransformation200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTransformation200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTransformation200Response read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTransformation200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTransformation200Response + * @throws IOException if the JSON string is invalid with respect to + * UpdateTransformation200Response + */ + public static UpdateTransformation200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTransformation200Response.class); } - } - - /** - * Create an instance of UpdateTransformation200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateTransformation200Response - * @throws IOException if the JSON string is invalid with respect to UpdateTransformation200Response - */ - public static UpdateTransformation200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateTransformation200Response.class); - } - - /** - * Convert an instance of UpdateTransformation200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateTransformation200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateTransformationBetaInput.java b/src/main/java/com/segment/publicapi/models/UpdateTransformationBetaInput.java index 94d4a93c..5d20a7fc 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateTransformationBetaInput.java +++ b/src/main/java/com/segment/publicapi/models/UpdateTransformationBetaInput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,412 +9,559 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PropertyRenameBeta; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** The input to update a Transformation. */ +public class UpdateTransformationBetaInput { + public static final String SERIALIZED_NAME_TRANSFORMATION_ID = "transformationId"; -/** - * The input to update a Transformation. - */ -@ApiModel(description = "The input to update a Transformation.") + @SerializedName(SERIALIZED_NAME_TRANSFORMATION_ID) + private String transformationId; -public class UpdateTransformationBetaInput { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; + + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; + + public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; + + @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) + private String destinationMetadataId; - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; - @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) - private String destinationMetadataId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_IF = "if"; - @SerializedName(SERIALIZED_NAME_IF) - private String _if; + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public static final String SERIALIZED_NAME_NEW_EVENT_NAME = "newEventName"; - @SerializedName(SERIALIZED_NAME_NEW_EVENT_NAME) - private String newEventName; + public static final String SERIALIZED_NAME_IF = "if"; - public static final String SERIALIZED_NAME_PROPERTY_RENAMES = "propertyRenames"; - @SerializedName(SERIALIZED_NAME_PROPERTY_RENAMES) - private List propertyRenames = null; + @SerializedName(SERIALIZED_NAME_IF) + private String _if; - public UpdateTransformationBetaInput() { - } + public static final String SERIALIZED_NAME_NEW_EVENT_NAME = "newEventName"; - public UpdateTransformationBetaInput name(String name) { - - this.name = name; - return this; - } + @SerializedName(SERIALIZED_NAME_NEW_EVENT_NAME) + private String newEventName; - /** - * The name of the Transformation. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The name of the Transformation.") + public static final String SERIALIZED_NAME_PROPERTY_RENAMES = "propertyRenames"; - public String getName() { - return name; - } + @SerializedName(SERIALIZED_NAME_PROPERTY_RENAMES) + private List propertyRenames; + public static final String SERIALIZED_NAME_PROPERTY_VALUE_TRANSFORMATIONS = + "propertyValueTransformations"; - public void setName(String name) { - this.name = name; - } + @SerializedName(SERIALIZED_NAME_PROPERTY_VALUE_TRANSFORMATIONS) + private List propertyValueTransformations; + + public UpdateTransformationBetaInput() {} + + public UpdateTransformationBetaInput transformationId(String transformationId) { + + this.transformationId = transformationId; + return this; + } + + /** + * ID of the Transformation to update. + * + * @return transformationId + */ + @javax.annotation.Nonnull + public String getTransformationId() { + return transformationId; + } + + public void setTransformationId(String transformationId) { + this.transformationId = transformationId; + } + + public UpdateTransformationBetaInput name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the Transformation. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UpdateTransformationBetaInput sourceId(String sourceId) { + + this.sourceId = sourceId; + return this; + } + + /** + * The optional Source to be associated with the Transformation. + * + * @return sourceId + */ + @javax.annotation.Nullable + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public UpdateTransformationBetaInput destinationMetadataId(String destinationMetadataId) { + + this.destinationMetadataId = destinationMetadataId; + return this; + } + + /** + * The optional Destination metadata to be associated with the Transformation. + * + * @return destinationMetadataId + */ + @javax.annotation.Nullable + public String getDestinationMetadataId() { + return destinationMetadataId; + } + public void setDestinationMetadataId(String destinationMetadataId) { + this.destinationMetadataId = destinationMetadataId; + } - public UpdateTransformationBetaInput sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + public UpdateTransformationBetaInput enabled(Boolean enabled) { - /** - * The optional Source to be associated with the Transformation. - * @return sourceId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The optional Source to be associated with the Transformation.") + this.enabled = enabled; + return this; + } - public String getSourceId() { - return sourceId; - } + /** + * If the Transformation should be enabled. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + public UpdateTransformationBetaInput _if(String _if) { + this._if = _if; + return this; + } - public UpdateTransformationBetaInput destinationMetadataId(String destinationMetadataId) { - - this.destinationMetadataId = destinationMetadataId; - return this; - } + /** + * If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard + * event matchers, use the following: Track -\\> + * \"event='\\<eventName\\>'\" Identify -\\> + * \"type='identify'\" Group -\\> + * \"type='group'\" + * + * @return _if + */ + @javax.annotation.Nullable + public String getIf() { + return _if; + } - /** - * The optional Destination metadata to be associated with the Transformation. - * @return destinationMetadataId - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The optional Destination metadata to be associated with the Transformation.") + public void setIf(String _if) { + this._if = _if; + } - public String getDestinationMetadataId() { - return destinationMetadataId; - } + public UpdateTransformationBetaInput newEventName(String newEventName) { + this.newEventName = newEventName; + return this; + } - public void setDestinationMetadataId(String destinationMetadataId) { - this.destinationMetadataId = destinationMetadataId; - } + /** + * Optional new event name for renaming events. Works only for 'track' event type. + * + * @return newEventName + */ + @javax.annotation.Nullable + public String getNewEventName() { + return newEventName; + } + public void setNewEventName(String newEventName) { + this.newEventName = newEventName; + } - public UpdateTransformationBetaInput enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public UpdateTransformationBetaInput propertyRenames(List propertyRenames) { - /** - * If the Transformation should be enabled. - * @return enabled - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "If the Transformation should be enabled.") + this.propertyRenames = propertyRenames; + return this; + } - public Boolean getEnabled() { - return enabled; - } + public UpdateTransformationBetaInput addPropertyRenamesItem( + PropertyRenameBeta propertyRenamesItem) { + if (this.propertyRenames == null) { + this.propertyRenames = new ArrayList<>(); + } + this.propertyRenames.add(propertyRenamesItem); + return this; + } + /** + * Optional array for renaming properties collected by your events. + * + * @return propertyRenames + */ + @javax.annotation.Nullable + public List getPropertyRenames() { + return propertyRenames; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public void setPropertyRenames(List propertyRenames) { + this.propertyRenames = propertyRenames; + } + public UpdateTransformationBetaInput propertyValueTransformations( + List propertyValueTransformations) { - public UpdateTransformationBetaInput _if(String _if) { - - this._if = _if; - return this; - } + this.propertyValueTransformations = propertyValueTransformations; + return this; + } - /** - * If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> \"event='\\<eventName\\>'\" Identify -\\> \"type='identify'\" Group -\\> \"type='group'\" - * @return _if - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> \"event='\\'\" Identify -\\> \"type='identify'\" Group -\\> \"type='group'\"") - - public String getIf() { - return _if; - } - - - public void setIf(String _if) { - this._if = _if; - } - - - public UpdateTransformationBetaInput newEventName(String newEventName) { - - this.newEventName = newEventName; - return this; - } - - /** - * Optional new event name for renaming events. Works only for 'track' event type. - * @return newEventName - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Optional new event name for renaming events. Works only for 'track' event type.") - - public String getNewEventName() { - return newEventName; - } - - - public void setNewEventName(String newEventName) { - this.newEventName = newEventName; - } - - - public UpdateTransformationBetaInput propertyRenames(List propertyRenames) { - - this.propertyRenames = propertyRenames; - return this; - } - - public UpdateTransformationBetaInput addPropertyRenamesItem(PropertyRenameBeta propertyRenamesItem) { - if (this.propertyRenames == null) { - this.propertyRenames = new ArrayList<>(); - } - this.propertyRenames.add(propertyRenamesItem); - return this; - } - - /** - * Optional array for renaming properties collected by your events. - * @return propertyRenames - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Optional array for renaming properties collected by your events.") - - public List getPropertyRenames() { - return propertyRenames; - } - - - public void setPropertyRenames(List propertyRenames) { - this.propertyRenames = propertyRenames; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateTransformationBetaInput updateTransformationBetaInput = (UpdateTransformationBetaInput) o; - return Objects.equals(this.name, updateTransformationBetaInput.name) && - Objects.equals(this.sourceId, updateTransformationBetaInput.sourceId) && - Objects.equals(this.destinationMetadataId, updateTransformationBetaInput.destinationMetadataId) && - Objects.equals(this.enabled, updateTransformationBetaInput.enabled) && - Objects.equals(this._if, updateTransformationBetaInput._if) && - Objects.equals(this.newEventName, updateTransformationBetaInput.newEventName) && - Objects.equals(this.propertyRenames, updateTransformationBetaInput.propertyRenames); - } - - @Override - public int hashCode() { - return Objects.hash(name, sourceId, destinationMetadataId, enabled, _if, newEventName, propertyRenames); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateTransformationBetaInput {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" destinationMetadataId: ").append(toIndentedString(destinationMetadataId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); - sb.append(" newEventName: ").append(toIndentedString(newEventName)).append("\n"); - sb.append(" propertyRenames: ").append(toIndentedString(propertyRenames)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("sourceId"); - openapiFields.add("destinationMetadataId"); - openapiFields.add("enabled"); - openapiFields.add("if"); - openapiFields.add("newEventName"); - openapiFields.add("propertyRenames"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateTransformationBetaInput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateTransformationBetaInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateTransformationBetaInput is not found in the empty JSON string", UpdateTransformationBetaInput.openapiRequiredFields.toString())); + public UpdateTransformationBetaInput addPropertyValueTransformationsItem( + PropertyValueTransformationBeta propertyValueTransformationsItem) { + if (this.propertyValueTransformations == null) { + this.propertyValueTransformations = new ArrayList<>(); } - } + this.propertyValueTransformations.add(propertyValueTransformationsItem); + return this; + } + + /** + * Optional array for transforming properties and values collected by your events. Limited to 10 + * properties. + * + * @return propertyValueTransformations + */ + @javax.annotation.Nullable + public List getPropertyValueTransformations() { + return propertyValueTransformations; + } + + public void setPropertyValueTransformations( + List propertyValueTransformations) { + this.propertyValueTransformations = propertyValueTransformations; + } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateTransformationBetaInput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTransformationBetaInput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - } - 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("sourceId") != null && !jsonObj.get("sourceId").isJsonNull()) && !jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if ((jsonObj.get("destinationMetadataId") != null && !jsonObj.get("destinationMetadataId").isJsonNull()) && !jsonObj.get("destinationMetadataId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `destinationMetadataId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationMetadataId").toString())); - } - if ((jsonObj.get("if") != null && !jsonObj.get("if").isJsonNull()) && !jsonObj.get("if").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `if` to be a primitive type in the JSON string but got `%s`", jsonObj.get("if").toString())); - } - if ((jsonObj.get("newEventName") != null && !jsonObj.get("newEventName").isJsonNull()) && !jsonObj.get("newEventName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `newEventName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("newEventName").toString())); - } - if (jsonObj.get("propertyRenames") != null && !jsonObj.get("propertyRenames").isJsonNull()) { - JsonArray jsonArraypropertyRenames = jsonObj.getAsJsonArray("propertyRenames"); - if (jsonArraypropertyRenames != null) { - // ensure the json data is an array - if (!jsonObj.get("propertyRenames").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `propertyRenames` to be an array in the JSON string but got `%s`", jsonObj.get("propertyRenames").toString())); - } + if (o == null || getClass() != o.getClass()) { + return false; } - } - } + UpdateTransformationBetaInput updateTransformationBetaInput = + (UpdateTransformationBetaInput) o; + return Objects.equals(this.transformationId, updateTransformationBetaInput.transformationId) + && Objects.equals(this.name, updateTransformationBetaInput.name) + && Objects.equals(this.sourceId, updateTransformationBetaInput.sourceId) + && Objects.equals( + this.destinationMetadataId, + updateTransformationBetaInput.destinationMetadataId) + && Objects.equals(this.enabled, updateTransformationBetaInput.enabled) + && Objects.equals(this._if, updateTransformationBetaInput._if) + && Objects.equals(this.newEventName, updateTransformationBetaInput.newEventName) + && Objects.equals( + this.propertyRenames, updateTransformationBetaInput.propertyRenames) + && Objects.equals( + this.propertyValueTransformations, + updateTransformationBetaInput.propertyValueTransformations); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateTransformationBetaInput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateTransformationBetaInput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateTransformationBetaInput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateTransformationBetaInput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateTransformationBetaInput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of UpdateTransformationBetaInput given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateTransformationBetaInput - * @throws IOException if the JSON string is invalid with respect to UpdateTransformationBetaInput - */ - public static UpdateTransformationBetaInput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateTransformationBetaInput.class); - } - - /** - * Convert an instance of UpdateTransformationBetaInput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public int hashCode() { + return Objects.hash( + transformationId, + name, + sourceId, + destinationMetadataId, + enabled, + _if, + newEventName, + propertyRenames, + propertyValueTransformations); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTransformationBetaInput {\n"); + sb.append(" transformationId: ").append(toIndentedString(transformationId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" destinationMetadataId: ") + .append(toIndentedString(destinationMetadataId)) + .append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" newEventName: ").append(toIndentedString(newEventName)).append("\n"); + sb.append(" propertyRenames: ").append(toIndentedString(propertyRenames)).append("\n"); + sb.append(" propertyValueTransformations: ") + .append(toIndentedString(propertyValueTransformations)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transformationId"); + openapiFields.add("name"); + openapiFields.add("sourceId"); + openapiFields.add("destinationMetadataId"); + openapiFields.add("enabled"); + openapiFields.add("if"); + openapiFields.add("newEventName"); + openapiFields.add("propertyRenames"); + openapiFields.add("propertyValueTransformations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("transformationId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateTransformationBetaInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTransformationBetaInput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateTransformationBetaInput is not" + + " found in the empty JSON string", + UpdateTransformationBetaInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTransformationBetaInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateTransformationBetaInput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateTransformationBetaInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("transformationId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `transformationId` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("transformationId").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("sourceId") != null && !jsonObj.get("sourceId").isJsonNull()) + && !jsonObj.get("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if ((jsonObj.get("destinationMetadataId") != null + && !jsonObj.get("destinationMetadataId").isJsonNull()) + && !jsonObj.get("destinationMetadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `destinationMetadataId` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("destinationMetadataId").toString())); + } + if ((jsonObj.get("if") != null && !jsonObj.get("if").isJsonNull()) + && !jsonObj.get("if").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `if` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("if").toString())); + } + if ((jsonObj.get("newEventName") != null && !jsonObj.get("newEventName").isJsonNull()) + && !jsonObj.get("newEventName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `newEventName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("newEventName").toString())); + } + if (jsonObj.get("propertyRenames") != null + && !jsonObj.get("propertyRenames").isJsonNull()) { + JsonArray jsonArraypropertyRenames = jsonObj.getAsJsonArray("propertyRenames"); + if (jsonArraypropertyRenames != null) { + // ensure the json data is an array + if (!jsonObj.get("propertyRenames").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyRenames` to be an array in the" + + " JSON string but got `%s`", + jsonObj.get("propertyRenames").toString())); + } + + // validate the optional field `propertyRenames` (array) + for (int i = 0; i < jsonArraypropertyRenames.size(); i++) { + PropertyRenameBeta.validateJsonElement(jsonArraypropertyRenames.get(i)); + } + ; + } + } + if (jsonObj.get("propertyValueTransformations") != null + && !jsonObj.get("propertyValueTransformations").isJsonNull()) { + JsonArray jsonArraypropertyValueTransformations = + jsonObj.getAsJsonArray("propertyValueTransformations"); + if (jsonArraypropertyValueTransformations != null) { + // ensure the json data is an array + if (!jsonObj.get("propertyValueTransformations").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyValueTransformations` to be an" + + " array in the JSON string but got `%s`", + jsonObj.get("propertyValueTransformations").toString())); + } + + // validate the optional field `propertyValueTransformations` (array) + for (int i = 0; i < jsonArraypropertyValueTransformations.size(); i++) { + PropertyValueTransformationBeta.validateJsonElement( + jsonArraypropertyValueTransformations.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTransformationBetaInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTransformationBetaInput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateTransformationBetaInput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTransformationBetaInput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTransformationBetaInput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTransformationBetaInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTransformationBetaInput + * @throws IOException if the JSON string is invalid with respect to + * UpdateTransformationBetaInput + */ + public static UpdateTransformationBetaInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTransformationBetaInput.class); + } + + /** + * Convert an instance of UpdateTransformationBetaInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateTransformationBetaOutput.java b/src/main/java/com/segment/publicapi/models/UpdateTransformationBetaOutput.java index 3f8cbbcf..4f25fff6 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateTransformationBetaOutput.java +++ b/src/main/java/com/segment/publicapi/models/UpdateTransformationBetaOutput.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,200 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Transformation1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * The output of an updated Transformation. - */ -@ApiModel(description = "The output of an updated Transformation.") - +/** The output of an updated Transformation. */ public class UpdateTransformationBetaOutput { - public static final String SERIALIZED_NAME_TRANSFORMATION = "transformation"; - @SerializedName(SERIALIZED_NAME_TRANSFORMATION) - private Transformation1 transformation; + public static final String SERIALIZED_NAME_TRANSFORMATION = "transformation"; - public UpdateTransformationBetaOutput() { - } + @SerializedName(SERIALIZED_NAME_TRANSFORMATION) + private TransformationBeta transformation; - public UpdateTransformationBetaOutput transformation(Transformation1 transformation) { - - this.transformation = transformation; - return this; - } + public UpdateTransformationBetaOutput() {} - /** - * Get transformation - * @return transformation - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public UpdateTransformationBetaOutput transformation(TransformationBeta transformation) { - public Transformation1 getTransformation() { - return transformation; - } + this.transformation = transformation; + return this; + } + /** + * Get transformation + * + * @return transformation + */ + @javax.annotation.Nonnull + public TransformationBeta getTransformation() { + return transformation; + } - public void setTransformation(Transformation1 transformation) { - this.transformation = transformation; - } + public void setTransformation(TransformationBeta transformation) { + this.transformation = transformation; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateTransformationBetaOutput updateTransformationBetaOutput = + (UpdateTransformationBetaOutput) o; + return Objects.equals(this.transformation, updateTransformationBetaOutput.transformation); + } + @Override + public int hashCode() { + return Objects.hash(transformation); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTransformationBetaOutput {\n"); + sb.append(" transformation: ").append(toIndentedString(transformation)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateTransformationBetaOutput updateTransformationBetaOutput = (UpdateTransformationBetaOutput) o; - return Objects.equals(this.transformation, updateTransformationBetaOutput.transformation); - } - - @Override - public int hashCode() { - return Objects.hash(transformation); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateTransformationBetaOutput {\n"); - sb.append(" transformation: ").append(toIndentedString(transformation)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transformation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("transformation"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("transformation"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("transformation"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateTransformationBetaOutput - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateTransformationBetaOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateTransformationBetaOutput is not found in the empty JSON string", UpdateTransformationBetaOutput.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateTransformationBetaOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTransformationBetaOutput.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateTransformationBetaOutput is not" + + " found in the empty JSON string", + UpdateTransformationBetaOutput.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateTransformationBetaOutput.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTransformationBetaOutput` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTransformationBetaOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateTransformationBetaOutput` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateTransformationBetaOutput.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateTransformationBetaOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `transformation` + TransformationBeta.validateJsonElement(jsonObj.get("transformation")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateTransformationBetaOutput.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateTransformationBetaOutput' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateTransformationBetaOutput.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateTransformationBetaOutput value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateTransformationBetaOutput read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTransformationBetaOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTransformationBetaOutput' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateTransformationBetaOutput.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTransformationBetaOutput value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTransformationBetaOutput read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTransformationBetaOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTransformationBetaOutput + * @throws IOException if the JSON string is invalid with respect to + * UpdateTransformationBetaOutput + */ + public static UpdateTransformationBetaOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTransformationBetaOutput.class); } - } - - /** - * Create an instance of UpdateTransformationBetaOutput given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateTransformationBetaOutput - * @throws IOException if the JSON string is invalid with respect to UpdateTransformationBetaOutput - */ - public static UpdateTransformationBetaOutput fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateTransformationBetaOutput.class); - } - - /** - * Convert an instance of UpdateTransformationBetaOutput to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateTransformationBetaOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateTransformationV1Input.java b/src/main/java/com/segment/publicapi/models/UpdateTransformationV1Input.java new file mode 100644 index 00000000..ff9bacae --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateTransformationV1Input.java @@ -0,0 +1,698 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** The input to update a Transformation. */ +public class UpdateTransformationV1Input { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; + + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; + + public static final String SERIALIZED_NAME_DESTINATION_METADATA_ID = "destinationMetadataId"; + + @SerializedName(SERIALIZED_NAME_DESTINATION_METADATA_ID) + private String destinationMetadataId; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_IF = "if"; + + @SerializedName(SERIALIZED_NAME_IF) + private String _if; + + public static final String SERIALIZED_NAME_DROP = "drop"; + + @SerializedName(SERIALIZED_NAME_DROP) + private Boolean drop; + + public static final String SERIALIZED_NAME_NEW_EVENT_NAME = "newEventName"; + + @SerializedName(SERIALIZED_NAME_NEW_EVENT_NAME) + private String newEventName; + + public static final String SERIALIZED_NAME_PROPERTY_RENAMES = "propertyRenames"; + + @SerializedName(SERIALIZED_NAME_PROPERTY_RENAMES) + private List propertyRenames; + + public static final String SERIALIZED_NAME_PROPERTY_VALUE_TRANSFORMATIONS = + "propertyValueTransformations"; + + @SerializedName(SERIALIZED_NAME_PROPERTY_VALUE_TRANSFORMATIONS) + private List propertyValueTransformations; + + public static final String SERIALIZED_NAME_FQL_DEFINED_PROPERTIES = "fqlDefinedProperties"; + + @SerializedName(SERIALIZED_NAME_FQL_DEFINED_PROPERTIES) + private List fqlDefinedProperties; + + public static final String SERIALIZED_NAME_ALLOW_PROPERTIES = "allowProperties"; + + @SerializedName(SERIALIZED_NAME_ALLOW_PROPERTIES) + private List allowProperties; + + public static final String SERIALIZED_NAME_HASH_PROPERTIES_CONFIGURATION = + "hashPropertiesConfiguration"; + + @SerializedName(SERIALIZED_NAME_HASH_PROPERTIES_CONFIGURATION) + private HashPropertiesConfiguration hashPropertiesConfiguration; + + public UpdateTransformationV1Input() {} + + public UpdateTransformationV1Input name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the Transformation. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UpdateTransformationV1Input sourceId(String sourceId) { + + this.sourceId = sourceId; + return this; + } + + /** + * The optional Source to be associated with the Transformation. + * + * @return sourceId + */ + @javax.annotation.Nullable + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public UpdateTransformationV1Input destinationMetadataId(String destinationMetadataId) { + + this.destinationMetadataId = destinationMetadataId; + return this; + } + + /** + * The optional Destination metadata to be associated with the Transformation. + * + * @return destinationMetadataId + */ + @javax.annotation.Nullable + public String getDestinationMetadataId() { + return destinationMetadataId; + } + + public void setDestinationMetadataId(String destinationMetadataId) { + this.destinationMetadataId = destinationMetadataId; + } + + public UpdateTransformationV1Input enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * If the Transformation should be enabled. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public UpdateTransformationV1Input _if(String _if) { + + this._if = _if; + return this; + } + + /** + * If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard + * event matchers, use the following: Track -\\> + * \"event='\\<eventName\\>'\" Identify -\\> + * \"type='identify'\" Group -\\> + * \"type='group'\" + * + * @return _if + */ + @javax.annotation.Nullable + public String getIf() { + return _if; + } + + public void setIf(String _if) { + this._if = _if; + } + + public UpdateTransformationV1Input drop(Boolean drop) { + + this.drop = drop; + return this; + } + + /** + * Optional boolean value if the Transformation should drop the event entirely when the if + * statement matches, ignores all other transforms. + * + * @return drop + */ + @javax.annotation.Nullable + public Boolean getDrop() { + return drop; + } + + public void setDrop(Boolean drop) { + this.drop = drop; + } + + public UpdateTransformationV1Input newEventName(String newEventName) { + + this.newEventName = newEventName; + return this; + } + + /** + * Optional new event name for renaming events. Works only for 'track' event type. + * + * @return newEventName + */ + @javax.annotation.Nullable + public String getNewEventName() { + return newEventName; + } + + public void setNewEventName(String newEventName) { + this.newEventName = newEventName; + } + + public UpdateTransformationV1Input propertyRenames(List propertyRenames) { + + this.propertyRenames = propertyRenames; + return this; + } + + public UpdateTransformationV1Input addPropertyRenamesItem( + PropertyRenameV1 propertyRenamesItem) { + if (this.propertyRenames == null) { + this.propertyRenames = new ArrayList<>(); + } + this.propertyRenames.add(propertyRenamesItem); + return this; + } + + /** + * Optional array for renaming properties collected by your events. + * + * @return propertyRenames + */ + @javax.annotation.Nullable + public List getPropertyRenames() { + return propertyRenames; + } + + public void setPropertyRenames(List propertyRenames) { + this.propertyRenames = propertyRenames; + } + + public UpdateTransformationV1Input propertyValueTransformations( + List propertyValueTransformations) { + + this.propertyValueTransformations = propertyValueTransformations; + return this; + } + + public UpdateTransformationV1Input addPropertyValueTransformationsItem( + PropertyValueTransformationV1 propertyValueTransformationsItem) { + if (this.propertyValueTransformations == null) { + this.propertyValueTransformations = new ArrayList<>(); + } + this.propertyValueTransformations.add(propertyValueTransformationsItem); + return this; + } + + /** + * Optional array for transforming properties and values collected by your events. Limited to 10 + * properties. + * + * @return propertyValueTransformations + */ + @javax.annotation.Nullable + public List getPropertyValueTransformations() { + return propertyValueTransformations; + } + + public void setPropertyValueTransformations( + List propertyValueTransformations) { + this.propertyValueTransformations = propertyValueTransformations; + } + + public UpdateTransformationV1Input fqlDefinedProperties( + List fqlDefinedProperties) { + + this.fqlDefinedProperties = fqlDefinedProperties; + return this; + } + + public UpdateTransformationV1Input addFqlDefinedPropertiesItem( + FQLDefinedPropertyV1 fqlDefinedPropertiesItem) { + if (this.fqlDefinedProperties == null) { + this.fqlDefinedProperties = new ArrayList<>(); + } + this.fqlDefinedProperties.add(fqlDefinedPropertiesItem); + return this; + } + + /** + * Optional array for updating properties defined in + * [FQL](https://segment.com/docs/config-api/fql/). Currently limited to 1 property. + * + * @return fqlDefinedProperties + */ + @javax.annotation.Nullable + public List getFqlDefinedProperties() { + return fqlDefinedProperties; + } + + public void setFqlDefinedProperties(List fqlDefinedProperties) { + this.fqlDefinedProperties = fqlDefinedProperties; + } + + public UpdateTransformationV1Input allowProperties(List allowProperties) { + + this.allowProperties = allowProperties; + return this; + } + + public UpdateTransformationV1Input addAllowPropertiesItem(String allowPropertiesItem) { + if (this.allowProperties == null) { + this.allowProperties = new ArrayList<>(); + } + this.allowProperties.add(allowPropertiesItem); + return this; + } + + /** + * Optional array for allowing properties from your events. + * + * @return allowProperties + */ + @javax.annotation.Nullable + public List getAllowProperties() { + return allowProperties; + } + + public void setAllowProperties(List allowProperties) { + this.allowProperties = allowProperties; + } + + public UpdateTransformationV1Input hashPropertiesConfiguration( + HashPropertiesConfiguration hashPropertiesConfiguration) { + + this.hashPropertiesConfiguration = hashPropertiesConfiguration; + return this; + } + + /** + * Get hashPropertiesConfiguration + * + * @return hashPropertiesConfiguration + */ + @javax.annotation.Nullable + public HashPropertiesConfiguration getHashPropertiesConfiguration() { + return hashPropertiesConfiguration; + } + + public void setHashPropertiesConfiguration( + HashPropertiesConfiguration hashPropertiesConfiguration) { + this.hashPropertiesConfiguration = hashPropertiesConfiguration; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateTransformationV1Input updateTransformationV1Input = (UpdateTransformationV1Input) o; + return Objects.equals(this.name, updateTransformationV1Input.name) + && Objects.equals(this.sourceId, updateTransformationV1Input.sourceId) + && Objects.equals( + this.destinationMetadataId, + updateTransformationV1Input.destinationMetadataId) + && Objects.equals(this.enabled, updateTransformationV1Input.enabled) + && Objects.equals(this._if, updateTransformationV1Input._if) + && Objects.equals(this.drop, updateTransformationV1Input.drop) + && Objects.equals(this.newEventName, updateTransformationV1Input.newEventName) + && Objects.equals(this.propertyRenames, updateTransformationV1Input.propertyRenames) + && Objects.equals( + this.propertyValueTransformations, + updateTransformationV1Input.propertyValueTransformations) + && Objects.equals( + this.fqlDefinedProperties, updateTransformationV1Input.fqlDefinedProperties) + && Objects.equals(this.allowProperties, updateTransformationV1Input.allowProperties) + && Objects.equals( + this.hashPropertiesConfiguration, + updateTransformationV1Input.hashPropertiesConfiguration); + } + + @Override + public int hashCode() { + return Objects.hash( + name, + sourceId, + destinationMetadataId, + enabled, + _if, + drop, + newEventName, + propertyRenames, + propertyValueTransformations, + fqlDefinedProperties, + allowProperties, + hashPropertiesConfiguration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTransformationV1Input {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" destinationMetadataId: ") + .append(toIndentedString(destinationMetadataId)) + .append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" drop: ").append(toIndentedString(drop)).append("\n"); + sb.append(" newEventName: ").append(toIndentedString(newEventName)).append("\n"); + sb.append(" propertyRenames: ").append(toIndentedString(propertyRenames)).append("\n"); + sb.append(" propertyValueTransformations: ") + .append(toIndentedString(propertyValueTransformations)) + .append("\n"); + sb.append(" fqlDefinedProperties: ") + .append(toIndentedString(fqlDefinedProperties)) + .append("\n"); + sb.append(" allowProperties: ").append(toIndentedString(allowProperties)).append("\n"); + sb.append(" hashPropertiesConfiguration: ") + .append(toIndentedString(hashPropertiesConfiguration)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("sourceId"); + openapiFields.add("destinationMetadataId"); + openapiFields.add("enabled"); + openapiFields.add("if"); + openapiFields.add("drop"); + openapiFields.add("newEventName"); + openapiFields.add("propertyRenames"); + openapiFields.add("propertyValueTransformations"); + openapiFields.add("fqlDefinedProperties"); + openapiFields.add("allowProperties"); + openapiFields.add("hashPropertiesConfiguration"); + + // 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 + * UpdateTransformationV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTransformationV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateTransformationV1Input is not" + + " found in the empty JSON string", + UpdateTransformationV1Input.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTransformationV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateTransformationV1Input` 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())); + } + if ((jsonObj.get("sourceId") != null && !jsonObj.get("sourceId").isJsonNull()) + && !jsonObj.get("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if ((jsonObj.get("destinationMetadataId") != null + && !jsonObj.get("destinationMetadataId").isJsonNull()) + && !jsonObj.get("destinationMetadataId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `destinationMetadataId` to be a primitive type in" + + " the JSON string but got `%s`", + jsonObj.get("destinationMetadataId").toString())); + } + if ((jsonObj.get("if") != null && !jsonObj.get("if").isJsonNull()) + && !jsonObj.get("if").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `if` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("if").toString())); + } + if ((jsonObj.get("newEventName") != null && !jsonObj.get("newEventName").isJsonNull()) + && !jsonObj.get("newEventName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `newEventName` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("newEventName").toString())); + } + if (jsonObj.get("propertyRenames") != null + && !jsonObj.get("propertyRenames").isJsonNull()) { + JsonArray jsonArraypropertyRenames = jsonObj.getAsJsonArray("propertyRenames"); + if (jsonArraypropertyRenames != null) { + // ensure the json data is an array + if (!jsonObj.get("propertyRenames").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyRenames` to be an array in the" + + " JSON string but got `%s`", + jsonObj.get("propertyRenames").toString())); + } + + // validate the optional field `propertyRenames` (array) + for (int i = 0; i < jsonArraypropertyRenames.size(); i++) { + PropertyRenameV1.validateJsonElement(jsonArraypropertyRenames.get(i)); + } + ; + } + } + if (jsonObj.get("propertyValueTransformations") != null + && !jsonObj.get("propertyValueTransformations").isJsonNull()) { + JsonArray jsonArraypropertyValueTransformations = + jsonObj.getAsJsonArray("propertyValueTransformations"); + if (jsonArraypropertyValueTransformations != null) { + // ensure the json data is an array + if (!jsonObj.get("propertyValueTransformations").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `propertyValueTransformations` to be an" + + " array in the JSON string but got `%s`", + jsonObj.get("propertyValueTransformations").toString())); + } + + // validate the optional field `propertyValueTransformations` (array) + for (int i = 0; i < jsonArraypropertyValueTransformations.size(); i++) { + PropertyValueTransformationV1.validateJsonElement( + jsonArraypropertyValueTransformations.get(i)); + } + ; + } + } + if (jsonObj.get("fqlDefinedProperties") != null + && !jsonObj.get("fqlDefinedProperties").isJsonNull()) { + JsonArray jsonArrayfqlDefinedProperties = + jsonObj.getAsJsonArray("fqlDefinedProperties"); + if (jsonArrayfqlDefinedProperties != null) { + // ensure the json data is an array + if (!jsonObj.get("fqlDefinedProperties").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `fqlDefinedProperties` to be an array in" + + " the JSON string but got `%s`", + jsonObj.get("fqlDefinedProperties").toString())); + } + + // validate the optional field `fqlDefinedProperties` (array) + for (int i = 0; i < jsonArrayfqlDefinedProperties.size(); i++) { + FQLDefinedPropertyV1.validateJsonElement(jsonArrayfqlDefinedProperties.get(i)); + } + ; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("allowProperties") != null + && !jsonObj.get("allowProperties").isJsonNull() + && !jsonObj.get("allowProperties").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `allowProperties` to be an array in the JSON string" + + " but got `%s`", + jsonObj.get("allowProperties").toString())); + } + // validate the optional field `hashPropertiesConfiguration` + if (jsonObj.get("hashPropertiesConfiguration") != null + && !jsonObj.get("hashPropertiesConfiguration").isJsonNull()) { + HashPropertiesConfiguration.validateJsonElement( + jsonObj.get("hashPropertiesConfiguration")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTransformationV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTransformationV1Input' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateTransformationV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTransformationV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTransformationV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTransformationV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTransformationV1Input + * @throws IOException if the JSON string is invalid with respect to UpdateTransformationV1Input + */ + public static UpdateTransformationV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTransformationV1Input.class); + } + + /** + * Convert an instance of UpdateTransformationV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateTransformationV1Output.java b/src/main/java/com/segment/publicapi/models/UpdateTransformationV1Output.java new file mode 100644 index 00000000..5599b22b --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/UpdateTransformationV1Output.java @@ -0,0 +1,207 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** The output of an updated Transformation. */ +public class UpdateTransformationV1Output { + public static final String SERIALIZED_NAME_TRANSFORMATION = "transformation"; + + @SerializedName(SERIALIZED_NAME_TRANSFORMATION) + private TransformationV1 transformation; + + public UpdateTransformationV1Output() {} + + public UpdateTransformationV1Output transformation(TransformationV1 transformation) { + + this.transformation = transformation; + return this; + } + + /** + * Get transformation + * + * @return transformation + */ + @javax.annotation.Nonnull + public TransformationV1 getTransformation() { + return transformation; + } + + public void setTransformation(TransformationV1 transformation) { + this.transformation = transformation; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateTransformationV1Output updateTransformationV1Output = + (UpdateTransformationV1Output) o; + return Objects.equals(this.transformation, updateTransformationV1Output.transformation); + } + + @Override + public int hashCode() { + return Objects.hash(transformation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTransformationV1Output {\n"); + sb.append(" transformation: ").append(toIndentedString(transformation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transformation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("transformation"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * UpdateTransformationV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTransformationV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateTransformationV1Output is not" + + " found in the empty JSON string", + UpdateTransformationV1Output.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTransformationV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateTransformationV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateTransformationV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `transformation` + TransformationV1.validateJsonElement(jsonObj.get("transformation")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTransformationV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTransformationV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateTransformationV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTransformationV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTransformationV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTransformationV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTransformationV1Output + * @throws IOException if the JSON string is invalid with respect to + * UpdateTransformationV1Output + */ + public static UpdateTransformationV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTransformationV1Output.class); + } + + /** + * Convert an instance of UpdateTransformationV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateUserGroup200Response.java b/src/main/java/com/segment/publicapi/models/UpdateUserGroup200Response.java index ba1a36dc..c46a9edc 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateUserGroup200Response.java +++ b/src/main/java/com/segment/publicapi/models/UpdateUserGroup200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateUserGroupV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateUserGroup200Response - */ - +/** UpdateUserGroup200Response */ public class UpdateUserGroup200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateUserGroupV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateUserGroup200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateUserGroupV1Output data; - public UpdateUserGroup200Response data(UpdateUserGroupV1Output data) { - - this.data = data; - return this; - } + public UpdateUserGroup200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateUserGroup200Response data(UpdateUserGroupV1Output data) { - public UpdateUserGroupV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateUserGroupV1Output getData() { + return data; + } - public void setData(UpdateUserGroupV1Output data) { - this.data = data; - } + public void setData(UpdateUserGroupV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateUserGroup200Response updateUserGroup200Response = (UpdateUserGroup200Response) o; + return Objects.equals(this.data, updateUserGroup200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateUserGroup200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateUserGroup200Response updateUserGroup200Response = (UpdateUserGroup200Response) o; - return Objects.equals(this.data, updateUserGroup200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateUserGroup200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateUserGroup200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateUserGroup200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateUserGroup200Response is not found in the empty JSON string", UpdateUserGroup200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateUserGroup200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateUserGroup200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateUserGroup200Response is not" + + " found in the empty JSON string", + UpdateUserGroup200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateUserGroup200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateUserGroup200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateUserGroup200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateUserGroup200Response` 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()) { + UpdateUserGroupV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateUserGroup200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateUserGroup200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateUserGroup200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateUserGroup200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateUserGroup200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateUserGroup200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateUserGroup200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateUserGroup200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateUserGroup200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateUserGroup200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateUserGroup200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateUserGroup200Response + * @throws IOException if the JSON string is invalid with respect to UpdateUserGroup200Response + */ + public static UpdateUserGroup200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateUserGroup200Response.class); } - } - - /** - * Create an instance of UpdateUserGroup200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateUserGroup200Response - * @throws IOException if the JSON string is invalid with respect to UpdateUserGroup200Response - */ - public static UpdateUserGroup200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateUserGroup200Response.class); - } - - /** - * Convert an instance of UpdateUserGroup200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateUserGroup200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateUserGroupV1Input.java b/src/main/java/com/segment/publicapi/models/UpdateUserGroupV1Input.java index 36e64bc7..540b688a 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateUserGroupV1Input.java +++ b/src/main/java/com/segment/publicapi/models/UpdateUserGroupV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,200 +9,199 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Updates a user group with a given id. - */ -@ApiModel(description = "Updates a user group with a given id.") - +/** Updates a user group with a given id. */ public class UpdateUserGroupV1Input { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_NAME = "name"; - public UpdateUserGroupV1Input() { - } + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public UpdateUserGroupV1Input name(String name) { - - this.name = name; - return this; - } + public UpdateUserGroupV1Input() {} - /** - * The intended value to rename the user group to. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The intended value to rename the user group to.") + public UpdateUserGroupV1Input name(String name) { - public String getName() { - return name; - } + this.name = name; + return this; + } + /** + * The intended value to rename the user group to. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public void setName(String name) { - this.name = 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; + } + UpdateUserGroupV1Input updateUserGroupV1Input = (UpdateUserGroupV1Input) o; + return Objects.equals(this.name, updateUserGroupV1Input.name); + } + @Override + public int hashCode() { + return Objects.hash(name); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateUserGroupV1Input {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateUserGroupV1Input updateUserGroupV1Input = (UpdateUserGroupV1Input) o; - return Objects.equals(this.name, updateUserGroupV1Input.name); - } - - @Override - public int hashCode() { - return Objects.hash(name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateUserGroupV1Input {\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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); } - return o.toString().replace("\n", "\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"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateUserGroupV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateUserGroupV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateUserGroupV1Input is not found in the empty JSON string", UpdateUserGroupV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateUserGroupV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateUserGroupV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateUserGroupV1Input is not found in" + + " the empty JSON string", + UpdateUserGroupV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateUserGroupV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateUserGroupV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateUserGroupV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateUserGroupV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateUserGroupV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!UpdateUserGroupV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateUserGroupV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateUserGroupV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateUserGroupV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateUserGroupV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of UpdateUserGroupV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateUserGroupV1Input - * @throws IOException if the JSON string is invalid with respect to UpdateUserGroupV1Input - */ - public static UpdateUserGroupV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateUserGroupV1Input.class); - } - - /** - * Convert an instance of UpdateUserGroupV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateUserGroupV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateUserGroupV1Input' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateUserGroupV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateUserGroupV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateUserGroupV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateUserGroupV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateUserGroupV1Input + * @throws IOException if the JSON string is invalid with respect to UpdateUserGroupV1Input + */ + public static UpdateUserGroupV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateUserGroupV1Input.class); + } + + /** + * Convert an instance of UpdateUserGroupV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateUserGroupV1Output.java b/src/main/java/com/segment/publicapi/models/UpdateUserGroupV1Output.java index 06d5d690..1b6e9788 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateUserGroupV1Output.java +++ b/src/main/java/com/segment/publicapi/models/UpdateUserGroupV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UserGroup3; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the updated user group. - */ -@ApiModel(description = "Returns the updated user group.") - +/** Returns the updated user group. */ public class UpdateUserGroupV1Output { - public static final String SERIALIZED_NAME_USER_GROUP = "userGroup"; - @SerializedName(SERIALIZED_NAME_USER_GROUP) - private UserGroup3 userGroup; + public static final String SERIALIZED_NAME_USER_GROUP = "userGroup"; - public UpdateUserGroupV1Output() { - } + @SerializedName(SERIALIZED_NAME_USER_GROUP) + private UserGroupV1 userGroup; - public UpdateUserGroupV1Output userGroup(UserGroup3 userGroup) { - - this.userGroup = userGroup; - return this; - } + public UpdateUserGroupV1Output() {} - /** - * Get userGroup - * @return userGroup - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public UpdateUserGroupV1Output userGroup(UserGroupV1 userGroup) { - public UserGroup3 getUserGroup() { - return userGroup; - } + this.userGroup = userGroup; + return this; + } + /** + * Get userGroup + * + * @return userGroup + */ + @javax.annotation.Nonnull + public UserGroupV1 getUserGroup() { + return userGroup; + } - public void setUserGroup(UserGroup3 userGroup) { - this.userGroup = userGroup; - } + public void setUserGroup(UserGroupV1 userGroup) { + this.userGroup = userGroup; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateUserGroupV1Output updateUserGroupV1Output = (UpdateUserGroupV1Output) o; + return Objects.equals(this.userGroup, updateUserGroupV1Output.userGroup); + } + @Override + public int hashCode() { + return Objects.hash(userGroup); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateUserGroupV1Output {\n"); + sb.append(" userGroup: ").append(toIndentedString(userGroup)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateUserGroupV1Output updateUserGroupV1Output = (UpdateUserGroupV1Output) o; - return Objects.equals(this.userGroup, updateUserGroupV1Output.userGroup); - } - - @Override - public int hashCode() { - return Objects.hash(userGroup); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateUserGroupV1Output {\n"); - sb.append(" userGroup: ").append(toIndentedString(userGroup)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("userGroup"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("userGroup"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("userGroup"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("userGroup"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateUserGroupV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateUserGroupV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateUserGroupV1Output is not found in the empty JSON string", UpdateUserGroupV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateUserGroupV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateUserGroupV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateUserGroupV1Output is not found" + + " in the empty JSON string", + UpdateUserGroupV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateUserGroupV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateUserGroupV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateUserGroupV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateUserGroupV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateUserGroupV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateUserGroupV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `userGroup` + UserGroupV1.validateJsonElement(jsonObj.get("userGroup")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateUserGroupV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateUserGroupV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateUserGroupV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateUserGroupV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateUserGroupV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateUserGroupV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateUserGroupV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateUserGroupV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateUserGroupV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateUserGroupV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateUserGroupV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateUserGroupV1Output + * @throws IOException if the JSON string is invalid with respect to UpdateUserGroupV1Output + */ + public static UpdateUserGroupV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateUserGroupV1Output.class); } - } - - /** - * Create an instance of UpdateUserGroupV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateUserGroupV1Output - * @throws IOException if the JSON string is invalid with respect to UpdateUserGroupV1Output - */ - public static UpdateUserGroupV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateUserGroupV1Output.class); - } - - /** - * Convert an instance of UpdateUserGroupV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateUserGroupV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateWarehouse200Response.java b/src/main/java/com/segment/publicapi/models/UpdateWarehouse200Response.java index 8d8c6845..c99a6608 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateWarehouse200Response.java +++ b/src/main/java/com/segment/publicapi/models/UpdateWarehouse200Response.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,197 +9,186 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.UpdateWarehouseV1Output; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpdateWarehouse200Response - */ - +/** UpdateWarehouse200Response */ public class UpdateWarehouse200Response { - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private UpdateWarehouseV1Output data; + public static final String SERIALIZED_NAME_DATA = "data"; - public UpdateWarehouse200Response() { - } + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateWarehouseV1Output data; - public UpdateWarehouse200Response data(UpdateWarehouseV1Output data) { - - this.data = data; - return this; - } + public UpdateWarehouse200Response() {} - /** - * Get data - * @return data - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") + public UpdateWarehouse200Response data(UpdateWarehouseV1Output data) { - public UpdateWarehouseV1Output getData() { - return data; - } + this.data = data; + return this; + } + /** + * Get data + * + * @return data + */ + @javax.annotation.Nullable + public UpdateWarehouseV1Output getData() { + return data; + } - public void setData(UpdateWarehouseV1Output data) { - this.data = data; - } + public void setData(UpdateWarehouseV1Output data) { + this.data = data; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWarehouse200Response updateWarehouse200Response = (UpdateWarehouse200Response) o; + return Objects.equals(this.data, updateWarehouse200Response.data); + } + @Override + public int hashCode() { + return Objects.hash(data); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateWarehouse200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateWarehouse200Response updateWarehouse200Response = (UpdateWarehouse200Response) o; - return Objects.equals(this.data, updateWarehouse200Response.data); - } - - @Override - public int hashCode() { - return Objects.hash(data); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateWarehouse200Response {\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"; + + 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(); } - return o.toString().replace("\n", "\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 Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateWarehouse200Response - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateWarehouse200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateWarehouse200Response is not found in the empty JSON string", UpdateWarehouse200Response.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateWarehouse200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateWarehouse200Response.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateWarehouse200Response is not" + + " found in the empty JSON string", + UpdateWarehouse200Response.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateWarehouse200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateWarehouse200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateWarehouse200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateWarehouse200Response` 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()) { + UpdateWarehouseV1Output.validateJsonElement(jsonObj.get("data")); } - } - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateWarehouse200Response.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateWarehouse200Response' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateWarehouse200Response.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateWarehouse200Response value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateWarehouse200Response read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateWarehouse200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateWarehouse200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateWarehouse200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateWarehouse200Response value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateWarehouse200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateWarehouse200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateWarehouse200Response + * @throws IOException if the JSON string is invalid with respect to UpdateWarehouse200Response + */ + public static UpdateWarehouse200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateWarehouse200Response.class); } - } - - /** - * Create an instance of UpdateWarehouse200Response given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateWarehouse200Response - * @throws IOException if the JSON string is invalid with respect to UpdateWarehouse200Response - */ - public static UpdateWarehouse200Response fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateWarehouse200Response.class); - } - - /** - * Convert an instance of UpdateWarehouse200Response to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateWarehouse200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateWarehouseV1Input.java b/src/main/java/com/segment/publicapi/models/UpdateWarehouseV1Input.java index 3a56a3a2..b3d1d0ac 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateWarehouseV1Input.java +++ b/src/main/java/com/segment/publicapi/models/UpdateWarehouseV1Input.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,273 +9,283 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.Map; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; +import org.openapitools.jackson.nullable.JsonNullable; -import com.segment.publicapi.JSON; - -/** - * Updates an existing Warehouse based on a set of parameters. - */ -@ApiModel(description = "Updates an existing Warehouse based on a set of parameters.") - +/** Updates an existing Warehouse based on a set of parameters. */ public class UpdateWarehouseV1Input { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public UpdateWarehouseV1Input() { - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public UpdateWarehouseV1Input name(String name) { - - this.name = name; - return this; - } + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - /** - * An optional human-readable name to associate with this Warehouse. - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "An optional human-readable name to associate with this Warehouse.") + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; - public String getName() { - return name; - } + public UpdateWarehouseV1Input() {} + public UpdateWarehouseV1Input name(String name) { - public void setName(String name) { - this.name = name; - } + this.name = name; + return this; + } + /** + * An optional human-readable name to associate with this Warehouse. + * + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - public UpdateWarehouseV1Input enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public void setName(String name) { + this.name = name; + } - /** - * Enable to allow this Warehouse to receive data. - * @return enabled - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Enable to allow this Warehouse to receive data.") + public UpdateWarehouseV1Input enabled(Boolean enabled) { - public Boolean getEnabled() { - return enabled; - } + this.enabled = enabled; + return this; + } + /** + * Enable to allow this Warehouse to receive data. + * + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + public UpdateWarehouseV1Input settings(Map settings) { - public UpdateWarehouseV1Input settings(Map settings) { - - this.settings = settings; - return this; - } + this.settings = settings; + return this; + } - /** - * A key-value object that contains instance-specific settings for a Warehouse. Different kinds of Warehouses require different settings. The required and optional settings for a Warehouse are described in the `options` object of the associated Warehouse metadata. You can find the full list of Warehouse metadata and related settings information in the `/catalog/warehouses` endpoint. - * @return settings - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A key-value object that contains instance-specific settings for a Warehouse. Different kinds of Warehouses require different settings. The required and optional settings for a Warehouse are described in the `options` object of the associated Warehouse metadata. You can find the full list of Warehouse metadata and related settings information in the `/catalog/warehouses` endpoint.") + public UpdateWarehouseV1Input putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } - public Map getSettings() { - return settings; - } + /** + * A key-value object that contains instance-specific Warehouse settings. + * + * @return settings + */ + @javax.annotation.Nonnull + public Map getSettings() { + return settings; + } + public void setSettings(Map settings) { + this.settings = settings; + } - public void setSettings(Map settings) { - this.settings = settings; - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWarehouseV1Input updateWarehouseV1Input = (UpdateWarehouseV1Input) o; + return Objects.equals(this.name, updateWarehouseV1Input.name) + && Objects.equals(this.enabled, updateWarehouseV1Input.enabled) + && Objects.equals(this.settings, updateWarehouseV1Input.settings); + } + 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(name, enabled, settings); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateWarehouseV1Input {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); } - UpdateWarehouseV1Input updateWarehouseV1Input = (UpdateWarehouseV1Input) o; - return Objects.equals(this.name, updateWarehouseV1Input.name) && - Objects.equals(this.enabled, updateWarehouseV1Input.enabled) && - Objects.equals(this.settings, updateWarehouseV1Input.settings); - } - - 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(name, enabled, settings); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateWarehouseV1Input {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("enabled"); + openapiFields.add("settings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("settings"); } - return o.toString().replace("\n", "\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("enabled"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateWarehouseV1Input - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateWarehouseV1Input.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateWarehouseV1Input is not found in the empty JSON string", UpdateWarehouseV1Input.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateWarehouseV1Input + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateWarehouseV1Input.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateWarehouseV1Input is not found in" + + " the empty JSON string", + UpdateWarehouseV1Input.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateWarehouseV1Input.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateWarehouseV1Input` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateWarehouseV1Input.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateWarehouseV1Input` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateWarehouseV1Input.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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") != 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 (!UpdateWarehouseV1Input.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateWarehouseV1Input' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateWarehouseV1Input.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateWarehouseV1Input value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateWarehouseV1Input read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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 (!UpdateWarehouseV1Input.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateWarehouseV1Input' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateWarehouseV1Input.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateWarehouseV1Input value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateWarehouseV1Input read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of UpdateWarehouseV1Input given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateWarehouseV1Input - * @throws IOException if the JSON string is invalid with respect to UpdateWarehouseV1Input - */ - public static UpdateWarehouseV1Input fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateWarehouseV1Input.class); - } - - /** - * Convert an instance of UpdateWarehouseV1Input to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of UpdateWarehouseV1Input given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateWarehouseV1Input + * @throws IOException if the JSON string is invalid with respect to UpdateWarehouseV1Input + */ + public static UpdateWarehouseV1Input fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateWarehouseV1Input.class); + } + + /** + * Convert an instance of UpdateWarehouseV1Input to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpdateWarehouseV1Output.java b/src/main/java/com/segment/publicapi/models/UpdateWarehouseV1Output.java index 6c197b63..2f47221f 100644 --- a/src/main/java/com/segment/publicapi/models/UpdateWarehouseV1Output.java +++ b/src/main/java/com/segment/publicapi/models/UpdateWarehouseV1Output.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,206 +9,195 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Warehouse2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Returns the updated Warehouse. - */ -@ApiModel(description = "Returns the updated Warehouse.") - +/** Returns the updated Warehouse. */ public class UpdateWarehouseV1Output { - public static final String SERIALIZED_NAME_WAREHOUSE = "warehouse"; - @SerializedName(SERIALIZED_NAME_WAREHOUSE) - private Warehouse2 warehouse; + public static final String SERIALIZED_NAME_WAREHOUSE = "warehouse"; - public UpdateWarehouseV1Output() { - } + @SerializedName(SERIALIZED_NAME_WAREHOUSE) + private WarehouseV1 warehouse; - public UpdateWarehouseV1Output warehouse(Warehouse2 warehouse) { - - this.warehouse = warehouse; - return this; - } + public UpdateWarehouseV1Output() {} - /** - * Get warehouse - * @return warehouse - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public UpdateWarehouseV1Output warehouse(WarehouseV1 warehouse) { - public Warehouse2 getWarehouse() { - return warehouse; - } + this.warehouse = warehouse; + return this; + } + /** + * Get warehouse + * + * @return warehouse + */ + @javax.annotation.Nonnull + public WarehouseV1 getWarehouse() { + return warehouse; + } - public void setWarehouse(Warehouse2 warehouse) { - this.warehouse = warehouse; - } + public void setWarehouse(WarehouseV1 warehouse) { + this.warehouse = warehouse; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWarehouseV1Output updateWarehouseV1Output = (UpdateWarehouseV1Output) o; + return Objects.equals(this.warehouse, updateWarehouseV1Output.warehouse); + } + @Override + public int hashCode() { + return Objects.hash(warehouse); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateWarehouseV1Output {\n"); + sb.append(" warehouse: ").append(toIndentedString(warehouse)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UpdateWarehouseV1Output updateWarehouseV1Output = (UpdateWarehouseV1Output) o; - return Objects.equals(this.warehouse, updateWarehouseV1Output.warehouse); - } - - @Override - public int hashCode() { - return Objects.hash(warehouse); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateWarehouseV1Output {\n"); - sb.append(" warehouse: ").append(toIndentedString(warehouse)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("warehouse"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("warehouse"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("warehouse"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("warehouse"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpdateWarehouseV1Output - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpdateWarehouseV1Output.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateWarehouseV1Output is not found in the empty JSON string", UpdateWarehouseV1Output.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateWarehouseV1Output + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateWarehouseV1Output.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpdateWarehouseV1Output is not found" + + " in the empty JSON string", + UpdateWarehouseV1Output.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpdateWarehouseV1Output.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateWarehouseV1Output` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateWarehouseV1Output.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpdateWarehouseV1Output` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateWarehouseV1Output.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateWarehouseV1Output.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `warehouse` + WarehouseV1.validateJsonElement(jsonObj.get("warehouse")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateWarehouseV1Output' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateWarehouseV1Output.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateWarehouseV1Output value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateWarehouseV1Output read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateWarehouseV1Output.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateWarehouseV1Output' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateWarehouseV1Output.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateWarehouseV1Output value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateWarehouseV1Output read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateWarehouseV1Output given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateWarehouseV1Output + * @throws IOException if the JSON string is invalid with respect to UpdateWarehouseV1Output + */ + public static UpdateWarehouseV1Output fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateWarehouseV1Output.class); } - } - - /** - * Create an instance of UpdateWarehouseV1Output given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateWarehouseV1Output - * @throws IOException if the JSON string is invalid with respect to UpdateWarehouseV1Output - */ - public static UpdateWarehouseV1Output fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateWarehouseV1Output.class); - } - - /** - * Convert an instance of UpdateWarehouseV1Output to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of UpdateWarehouseV1Output to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UpsertRuleV1.java b/src/main/java/com/segment/publicapi/models/UpsertRuleV1.java index 1cf211ad..7e5bd83a 100644 --- a/src/main/java/com/segment/publicapi/models/UpsertRuleV1.java +++ b/src/main/java/com/segment/publicapi/models/UpsertRuleV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,490 +9,384 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * UpsertRuleV1 - */ - +/** UpsertRuleV1 */ public class UpsertRuleV1 { - public static final String SERIALIZED_NAME_NEW_KEY = "newKey"; - @SerializedName(SERIALIZED_NAME_NEW_KEY) - private String newKey; - - /** - * The type for this Tracking Plan rule. - */ - @JsonAdapter(TypeEnum.Adapter.class) - public enum TypeEnum { - COMMON("COMMON"), - - GROUP("GROUP"), - - IDENTIFY("IDENTIFY"), - - PAGE("PAGE"), - - SCREEN("SCREEN"), - - TRACK("TRACK"); - - 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_NEW_KEY = "newKey"; - public static final String SERIALIZED_NAME_KEY = "key"; - @SerializedName(SERIALIZED_NAME_KEY) - private String key; + @SerializedName(SERIALIZED_NAME_NEW_KEY) + private String newKey; - public static final String SERIALIZED_NAME_JSON_SCHEMA = "jsonSchema"; - @SerializedName(SERIALIZED_NAME_JSON_SCHEMA) - private Object jsonSchema = null; + /** The type for this Tracking Plan rule. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + COMMON("COMMON"), - public static final String SERIALIZED_NAME_VERSION = "version"; - @SerializedName(SERIALIZED_NAME_VERSION) - private BigDecimal version; + GROUP("GROUP"), - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private String createdAt; + IDENTIFY("IDENTIFY"), - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private String updatedAt; + PAGE("PAGE"), - public static final String SERIALIZED_NAME_DEPRECATED_AT = "deprecatedAt"; - @SerializedName(SERIALIZED_NAME_DEPRECATED_AT) - private String deprecatedAt; + SCREEN("SCREEN"), - public UpsertRuleV1() { - } + TRACK("TRACK"); - public UpsertRuleV1 newKey(String newKey) { - - this.newKey = newKey; - return this; - } - - /** - * This rule's new intended key. - * @return newKey - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "This rule's new intended key.") - - public String getNewKey() { - return newKey; - } - - - public void setNewKey(String newKey) { - this.newKey = newKey; - } - - - public UpsertRuleV1 type(TypeEnum type) { - - this.type = type; - return this; - } - - /** - * The type for this Tracking Plan rule. - * @return type - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The type for this Tracking Plan rule.") - - public TypeEnum getType() { - return type; - } + private String value; + TypeEnum(String value) { + this.value = value; + } - public void setType(TypeEnum type) { - this.type = type; - } + public String getValue() { + return value; + } + @Override + public String toString() { + return String.valueOf(value); + } - public UpsertRuleV1 key(String key) { - - this.key = key; - return this; - } + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - /** - * Key to this rule (free-form string like 'Button clicked'). - * @return key - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Key to this rule (free-form string like 'Button clicked').") + 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 String getKey() { - return key; - } + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; - public void setKey(String key) { - this.key = key; - } + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + private String key; - public UpsertRuleV1 jsonSchema(Object jsonSchema) { - - this.jsonSchema = jsonSchema; - return this; - } + public static final String SERIALIZED_NAME_JSON_SCHEMA = "jsonSchema"; - /** - * JSON Schema of this rule. - * @return jsonSchema - **/ - @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "JSON Schema of this rule.") + @SerializedName(SERIALIZED_NAME_JSON_SCHEMA) + private Object jsonSchema = null; - public Object getJsonSchema() { - return jsonSchema; - } + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private BigDecimal version; - public void setJsonSchema(Object jsonSchema) { - this.jsonSchema = jsonSchema; - } + public UpsertRuleV1() {} + public UpsertRuleV1 newKey(String newKey) { - public UpsertRuleV1 version(BigDecimal version) { - - this.version = version; - return this; - } + this.newKey = newKey; + return this; + } - /** - * Version of this rule. - * @return version - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Version of this rule.") + /** + * This rule's new intended key. + * + * @return newKey + */ + @javax.annotation.Nullable + public String getNewKey() { + return newKey; + } - public BigDecimal getVersion() { - return version; - } + public void setNewKey(String newKey) { + this.newKey = newKey; + } + public UpsertRuleV1 type(TypeEnum type) { - public void setVersion(BigDecimal version) { - this.version = version; - } + this.type = type; + return this; + } + /** + * The type for this Tracking Plan rule. + * + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } - public UpsertRuleV1 createdAt(String createdAt) { - - this.createdAt = createdAt; - return this; - } + public void setType(TypeEnum type) { + this.type = type; + } - /** - * The timestamp of this rule's creation. - * @return createdAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The timestamp of this rule's creation.") + public UpsertRuleV1 key(String key) { - public String getCreatedAt() { - return createdAt; - } + this.key = key; + return this; + } + /** + * Key to this rule (free-form string like 'Button clicked'). + * + * @return key + */ + @javax.annotation.Nullable + public String getKey() { + return key; + } - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } + public void setKey(String key) { + this.key = key; + } + public UpsertRuleV1 jsonSchema(Object jsonSchema) { - public UpsertRuleV1 updatedAt(String updatedAt) { - - this.updatedAt = updatedAt; - return this; - } + this.jsonSchema = jsonSchema; + return this; + } - /** - * The timestamp of this rule's last change. - * @return updatedAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The timestamp of this rule's last change.") + /** + * JSON Schema of this rule. + * + * @return jsonSchema + */ + @javax.annotation.Nullable + public Object getJsonSchema() { + return jsonSchema; + } - public String getUpdatedAt() { - return updatedAt; - } + public void setJsonSchema(Object jsonSchema) { + this.jsonSchema = jsonSchema; + } + public UpsertRuleV1 version(BigDecimal version) { - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } + this.version = version; + return this; + } + /** + * Version of this rule. + * + * @return version + */ + @javax.annotation.Nonnull + public BigDecimal getVersion() { + return version; + } - public UpsertRuleV1 deprecatedAt(String deprecatedAt) { - - this.deprecatedAt = deprecatedAt; - return this; - } + public void setVersion(BigDecimal version) { + this.version = version; + } - /** - * The timestamp of this rule's deprecation. - * @return deprecatedAt - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The timestamp of this rule's deprecation.") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpsertRuleV1 upsertRuleV1 = (UpsertRuleV1) o; + return Objects.equals(this.newKey, upsertRuleV1.newKey) + && Objects.equals(this.type, upsertRuleV1.type) + && Objects.equals(this.key, upsertRuleV1.key) + && Objects.equals(this.jsonSchema, upsertRuleV1.jsonSchema) + && Objects.equals(this.version, upsertRuleV1.version); + } - public String getDeprecatedAt() { - return deprecatedAt; - } + @Override + public int hashCode() { + return Objects.hash(newKey, type, key, jsonSchema, version); + } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertRuleV1 {\n"); + sb.append(" newKey: ").append(toIndentedString(newKey)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" jsonSchema: ").append(toIndentedString(jsonSchema)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public void setDeprecatedAt(String deprecatedAt) { - this.deprecatedAt = deprecatedAt; - } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("newKey"); + openapiFields.add("type"); + openapiFields.add("key"); + openapiFields.add("jsonSchema"); + openapiFields.add("version"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("jsonSchema"); + openapiRequiredFields.add("version"); + } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpsertRuleV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpsertRuleV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UpsertRuleV1 is not found in the empty" + + " JSON string", + UpsertRuleV1.openapiRequiredFields.toString())); + } + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpsertRuleV1 upsertRuleV1 = (UpsertRuleV1) o; - return Objects.equals(this.newKey, upsertRuleV1.newKey) && - Objects.equals(this.type, upsertRuleV1.type) && - Objects.equals(this.key, upsertRuleV1.key) && - Objects.equals(this.jsonSchema, upsertRuleV1.jsonSchema) && - Objects.equals(this.version, upsertRuleV1.version) && - Objects.equals(this.createdAt, upsertRuleV1.createdAt) && - Objects.equals(this.updatedAt, upsertRuleV1.updatedAt) && - Objects.equals(this.deprecatedAt, upsertRuleV1.deprecatedAt); - } - - @Override - public int hashCode() { - return Objects.hash(newKey, type, key, jsonSchema, version, createdAt, updatedAt, deprecatedAt); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpsertRuleV1 {\n"); - sb.append(" newKey: ").append(toIndentedString(newKey)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" jsonSchema: ").append(toIndentedString(jsonSchema)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); - sb.append(" deprecatedAt: ").append(toIndentedString(deprecatedAt)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("newKey"); - openapiFields.add("type"); - openapiFields.add("key"); - openapiFields.add("jsonSchema"); - openapiFields.add("version"); - openapiFields.add("createdAt"); - openapiFields.add("updatedAt"); - openapiFields.add("deprecatedAt"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("type"); - openapiRequiredFields.add("jsonSchema"); - openapiRequiredFields.add("version"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UpsertRuleV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UpsertRuleV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UpsertRuleV1 is not found in the empty JSON string", UpsertRuleV1.openapiRequiredFields.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpsertRuleV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UpsertRuleV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UpsertRuleV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpsertRuleV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpsertRuleV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("newKey") != null && !jsonObj.get("newKey").isJsonNull()) + && !jsonObj.get("newKey").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `newKey` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("newKey").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("key") != null && !jsonObj.get("key").isJsonNull()) + && !jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `key` to be a primitive type in the JSON string but" + + " got `%s`", + jsonObj.get("key").toString())); + } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpsertRuleV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpsertRuleV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpsertRuleV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpsertRuleV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpsertRuleV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpsertRuleV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - if ((jsonObj.get("newKey") != null && !jsonObj.get("newKey").isJsonNull()) && !jsonObj.get("newKey").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `newKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("newKey").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("key") != null && !jsonObj.get("key").isJsonNull()) && !jsonObj.get("key").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); - } - if ((jsonObj.get("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) && !jsonObj.get("createdAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); - } - 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("deprecatedAt") != null && !jsonObj.get("deprecatedAt").isJsonNull()) && !jsonObj.get("deprecatedAt").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `deprecatedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deprecatedAt").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpsertRuleV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpsertRuleV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpsertRuleV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UpsertRuleV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpsertRuleV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of UpsertRuleV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpsertRuleV1 - * @throws IOException if the JSON string is invalid with respect to UpsertRuleV1 - */ - public static UpsertRuleV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpsertRuleV1.class); - } - - /** - * Convert an instance of UpsertRuleV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of UpsertRuleV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpsertRuleV1 + * @throws IOException if the JSON string is invalid with respect to UpsertRuleV1 + */ + public static UpsertRuleV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpsertRuleV1.class); + } + + /** + * Convert an instance of UpsertRuleV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/User.java b/src/main/java/com/segment/publicapi/models/User.java deleted file mode 100644 index 029b2a6c..00000000 --- a/src/main/java/com/segment/publicapi/models/User.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PermissionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The user object. - */ -@ApiModel(description = "The user object.") - -public class User { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_EMAIL = "email"; - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; - - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions = null; - - public User() { - } - - public User id(String id) { - - this.id = id; - return this; - } - - /** - * The unique identifier of this user. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier of this user. Config API note: analogous to `name`.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public User name(String name) { - - this.name = name; - return this; - } - - /** - * The human-readable name of this user. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The human-readable name of this user.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public User email(String email) { - - this.email = email; - return this; - } - - /** - * The email address associated with this user. - * @return email - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The email address associated with this user.") - - public String getEmail() { - return email; - } - - - public void setEmail(String email) { - this.email = email; - } - - - public User permissions(List permissions) { - - this.permissions = permissions; - return this; - } - - public User addPermissionsItem(PermissionV1 permissionsItem) { - if (this.permissions == null) { - this.permissions = new ArrayList<>(); - } - this.permissions.add(permissionsItem); - return this; - } - - /** - * The permissions associated with this user. - * @return permissions - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The permissions associated with this user.") - - public List getPermissions() { - return permissions; - } - - - public void setPermissions(List permissions) { - this.permissions = permissions; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - User user = (User) o; - return Objects.equals(this.id, user.id) && - Objects.equals(this.name, user.name) && - Objects.equals(this.email, user.email) && - Objects.equals(this.permissions, user.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, email, permissions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class User {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("email"); - openapiFields.add("permissions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("email"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to User - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!User.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `User` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : User.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("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("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { - JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - if (jsonArraypermissions != null) { - // ensure the json data is an array - if (!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 (!User.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'User' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(User.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, User value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public User read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of User given an JSON string - * - * @param jsonString JSON string - * @return An instance of User - * @throws IOException if the JSON string is invalid with respect to User - */ - public static User fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, User.class); - } - - /** - * Convert an instance of User to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/UserGroup.java b/src/main/java/com/segment/publicapi/models/UserGroup.java deleted file mode 100644 index 9766d381..00000000 --- a/src/main/java/com/segment/publicapi/models/UserGroup.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PermissionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The newly created user group. - */ -@ApiModel(description = "The newly created user group.") - -public class UserGroup { - public static final String SERIALIZED_NAME_MEMBER_COUNT = "memberCount"; - @SerializedName(SERIALIZED_NAME_MEMBER_COUNT) - private BigDecimal memberCount; - - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions = null; - - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public UserGroup() { - } - - public UserGroup memberCount(BigDecimal memberCount) { - - this.memberCount = memberCount; - return this; - } - - /** - * The number of members in the user group. - * @return memberCount - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The number of members in the user group.") - - public BigDecimal getMemberCount() { - return memberCount; - } - - - public void setMemberCount(BigDecimal memberCount) { - this.memberCount = memberCount; - } - - - public UserGroup permissions(List permissions) { - - this.permissions = permissions; - return this; - } - - public UserGroup addPermissionsItem(PermissionV1 permissionsItem) { - if (this.permissions == null) { - this.permissions = new ArrayList<>(); - } - this.permissions.add(permissionsItem); - return this; - } - - /** - * The permissions associated with the user group. - * @return permissions - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The permissions associated with the user group.") - - public List getPermissions() { - return permissions; - } - - - public void setPermissions(List permissions) { - this.permissions = permissions; - } - - - public UserGroup id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the user group. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the user group.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public UserGroup name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the user group. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the user group.") - - 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; - } - UserGroup userGroup = (UserGroup) o; - return Objects.equals(this.memberCount, userGroup.memberCount) && - Objects.equals(this.permissions, userGroup.permissions) && - Objects.equals(this.id, userGroup.id) && - Objects.equals(this.name, userGroup.name); - } - - @Override - public int hashCode() { - return Objects.hash(memberCount, permissions, id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UserGroup {\n"); - sb.append(" memberCount: ").append(toIndentedString(memberCount)).append("\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).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("memberCount"); - openapiFields.add("permissions"); - openapiFields.add("id"); - openapiFields.add("name"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("memberCount"); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UserGroup - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UserGroup.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UserGroup is not found in the empty JSON string", UserGroup.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UserGroup.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserGroup` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UserGroup.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); - } - } - if (jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { - JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - if (jsonArraypermissions != null) { - // ensure the json data is an array - if (!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())); - } - } - } - 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("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 (!UserGroup.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UserGroup' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UserGroup.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UserGroup value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UserGroup read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of UserGroup given an JSON string - * - * @param jsonString JSON string - * @return An instance of UserGroup - * @throws IOException if the JSON string is invalid with respect to UserGroup - */ - public static UserGroup fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UserGroup.class); - } - - /** - * Convert an instance of UserGroup to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/UserGroup1.java b/src/main/java/com/segment/publicapi/models/UserGroup1.java deleted file mode 100644 index 3bf09d05..00000000 --- a/src/main/java/com/segment/publicapi/models/UserGroup1.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PermissionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The updated the user group. - */ -@ApiModel(description = "The updated the user group.") - -public class UserGroup1 { - public static final String SERIALIZED_NAME_MEMBER_COUNT = "memberCount"; - @SerializedName(SERIALIZED_NAME_MEMBER_COUNT) - private BigDecimal memberCount; - - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions = null; - - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public UserGroup1() { - } - - public UserGroup1 memberCount(BigDecimal memberCount) { - - this.memberCount = memberCount; - return this; - } - - /** - * The number of members in the user group. - * @return memberCount - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The number of members in the user group.") - - public BigDecimal getMemberCount() { - return memberCount; - } - - - public void setMemberCount(BigDecimal memberCount) { - this.memberCount = memberCount; - } - - - public UserGroup1 permissions(List permissions) { - - this.permissions = permissions; - return this; - } - - public UserGroup1 addPermissionsItem(PermissionV1 permissionsItem) { - if (this.permissions == null) { - this.permissions = new ArrayList<>(); - } - this.permissions.add(permissionsItem); - return this; - } - - /** - * The permissions associated with the user group. - * @return permissions - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The permissions associated with the user group.") - - public List getPermissions() { - return permissions; - } - - - public void setPermissions(List permissions) { - this.permissions = permissions; - } - - - public UserGroup1 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the user group. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the user group.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public UserGroup1 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the user group. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the user group.") - - 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; - } - UserGroup1 userGroup1 = (UserGroup1) o; - return Objects.equals(this.memberCount, userGroup1.memberCount) && - Objects.equals(this.permissions, userGroup1.permissions) && - Objects.equals(this.id, userGroup1.id) && - Objects.equals(this.name, userGroup1.name); - } - - @Override - public int hashCode() { - return Objects.hash(memberCount, permissions, id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UserGroup1 {\n"); - sb.append(" memberCount: ").append(toIndentedString(memberCount)).append("\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).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("memberCount"); - openapiFields.add("permissions"); - openapiFields.add("id"); - openapiFields.add("name"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("memberCount"); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UserGroup1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UserGroup1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UserGroup1 is not found in the empty JSON string", UserGroup1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UserGroup1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserGroup1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UserGroup1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); - } - } - if (jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { - JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - if (jsonArraypermissions != null) { - // ensure the json data is an array - if (!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())); - } - } - } - 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("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 (!UserGroup1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UserGroup1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UserGroup1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UserGroup1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UserGroup1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of UserGroup1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of UserGroup1 - * @throws IOException if the JSON string is invalid with respect to UserGroup1 - */ - public static UserGroup1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UserGroup1.class); - } - - /** - * Convert an instance of UserGroup1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/UserGroup2.java b/src/main/java/com/segment/publicapi/models/UserGroup2.java deleted file mode 100644 index f342fd51..00000000 --- a/src/main/java/com/segment/publicapi/models/UserGroup2.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PermissionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The user group returned from the query. - */ -@ApiModel(description = "The user group returned from the query.") - -public class UserGroup2 { - public static final String SERIALIZED_NAME_MEMBER_COUNT = "memberCount"; - @SerializedName(SERIALIZED_NAME_MEMBER_COUNT) - private BigDecimal memberCount; - - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions = null; - - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public UserGroup2() { - } - - public UserGroup2 memberCount(BigDecimal memberCount) { - - this.memberCount = memberCount; - return this; - } - - /** - * The number of members in the user group. - * @return memberCount - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The number of members in the user group.") - - public BigDecimal getMemberCount() { - return memberCount; - } - - - public void setMemberCount(BigDecimal memberCount) { - this.memberCount = memberCount; - } - - - public UserGroup2 permissions(List permissions) { - - this.permissions = permissions; - return this; - } - - public UserGroup2 addPermissionsItem(PermissionV1 permissionsItem) { - if (this.permissions == null) { - this.permissions = new ArrayList<>(); - } - this.permissions.add(permissionsItem); - return this; - } - - /** - * The permissions associated with the user group. - * @return permissions - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The permissions associated with the user group.") - - public List getPermissions() { - return permissions; - } - - - public void setPermissions(List permissions) { - this.permissions = permissions; - } - - - public UserGroup2 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the user group. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the user group.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public UserGroup2 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the user group. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the user group.") - - 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; - } - UserGroup2 userGroup2 = (UserGroup2) o; - return Objects.equals(this.memberCount, userGroup2.memberCount) && - Objects.equals(this.permissions, userGroup2.permissions) && - Objects.equals(this.id, userGroup2.id) && - Objects.equals(this.name, userGroup2.name); - } - - @Override - public int hashCode() { - return Objects.hash(memberCount, permissions, id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UserGroup2 {\n"); - sb.append(" memberCount: ").append(toIndentedString(memberCount)).append("\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).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("memberCount"); - openapiFields.add("permissions"); - openapiFields.add("id"); - openapiFields.add("name"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("memberCount"); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UserGroup2 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UserGroup2.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UserGroup2 is not found in the empty JSON string", UserGroup2.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UserGroup2.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserGroup2` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UserGroup2.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); - } - } - if (jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { - JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - if (jsonArraypermissions != null) { - // ensure the json data is an array - if (!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())); - } - } - } - 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("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 (!UserGroup2.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UserGroup2' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UserGroup2.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UserGroup2 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UserGroup2 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of UserGroup2 given an JSON string - * - * @param jsonString JSON string - * @return An instance of UserGroup2 - * @throws IOException if the JSON string is invalid with respect to UserGroup2 - */ - public static UserGroup2 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UserGroup2.class); - } - - /** - * Convert an instance of UserGroup2 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/UserGroup3.java b/src/main/java/com/segment/publicapi/models/UserGroup3.java deleted file mode 100644 index ce1be56c..00000000 --- a/src/main/java/com/segment/publicapi/models/UserGroup3.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PermissionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The updated user group. - */ -@ApiModel(description = "The updated user group.") - -public class UserGroup3 { - public static final String SERIALIZED_NAME_MEMBER_COUNT = "memberCount"; - @SerializedName(SERIALIZED_NAME_MEMBER_COUNT) - private BigDecimal memberCount; - - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions = null; - - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public UserGroup3() { - } - - public UserGroup3 memberCount(BigDecimal memberCount) { - - this.memberCount = memberCount; - return this; - } - - /** - * The number of members in the user group. - * @return memberCount - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The number of members in the user group.") - - public BigDecimal getMemberCount() { - return memberCount; - } - - - public void setMemberCount(BigDecimal memberCount) { - this.memberCount = memberCount; - } - - - public UserGroup3 permissions(List permissions) { - - this.permissions = permissions; - return this; - } - - public UserGroup3 addPermissionsItem(PermissionV1 permissionsItem) { - if (this.permissions == null) { - this.permissions = new ArrayList<>(); - } - this.permissions.add(permissionsItem); - return this; - } - - /** - * The permissions associated with the user group. - * @return permissions - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The permissions associated with the user group.") - - public List getPermissions() { - return permissions; - } - - - public void setPermissions(List permissions) { - this.permissions = permissions; - } - - - public UserGroup3 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the user group. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the user group.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public UserGroup3 name(String name) { - - this.name = name; - return this; - } - - /** - * The name of the user group. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the user group.") - - 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; - } - UserGroup3 userGroup3 = (UserGroup3) o; - return Objects.equals(this.memberCount, userGroup3.memberCount) && - Objects.equals(this.permissions, userGroup3.permissions) && - Objects.equals(this.id, userGroup3.id) && - Objects.equals(this.name, userGroup3.name); - } - - @Override - public int hashCode() { - return Objects.hash(memberCount, permissions, id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UserGroup3 {\n"); - sb.append(" memberCount: ").append(toIndentedString(memberCount)).append("\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).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("memberCount"); - openapiFields.add("permissions"); - openapiFields.add("id"); - openapiFields.add("name"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("memberCount"); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UserGroup3 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UserGroup3.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UserGroup3 is not found in the empty JSON string", UserGroup3.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UserGroup3.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserGroup3` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UserGroup3.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); - } - } - if (jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { - JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - if (jsonArraypermissions != null) { - // ensure the json data is an array - if (!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())); - } - } - } - 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("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 (!UserGroup3.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UserGroup3' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UserGroup3.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UserGroup3 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UserGroup3 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of UserGroup3 given an JSON string - * - * @param jsonString JSON string - * @return An instance of UserGroup3 - * @throws IOException if the JSON string is invalid with respect to UserGroup3 - */ - public static UserGroup3 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UserGroup3.class); - } - - /** - * Convert an instance of UserGroup3 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/UserGroupV1.java b/src/main/java/com/segment/publicapi/models/UserGroupV1.java index 68ee875d..1cbb9ef1 100644 --- a/src/main/java/com/segment/publicapi/models/UserGroupV1.java +++ b/src/main/java/com/segment/publicapi/models/UserGroupV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,324 +9,322 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.segment.publicapi.models.PermissionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * A set of users with a set of shared permissions. - */ -@ApiModel(description = "A set of users with a set of shared permissions.") - +/** A set of users with a set of shared permissions. */ public class UserGroupV1 { - public static final String SERIALIZED_NAME_MEMBER_COUNT = "memberCount"; - @SerializedName(SERIALIZED_NAME_MEMBER_COUNT) - private BigDecimal memberCount; - - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions = null; + public static final String SERIALIZED_NAME_MEMBER_COUNT = "memberCount"; - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + @SerializedName(SERIALIZED_NAME_MEMBER_COUNT) + private BigDecimal memberCount; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - public UserGroupV1() { - } + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions; - public UserGroupV1 memberCount(BigDecimal memberCount) { - - this.memberCount = memberCount; - return this; - } + public static final String SERIALIZED_NAME_ID = "id"; - /** - * The number of members in the user group. - * @return memberCount - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The number of members in the user group.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; - public BigDecimal getMemberCount() { - return memberCount; - } + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public void setMemberCount(BigDecimal memberCount) { - this.memberCount = memberCount; - } + public UserGroupV1() {} + public UserGroupV1 memberCount(BigDecimal memberCount) { - public UserGroupV1 permissions(List permissions) { - - this.permissions = permissions; - return this; - } - - public UserGroupV1 addPermissionsItem(PermissionV1 permissionsItem) { - if (this.permissions == null) { - this.permissions = new ArrayList<>(); + this.memberCount = memberCount; + return this; } - this.permissions.add(permissionsItem); - return this; - } - - /** - * The permissions associated with the user group. - * @return permissions - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The permissions associated with the user group.") - public List getPermissions() { - return permissions; - } + /** + * The number of members in the user group. + * + * @return memberCount + */ + @javax.annotation.Nonnull + public BigDecimal getMemberCount() { + return memberCount; + } + public void setMemberCount(BigDecimal memberCount) { + this.memberCount = memberCount; + } - public void setPermissions(List permissions) { - this.permissions = permissions; - } + public UserGroupV1 permissions(List permissions) { + this.permissions = permissions; + return this; + } - public UserGroupV1 id(String id) { - - this.id = id; - return this; - } + public UserGroupV1 addPermissionsItem(PermissionV1 permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); + } + this.permissions.add(permissionsItem); + return this; + } - /** - * The id of the user group. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the user group.") + /** + * The permissions associated with the user group. + * + * @return permissions + */ + @javax.annotation.Nullable + public List getPermissions() { + return permissions; + } - public String getId() { - return id; - } + public void setPermissions(List permissions) { + this.permissions = permissions; + } + public UserGroupV1 id(String id) { - public void setId(String id) { - this.id = id; - } + this.id = id; + return this; + } + /** + * The id of the user group. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - public UserGroupV1 name(String name) { - - this.name = name; - return this; - } + public void setId(String id) { + this.id = id; + } - /** - * The name of the user group. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of the user group.") + public UserGroupV1 name(String name) { - public String getName() { - return name; - } + this.name = name; + return this; + } + /** + * The name of the user group. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public void setName(String name) { - this.name = 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; + } + UserGroupV1 userGroupV1 = (UserGroupV1) o; + return Objects.equals(this.memberCount, userGroupV1.memberCount) + && Objects.equals(this.permissions, userGroupV1.permissions) + && Objects.equals(this.id, userGroupV1.id) + && Objects.equals(this.name, userGroupV1.name); + } + @Override + public int hashCode() { + return Objects.hash(memberCount, permissions, id, name); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserGroupV1 {\n"); + sb.append(" memberCount: ").append(toIndentedString(memberCount)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UserGroupV1 userGroupV1 = (UserGroupV1) o; - return Objects.equals(this.memberCount, userGroupV1.memberCount) && - Objects.equals(this.permissions, userGroupV1.permissions) && - Objects.equals(this.id, userGroupV1.id) && - Objects.equals(this.name, userGroupV1.name); - } - - @Override - public int hashCode() { - return Objects.hash(memberCount, permissions, id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UserGroupV1 {\n"); - sb.append(" memberCount: ").append(toIndentedString(memberCount)).append("\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).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"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("memberCount"); + openapiFields.add("permissions"); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("memberCount"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("memberCount"); - openapiFields.add("permissions"); - openapiFields.add("id"); - openapiFields.add("name"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("memberCount"); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UserGroupV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UserGroupV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UserGroupV1 is not found in the empty JSON string", UserGroupV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserGroupV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserGroupV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UserGroupV1 is not found in the empty" + + " JSON string", + UserGroupV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UserGroupV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserGroupV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserGroupV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UserGroupV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UserGroupV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserGroupV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } } - } - if (jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { - JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - if (jsonArraypermissions != null) { - // ensure the json data is an array - if (!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())); - } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { + JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); + if (jsonArraypermissions != null) { + // ensure the json data is an array + if (!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())); + } + + // validate the optional field `permissions` (array) + for (int i = 0; i < jsonArraypermissions.size(); i++) { + PermissionV1.validateJsonElement(jsonArraypermissions.get(i)); + } + ; + } + } + 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("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("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("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 (!UserGroupV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UserGroupV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UserGroupV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UserGroupV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UserGroupV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of UserGroupV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of UserGroupV1 - * @throws IOException if the JSON string is invalid with respect to UserGroupV1 - */ - public static UserGroupV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UserGroupV1.class); - } - - /** - * Convert an instance of UserGroupV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserGroupV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserGroupV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UserGroupV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UserGroupV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserGroupV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of UserGroupV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserGroupV1 + * @throws IOException if the JSON string is invalid with respect to UserGroupV1 + */ + public static UserGroupV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserGroupV1.class); + } + + /** + * Convert an instance of UserGroupV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UserV1.java b/src/main/java/com/segment/publicapi/models/UserV1.java index 8f9a193e..411448fc 100644 --- a/src/main/java/com/segment/publicapi/models/UserV1.java +++ b/src/main/java/com/segment/publicapi/models/UserV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,326 +9,328 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.PermissionV1; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * A user belonging to a Segment Workspace. - */ -@ApiModel(description = "A user belonging to a Segment Workspace.") - +/** A user belonging to a Segment Workspace. */ public class UserV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_ID = "id"; - public static final String SERIALIZED_NAME_EMAIL = "email"; - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; + @SerializedName(SERIALIZED_NAME_ID) + private String id; - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions = null; + public static final String SERIALIZED_NAME_NAME = "name"; - public UserV1() { - } + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public UserV1 id(String id) { - - this.id = id; - return this; - } + public static final String SERIALIZED_NAME_EMAIL = "email"; - /** - * The unique identifier of this user. Config API note: analogous to `name`. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier of this user. Config API note: analogous to `name`.") + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; - public String getId() { - return id; - } + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions; - public void setId(String id) { - this.id = id; - } + public UserV1() {} + public UserV1 id(String id) { - public UserV1 name(String name) { - - this.name = name; - return this; - } - - /** - * The human-readable name of this user. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The human-readable name of this user.") + this.id = id; + return this; + } - public String getName() { - return name; - } + /** + * The unique identifier of this user. Config API note: analogous to `name`. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } - public void setName(String name) { - this.name = name; - } + public UserV1 name(String name) { + this.name = name; + return this; + } - public UserV1 email(String email) { - - this.email = email; - return this; - } + /** + * The human-readable name of this user. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - /** - * The email address associated with this user. - * @return email - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The email address associated with this user.") + public void setName(String name) { + this.name = name; + } - public String getEmail() { - return email; - } + public UserV1 email(String email) { + this.email = email; + return this; + } - public void setEmail(String email) { - this.email = email; - } + /** + * The email address associated with this user. + * + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } - public UserV1 permissions(List permissions) { - - this.permissions = permissions; - return this; - } + public UserV1 permissions(List permissions) { - public UserV1 addPermissionsItem(PermissionV1 permissionsItem) { - if (this.permissions == null) { - this.permissions = new ArrayList<>(); + this.permissions = permissions; + return this; } - this.permissions.add(permissionsItem); - return this; - } - - /** - * The permissions associated with this user. - * @return permissions - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The permissions associated with this user.") - public List getPermissions() { - return permissions; - } + public UserV1 addPermissionsItem(PermissionV1 permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); + } + this.permissions.add(permissionsItem); + return this; + } + /** + * The permissions associated with this user. + * + * @return permissions + */ + @javax.annotation.Nullable + public List getPermissions() { + return permissions; + } - public void setPermissions(List permissions) { - this.permissions = permissions; - } + public void setPermissions(List permissions) { + this.permissions = permissions; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserV1 userV1 = (UserV1) o; + return Objects.equals(this.id, userV1.id) + && Objects.equals(this.name, userV1.name) + && Objects.equals(this.email, userV1.email) + && Objects.equals(this.permissions, userV1.permissions); + } + @Override + public int hashCode() { + return Objects.hash(id, name, email, permissions); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - UserV1 userV1 = (UserV1) o; - return Objects.equals(this.id, userV1.id) && - Objects.equals(this.name, userV1.name) && - Objects.equals(this.email, userV1.email) && - Objects.equals(this.permissions, userV1.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, email, permissions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UserV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("name"); + openapiFields.add("email"); + openapiFields.add("permissions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("email"); } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("email"); - openapiFields.add("permissions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("email"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UserV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UserV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UserV1 is not found in the empty JSON string", UserV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UserV1 is not found in the empty JSON" + + " string", + UserV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UserV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `UserV1`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UserV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.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())); - } - 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("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("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { - JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - if (jsonArraypermissions != null) { - // ensure the json data is an array - if (!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())); - } + 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("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("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("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { + JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); + if (jsonArraypermissions != null) { + // ensure the json data is an array + if (!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())); + } + + // validate the optional field `permissions` (array) + for (int i = 0; i < jsonArraypermissions.size(); i++) { + PermissionV1.validateJsonElement(jsonArraypermissions.get(i)); + } + ; + } + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UserV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UserV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UserV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UserV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UserV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UserV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UserV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } } - } - - /** - * Create an instance of UserV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of UserV1 - * @throws IOException if the JSON string is invalid with respect to UserV1 - */ - public static UserV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UserV1.class); - } - - /** - * Convert an instance of UserV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of UserV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserV1 + * @throws IOException if the JSON string is invalid with respect to UserV1 + */ + public static UserV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserV1.class); + } + + /** + * Convert an instance of UserV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/UsersPerSourceSnapshotV1.java b/src/main/java/com/segment/publicapi/models/UsersPerSourceSnapshotV1.java index 156b8a4f..92ffc7f5 100644 --- a/src/main/java/com/segment/publicapi/models/UsersPerSourceSnapshotV1.java +++ b/src/main/java/com/segment/publicapi/models/UsersPerSourceSnapshotV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,441 +9,450 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** A snapshot of MTU metrics for a given Source within the given usage period. */ +public class UsersPerSourceSnapshotV1 { + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; -/** - * A snapshot of MTU metrics for a given Source within the given usage period. - */ -@ApiModel(description = "A snapshot of MTU metrics for a given Source within the given usage period.") + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; -public class UsersPerSourceSnapshotV1 { - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; + public static final String SERIALIZED_NAME_PERIOD_START = "periodStart"; + + @SerializedName(SERIALIZED_NAME_PERIOD_START) + private BigDecimal periodStart; + + public static final String SERIALIZED_NAME_PERIOD_END = "periodEnd"; - public static final String SERIALIZED_NAME_PERIOD_START = "periodStart"; - @SerializedName(SERIALIZED_NAME_PERIOD_START) - private BigDecimal periodStart; + @SerializedName(SERIALIZED_NAME_PERIOD_END) + private BigDecimal periodEnd; - public static final String SERIALIZED_NAME_PERIOD_END = "periodEnd"; - @SerializedName(SERIALIZED_NAME_PERIOD_END) - private BigDecimal periodEnd; + public static final String SERIALIZED_NAME_ANONYMOUS = "anonymous"; - public static final String SERIALIZED_NAME_ANONYMOUS = "anonymous"; - @SerializedName(SERIALIZED_NAME_ANONYMOUS) - private String anonymous; - - public static final String SERIALIZED_NAME_ANONYMOUS_IDENTIFIED = "anonymousIdentified"; - @SerializedName(SERIALIZED_NAME_ANONYMOUS_IDENTIFIED) - private String anonymousIdentified; - - public static final String SERIALIZED_NAME_IDENTIFIED = "identified"; - @SerializedName(SERIALIZED_NAME_IDENTIFIED) - private String identified; + @SerializedName(SERIALIZED_NAME_ANONYMOUS) + private String anonymous; - public static final String SERIALIZED_NAME_NEVER_IDENTIFIED = "neverIdentified"; - @SerializedName(SERIALIZED_NAME_NEVER_IDENTIFIED) - private String neverIdentified; + public static final String SERIALIZED_NAME_ANONYMOUS_IDENTIFIED = "anonymousIdentified"; - public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; - @SerializedName(SERIALIZED_NAME_TIMESTAMP) - private String timestamp; + @SerializedName(SERIALIZED_NAME_ANONYMOUS_IDENTIFIED) + private String anonymousIdentified; - public UsersPerSourceSnapshotV1() { - } + public static final String SERIALIZED_NAME_IDENTIFIED = "identified"; - public UsersPerSourceSnapshotV1 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + @SerializedName(SERIALIZED_NAME_IDENTIFIED) + private String identified; - /** - * The Source id. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source id.") + public static final String SERIALIZED_NAME_NEVER_IDENTIFIED = "neverIdentified"; + + @SerializedName(SERIALIZED_NAME_NEVER_IDENTIFIED) + private String neverIdentified; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + private String timestamp; + + public UsersPerSourceSnapshotV1() {} + + public UsersPerSourceSnapshotV1 sourceId(String sourceId) { + + this.sourceId = sourceId; + return this; + } + + /** + * The Source id. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public UsersPerSourceSnapshotV1 periodStart(BigDecimal periodStart) { + + this.periodStart = periodStart; + return this; + } + + /** + * The start of the usage period, in unix time (seconds since epoch). + * + * @return periodStart + */ + @javax.annotation.Nonnull + public BigDecimal getPeriodStart() { + return periodStart; + } + + public void setPeriodStart(BigDecimal periodStart) { + this.periodStart = periodStart; + } + + public UsersPerSourceSnapshotV1 periodEnd(BigDecimal periodEnd) { + + this.periodEnd = periodEnd; + return this; + } - public String getSourceId() { - return sourceId; - } + /** + * The end of the usage period, in unix time (seconds since epoch). + * + * @return periodEnd + */ + @javax.annotation.Nonnull + public BigDecimal getPeriodEnd() { + return periodEnd; + } + public void setPeriodEnd(BigDecimal periodEnd) { + this.periodEnd = periodEnd; + } - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + public UsersPerSourceSnapshotV1 anonymous(String anonymous) { + this.anonymous = anonymous; + return this; + } - public UsersPerSourceSnapshotV1 periodStart(BigDecimal periodStart) { - - this.periodStart = periodStart; - return this; - } + /** + * A bigint of the number of anonymous users in this snapshot. + * + * @return anonymous + */ + @javax.annotation.Nonnull + public String getAnonymous() { + return anonymous; + } - /** - * The start of the usage period, in unix time (seconds since epoch). - * @return periodStart - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The start of the usage period, in unix time (seconds since epoch).") + public void setAnonymous(String anonymous) { + this.anonymous = anonymous; + } - public BigDecimal getPeriodStart() { - return periodStart; - } + public UsersPerSourceSnapshotV1 anonymousIdentified(String anonymousIdentified) { + this.anonymousIdentified = anonymousIdentified; + return this; + } - public void setPeriodStart(BigDecimal periodStart) { - this.periodStart = periodStart; - } + /** + * A bigint of the number of anonymous identified users in this snapshot. + * + * @return anonymousIdentified + */ + @javax.annotation.Nonnull + public String getAnonymousIdentified() { + return anonymousIdentified; + } + public void setAnonymousIdentified(String anonymousIdentified) { + this.anonymousIdentified = anonymousIdentified; + } - public UsersPerSourceSnapshotV1 periodEnd(BigDecimal periodEnd) { - - this.periodEnd = periodEnd; - return this; - } + public UsersPerSourceSnapshotV1 identified(String identified) { - /** - * The end of the usage period, in unix time (seconds since epoch). - * @return periodEnd - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The end of the usage period, in unix time (seconds since epoch).") + this.identified = identified; + return this; + } - public BigDecimal getPeriodEnd() { - return periodEnd; - } + /** + * A bigint of the number of identified users in this snapshot. + * + * @return identified + */ + @javax.annotation.Nonnull + public String getIdentified() { + return identified; + } + public void setIdentified(String identified) { + this.identified = identified; + } - public void setPeriodEnd(BigDecimal periodEnd) { - this.periodEnd = periodEnd; - } + public UsersPerSourceSnapshotV1 neverIdentified(String neverIdentified) { + this.neverIdentified = neverIdentified; + return this; + } - public UsersPerSourceSnapshotV1 anonymous(String anonymous) { - - this.anonymous = anonymous; - return this; - } + /** + * A bigint of the number of never identified users in this snapshot. + * + * @return neverIdentified + */ + @javax.annotation.Nonnull + public String getNeverIdentified() { + return neverIdentified; + } - /** - * A bigint of the number of anonymous users in this snapshot. - * @return anonymous - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A bigint of the number of anonymous users in this snapshot.") + public void setNeverIdentified(String neverIdentified) { + this.neverIdentified = neverIdentified; + } - public String getAnonymous() { - return anonymous; - } + public UsersPerSourceSnapshotV1 timestamp(String timestamp) { + this.timestamp = timestamp; + return this; + } - public void setAnonymous(String anonymous) { - this.anonymous = anonymous; - } + /** + * The timestamp of this snapshot within the billing cycle, in the ISO-8601 format. + * + * @return timestamp + */ + @javax.annotation.Nonnull + public String getTimestamp() { + return timestamp; + } + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } - public UsersPerSourceSnapshotV1 anonymousIdentified(String anonymousIdentified) { - - this.anonymousIdentified = anonymousIdentified; - return this; - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UsersPerSourceSnapshotV1 usersPerSourceSnapshotV1 = (UsersPerSourceSnapshotV1) o; + return Objects.equals(this.sourceId, usersPerSourceSnapshotV1.sourceId) + && Objects.equals(this.periodStart, usersPerSourceSnapshotV1.periodStart) + && Objects.equals(this.periodEnd, usersPerSourceSnapshotV1.periodEnd) + && Objects.equals(this.anonymous, usersPerSourceSnapshotV1.anonymous) + && Objects.equals( + this.anonymousIdentified, usersPerSourceSnapshotV1.anonymousIdentified) + && Objects.equals(this.identified, usersPerSourceSnapshotV1.identified) + && Objects.equals(this.neverIdentified, usersPerSourceSnapshotV1.neverIdentified) + && Objects.equals(this.timestamp, usersPerSourceSnapshotV1.timestamp); + } - /** - * A bigint of the number of anonymous identified users in this snapshot. - * @return anonymousIdentified - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A bigint of the number of anonymous identified users in this snapshot.") + @Override + public int hashCode() { + return Objects.hash( + sourceId, + periodStart, + periodEnd, + anonymous, + anonymousIdentified, + identified, + neverIdentified, + timestamp); + } - public String getAnonymousIdentified() { - return anonymousIdentified; - } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsersPerSourceSnapshotV1 {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" periodStart: ").append(toIndentedString(periodStart)).append("\n"); + sb.append(" periodEnd: ").append(toIndentedString(periodEnd)).append("\n"); + sb.append(" anonymous: ").append(toIndentedString(anonymous)).append("\n"); + sb.append(" anonymousIdentified: ") + .append(toIndentedString(anonymousIdentified)) + .append("\n"); + sb.append(" identified: ").append(toIndentedString(identified)).append("\n"); + sb.append(" neverIdentified: ").append(toIndentedString(neverIdentified)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append("}"); + return sb.toString(); + } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } - public void setAnonymousIdentified(String anonymousIdentified) { - this.anonymousIdentified = anonymousIdentified; - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + openapiFields.add("periodStart"); + openapiFields.add("periodEnd"); + openapiFields.add("anonymous"); + openapiFields.add("anonymousIdentified"); + openapiFields.add("identified"); + openapiFields.add("neverIdentified"); + openapiFields.add("timestamp"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("periodStart"); + openapiRequiredFields.add("periodEnd"); + openapiRequiredFields.add("anonymous"); + openapiRequiredFields.add("anonymousIdentified"); + openapiRequiredFields.add("identified"); + openapiRequiredFields.add("neverIdentified"); + openapiRequiredFields.add("timestamp"); + } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UsersPerSourceSnapshotV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UsersPerSourceSnapshotV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in UsersPerSourceSnapshotV1 is not found" + + " in the empty JSON string", + UsersPerSourceSnapshotV1.openapiRequiredFields.toString())); + } + } - public UsersPerSourceSnapshotV1 identified(String identified) { - - this.identified = identified; - return this; - } - - /** - * A bigint of the number of identified users in this snapshot. - * @return identified - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A bigint of the number of identified users in this snapshot.") - - public String getIdentified() { - return identified; - } - - - public void setIdentified(String identified) { - this.identified = identified; - } - - - public UsersPerSourceSnapshotV1 neverIdentified(String neverIdentified) { - - this.neverIdentified = neverIdentified; - return this; - } - - /** - * A bigint of the number of never identified users in this snapshot. - * @return neverIdentified - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A bigint of the number of never identified users in this snapshot.") - - public String getNeverIdentified() { - return neverIdentified; - } - - - public void setNeverIdentified(String neverIdentified) { - this.neverIdentified = neverIdentified; - } - - - public UsersPerSourceSnapshotV1 timestamp(String timestamp) { - - this.timestamp = timestamp; - return this; - } - - /** - * The timestamp of this snapshot within the billing cycle, in the ISO-8601 format. - * @return timestamp - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The timestamp of this snapshot within the billing cycle, in the ISO-8601 format.") - - public String getTimestamp() { - return timestamp; - } - - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UsersPerSourceSnapshotV1 usersPerSourceSnapshotV1 = (UsersPerSourceSnapshotV1) o; - return Objects.equals(this.sourceId, usersPerSourceSnapshotV1.sourceId) && - Objects.equals(this.periodStart, usersPerSourceSnapshotV1.periodStart) && - Objects.equals(this.periodEnd, usersPerSourceSnapshotV1.periodEnd) && - Objects.equals(this.anonymous, usersPerSourceSnapshotV1.anonymous) && - Objects.equals(this.anonymousIdentified, usersPerSourceSnapshotV1.anonymousIdentified) && - Objects.equals(this.identified, usersPerSourceSnapshotV1.identified) && - Objects.equals(this.neverIdentified, usersPerSourceSnapshotV1.neverIdentified) && - Objects.equals(this.timestamp, usersPerSourceSnapshotV1.timestamp); - } - - @Override - public int hashCode() { - return Objects.hash(sourceId, periodStart, periodEnd, anonymous, anonymousIdentified, identified, neverIdentified, timestamp); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UsersPerSourceSnapshotV1 {\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" periodStart: ").append(toIndentedString(periodStart)).append("\n"); - sb.append(" periodEnd: ").append(toIndentedString(periodEnd)).append("\n"); - sb.append(" anonymous: ").append(toIndentedString(anonymous)).append("\n"); - sb.append(" anonymousIdentified: ").append(toIndentedString(anonymousIdentified)).append("\n"); - sb.append(" identified: ").append(toIndentedString(identified)).append("\n"); - sb.append(" neverIdentified: ").append(toIndentedString(neverIdentified)).append("\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourceId"); - openapiFields.add("periodStart"); - openapiFields.add("periodEnd"); - openapiFields.add("anonymous"); - openapiFields.add("anonymousIdentified"); - openapiFields.add("identified"); - openapiFields.add("neverIdentified"); - openapiFields.add("timestamp"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("periodStart"); - openapiRequiredFields.add("periodEnd"); - openapiRequiredFields.add("anonymous"); - openapiRequiredFields.add("anonymousIdentified"); - openapiRequiredFields.add("identified"); - openapiRequiredFields.add("neverIdentified"); - openapiRequiredFields.add("timestamp"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to UsersPerSourceSnapshotV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!UsersPerSourceSnapshotV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in UsersPerSourceSnapshotV1 is not found in the empty JSON string", UsersPerSourceSnapshotV1.openapiRequiredFields.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UsersPerSourceSnapshotV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `UsersPerSourceSnapshotV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!UsersPerSourceSnapshotV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UsersPerSourceSnapshotV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UsersPerSourceSnapshotV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if (!jsonObj.get("anonymous").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `anonymous` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("anonymous").toString())); + } + if (!jsonObj.get("anonymousIdentified").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `anonymousIdentified` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("anonymousIdentified").toString())); + } + if (!jsonObj.get("identified").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `identified` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("identified").toString())); } - } + if (!jsonObj.get("neverIdentified").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `neverIdentified` to be a primitive type in the" + + " JSON string but got `%s`", + jsonObj.get("neverIdentified").toString())); + } + if (!jsonObj.get("timestamp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `timestamp` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("timestamp").toString())); + } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UsersPerSourceSnapshotV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UsersPerSourceSnapshotV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UsersPerSourceSnapshotV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UsersPerSourceSnapshotV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UsersPerSourceSnapshotV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UsersPerSourceSnapshotV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("anonymous").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `anonymous` to be a primitive type in the JSON string but got `%s`", jsonObj.get("anonymous").toString())); - } - if (!jsonObj.get("anonymousIdentified").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `anonymousIdentified` to be a primitive type in the JSON string but got `%s`", jsonObj.get("anonymousIdentified").toString())); - } - if (!jsonObj.get("identified").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `identified` to be a primitive type in the JSON string but got `%s`", jsonObj.get("identified").toString())); - } - if (!jsonObj.get("neverIdentified").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `neverIdentified` to be a primitive type in the JSON string but got `%s`", jsonObj.get("neverIdentified").toString())); - } - if (!jsonObj.get("timestamp").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `timestamp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timestamp").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UsersPerSourceSnapshotV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UsersPerSourceSnapshotV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UsersPerSourceSnapshotV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, UsersPerSourceSnapshotV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UsersPerSourceSnapshotV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of UsersPerSourceSnapshotV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of UsersPerSourceSnapshotV1 - * @throws IOException if the JSON string is invalid with respect to UsersPerSourceSnapshotV1 - */ - public static UsersPerSourceSnapshotV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UsersPerSourceSnapshotV1.class); - } - - /** - * Convert an instance of UsersPerSourceSnapshotV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + } + + /** + * Create an instance of UsersPerSourceSnapshotV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UsersPerSourceSnapshotV1 + * @throws IOException if the JSON string is invalid with respect to UsersPerSourceSnapshotV1 + */ + public static UsersPerSourceSnapshotV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UsersPerSourceSnapshotV1.class); + } + /** + * Convert an instance of UsersPerSourceSnapshotV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Version.java b/src/main/java/com/segment/publicapi/models/Version.java new file mode 100644 index 00000000..959aacdf --- /dev/null +++ b/src/main/java/com/segment/publicapi/models/Version.java @@ -0,0 +1,414 @@ +/* + * Segment Public API + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * + * Contact: friends@segment.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.segment.publicapi.models; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** Represents a Function Version in a list. */ +public class Version { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_AUTHOR = "author"; + + @SerializedName(SERIALIZED_NAME_AUTHOR) + private String author; + + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + private String code; + + public static final String SERIALIZED_NAME_IS_DEPLOYED = "isDeployed"; + + @SerializedName(SERIALIZED_NAME_IS_DEPLOYED) + private Boolean isDeployed; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private String updatedAt; + + public static final String SERIALIZED_NAME_DEPLOYED_AT = "deployedAt"; + + @SerializedName(SERIALIZED_NAME_DEPLOYED_AT) + private String deployedAt; + + public Version() {} + + public Version id(String id) { + + this.id = id; + return this; + } + + /** + * An identifier for this version. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Version author(String author) { + + this.author = author; + return this; + } + + /** + * Author of this version. + * + * @return author + */ + @javax.annotation.Nullable + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public Version code(String code) { + + this.code = code; + return this; + } + + /** + * Source code of this version. + * + * @return code + */ + @javax.annotation.Nonnull + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public Version isDeployed(Boolean isDeployed) { + + this.isDeployed = isDeployed; + return this; + } + + /** + * The deployed status of this version. + * + * @return isDeployed + */ + @javax.annotation.Nullable + public Boolean getIsDeployed() { + return isDeployed; + } + + public void setIsDeployed(Boolean isDeployed) { + this.isDeployed = isDeployed; + } + + public Version createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * The time of this Version's creation. + * + * @return createdAt + */ + @javax.annotation.Nullable + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public Version updatedAt(String updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * The time of this Version's latest update. + * + * @return updatedAt + */ + @javax.annotation.Nullable + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + + public Version deployedAt(String deployedAt) { + + this.deployedAt = deployedAt; + return this; + } + + /** + * The time of this Version's last deployment. + * + * @return deployedAt + */ + @javax.annotation.Nullable + public String getDeployedAt() { + return deployedAt; + } + + public void setDeployedAt(String deployedAt) { + this.deployedAt = deployedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Version version = (Version) o; + return Objects.equals(this.id, version.id) + && Objects.equals(this.author, version.author) + && Objects.equals(this.code, version.code) + && Objects.equals(this.isDeployed, version.isDeployed) + && Objects.equals(this.createdAt, version.createdAt) + && Objects.equals(this.updatedAt, version.updatedAt) + && Objects.equals(this.deployedAt, version.deployedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, author, code, isDeployed, createdAt, updatedAt, deployedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Version {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" isDeployed: ").append(toIndentedString(isDeployed)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" deployedAt: ").append(toIndentedString(deployedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\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("author"); + openapiFields.add("code"); + openapiFields.add("isDeployed"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("deployedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("code"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Version + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Version.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in Version is not found in the empty JSON" + + " string", + Version.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Version.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the `Version`" + + " properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Version.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("author") != null && !jsonObj.get("author").isJsonNull()) + && !jsonObj.get("author").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `author` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("author").toString())); + } + if (!jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `code` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("code").toString())); + } + if ((jsonObj.get("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) + && !jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `createdAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("createdAt").toString())); + } + 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("deployedAt") != null && !jsonObj.get("deployedAt").isJsonNull()) + && !jsonObj.get("deployedAt").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `deployedAt` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("deployedAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Version.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Version' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Version.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Version value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Version read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of Version given an JSON string + * + * @param jsonString JSON string + * @return An instance of Version + * @throws IOException if the JSON string is invalid with respect to Version + */ + public static Version fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Version.class); + } + + /** + * Convert an instance of Version to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Warehouse.java b/src/main/java/com/segment/publicapi/models/Warehouse.java deleted file mode 100644 index da725a0b..00000000 --- a/src/main/java/com/segment/publicapi/models/Warehouse.java +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Metadata2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The returned Warehouse object. - */ -@ApiModel(description = "The returned Warehouse object.") - -public class Warehouse { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata2 metadata; - - public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) - private String workspaceId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; - - public Warehouse() { - } - - public Warehouse id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Warehouse. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Warehouse.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Warehouse metadata(Metadata2 metadata) { - - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Metadata2 getMetadata() { - return metadata; - } - - - public void setMetadata(Metadata2 metadata) { - this.metadata = metadata; - } - - - public Warehouse workspaceId(String workspaceId) { - - this.workspaceId = workspaceId; - return this; - } - - /** - * The id of the Workspace that owns this Warehouse. - * @return workspaceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Workspace that owns this Warehouse.") - - public String getWorkspaceId() { - return workspaceId; - } - - - public void setWorkspaceId(String workspaceId) { - this.workspaceId = workspaceId; - } - - - public Warehouse enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * When set to true, this Warehouse receives data. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "When set to true, this Warehouse receives data.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Warehouse settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The settings associated with this Warehouse. Common settings are connection-related configuration used to connect to it, for example host, username, and port. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The settings associated with this Warehouse. Common settings are connection-related configuration used to connect to it, for example host, username, and port.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Warehouse warehouse = (Warehouse) o; - return Objects.equals(this.id, warehouse.id) && - Objects.equals(this.metadata, warehouse.metadata) && - Objects.equals(this.workspaceId, warehouse.workspaceId) && - Objects.equals(this.enabled, warehouse.enabled) && - Objects.equals(this.settings, warehouse.settings); - } - - @Override - public int hashCode() { - return Objects.hash(id, metadata, workspaceId, enabled, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Warehouse {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("metadata"); - openapiFields.add("workspaceId"); - openapiFields.add("enabled"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("workspaceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("settings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Warehouse - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Warehouse.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Warehouse is not found in the empty JSON string", Warehouse.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Warehouse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Warehouse` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Warehouse.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("workspaceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Warehouse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Warehouse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Warehouse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Warehouse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Warehouse read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Warehouse given an JSON string - * - * @param jsonString JSON string - * @return An instance of Warehouse - * @throws IOException if the JSON string is invalid with respect to Warehouse - */ - public static Warehouse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Warehouse.class); - } - - /** - * Convert an instance of Warehouse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Warehouse1.java b/src/main/java/com/segment/publicapi/models/Warehouse1.java deleted file mode 100644 index 40a65a2c..00000000 --- a/src/main/java/com/segment/publicapi/models/Warehouse1.java +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Metadata2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The newly created Warehouse. - */ -@ApiModel(description = "The newly created Warehouse.") - -public class Warehouse1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata2 metadata; - - public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) - private String workspaceId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; - - public Warehouse1() { - } - - public Warehouse1 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Warehouse. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Warehouse.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Warehouse1 metadata(Metadata2 metadata) { - - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Metadata2 getMetadata() { - return metadata; - } - - - public void setMetadata(Metadata2 metadata) { - this.metadata = metadata; - } - - - public Warehouse1 workspaceId(String workspaceId) { - - this.workspaceId = workspaceId; - return this; - } - - /** - * The id of the Workspace that owns this Warehouse. - * @return workspaceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Workspace that owns this Warehouse.") - - public String getWorkspaceId() { - return workspaceId; - } - - - public void setWorkspaceId(String workspaceId) { - this.workspaceId = workspaceId; - } - - - public Warehouse1 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * When set to true, this Warehouse receives data. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "When set to true, this Warehouse receives data.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Warehouse1 settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The settings associated with this Warehouse. Common settings are connection-related configuration used to connect to it, for example host, username, and port. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The settings associated with this Warehouse. Common settings are connection-related configuration used to connect to it, for example host, username, and port.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Warehouse1 warehouse1 = (Warehouse1) o; - return Objects.equals(this.id, warehouse1.id) && - Objects.equals(this.metadata, warehouse1.metadata) && - Objects.equals(this.workspaceId, warehouse1.workspaceId) && - Objects.equals(this.enabled, warehouse1.enabled) && - Objects.equals(this.settings, warehouse1.settings); - } - - @Override - public int hashCode() { - return Objects.hash(id, metadata, workspaceId, enabled, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Warehouse1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("metadata"); - openapiFields.add("workspaceId"); - openapiFields.add("enabled"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("workspaceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("settings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Warehouse1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Warehouse1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Warehouse1 is not found in the empty JSON string", Warehouse1.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Warehouse1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Warehouse1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Warehouse1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("workspaceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Warehouse1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Warehouse1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Warehouse1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Warehouse1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Warehouse1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Warehouse1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Warehouse1 - * @throws IOException if the JSON string is invalid with respect to Warehouse1 - */ - public static Warehouse1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Warehouse1.class); - } - - /** - * Convert an instance of Warehouse1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/Warehouse2.java b/src/main/java/com/segment/publicapi/models/Warehouse2.java deleted file mode 100644 index dc5df6b0..00000000 --- a/src/main/java/com/segment/publicapi/models/Warehouse2.java +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Metadata2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The updated Warehouse. - */ -@ApiModel(description = "The updated Warehouse.") - -public class Warehouse2 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata2 metadata; - - public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) - private String workspaceId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; - - public Warehouse2() { - } - - public Warehouse2 id(String id) { - - this.id = id; - return this; - } - - /** - * The id of the Warehouse. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Warehouse.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Warehouse2 metadata(Metadata2 metadata) { - - this.metadata = metadata; - return this; - } - - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Metadata2 getMetadata() { - return metadata; - } - - - public void setMetadata(Metadata2 metadata) { - this.metadata = metadata; - } - - - public Warehouse2 workspaceId(String workspaceId) { - - this.workspaceId = workspaceId; - return this; - } - - /** - * The id of the Workspace that owns this Warehouse. - * @return workspaceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Workspace that owns this Warehouse.") - - public String getWorkspaceId() { - return workspaceId; - } - - - public void setWorkspaceId(String workspaceId) { - this.workspaceId = workspaceId; - } - - - public Warehouse2 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } - - /** - * When set to true, this Warehouse receives data. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "When set to true, this Warehouse receives data.") - - public Boolean getEnabled() { - return enabled; - } - - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - - public Warehouse2 settings(Map settings) { - - this.settings = settings; - return this; - } - - /** - * The settings associated with this Warehouse. Common settings are connection-related configuration used to connect to it, for example host, username, and port. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The settings associated with this Warehouse. Common settings are connection-related configuration used to connect to it, for example host, username, and port.") - - public Map getSettings() { - return settings; - } - - - public void setSettings(Map settings) { - this.settings = settings; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Warehouse2 warehouse2 = (Warehouse2) o; - return Objects.equals(this.id, warehouse2.id) && - Objects.equals(this.metadata, warehouse2.metadata) && - Objects.equals(this.workspaceId, warehouse2.workspaceId) && - Objects.equals(this.enabled, warehouse2.enabled) && - Objects.equals(this.settings, warehouse2.settings); - } - - @Override - public int hashCode() { - return Objects.hash(id, metadata, workspaceId, enabled, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Warehouse2 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("metadata"); - openapiFields.add("workspaceId"); - openapiFields.add("enabled"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("workspaceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("settings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Warehouse2 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Warehouse2.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Warehouse2 is not found in the empty JSON string", Warehouse2.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Warehouse2.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Warehouse2` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Warehouse2.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("workspaceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Warehouse2.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Warehouse2' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Warehouse2.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Warehouse2 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Warehouse2 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Warehouse2 given an JSON string - * - * @param jsonString JSON string - * @return An instance of Warehouse2 - * @throws IOException if the JSON string is invalid with respect to Warehouse2 - */ - public static Warehouse2 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Warehouse2.class); - } - - /** - * Convert an instance of Warehouse2 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/WarehouseAdvancedSyncV1.java b/src/main/java/com/segment/publicapi/models/WarehouseAdvancedSyncV1.java index 2cef8de4..f22ad61d 100644 --- a/src/main/java/com/segment/publicapi/models/WarehouseAdvancedSyncV1.java +++ b/src/main/java/com/segment/publicapi/models/WarehouseAdvancedSyncV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,237 +9,223 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; +import com.google.gson.TypeAdapterFactory; import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.segment.publicapi.JSON; import java.io.IOException; import java.math.BigDecimal; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Determines the time of day at which a Warehouse should sync. - */ -@ApiModel(description = "Determines the time of day at which a Warehouse should sync.") - +/** Determines the time of day at which a Warehouse should sync. */ public class WarehouseAdvancedSyncV1 { - public static final String SERIALIZED_NAME_HOUR_OF_DAY = "hourOfDay"; - @SerializedName(SERIALIZED_NAME_HOUR_OF_DAY) - private BigDecimal hourOfDay; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + public static final String SERIALIZED_NAME_HOUR_OF_DAY = "hourOfDay"; - public WarehouseAdvancedSyncV1() { - } + @SerializedName(SERIALIZED_NAME_HOUR_OF_DAY) + private BigDecimal hourOfDay; - public WarehouseAdvancedSyncV1 hourOfDay(BigDecimal hourOfDay) { - - this.hourOfDay = hourOfDay; - return this; - } + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - /** - * The hour of day for which to enable/disable a sync, between 0 and 23. - * @return hourOfDay - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The hour of day for which to enable/disable a sync, between 0 and 23.") + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public BigDecimal getHourOfDay() { - return hourOfDay; - } + public WarehouseAdvancedSyncV1() {} + public WarehouseAdvancedSyncV1 hourOfDay(BigDecimal hourOfDay) { - public void setHourOfDay(BigDecimal hourOfDay) { - this.hourOfDay = hourOfDay; - } + this.hourOfDay = hourOfDay; + return this; + } + /** + * The hour of day for which to enable/disable a sync, between 0 and 23. + * + * @return hourOfDay + */ + @javax.annotation.Nonnull + public BigDecimal getHourOfDay() { + return hourOfDay; + } - public WarehouseAdvancedSyncV1 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + public void setHourOfDay(BigDecimal hourOfDay) { + this.hourOfDay = hourOfDay; + } - /** - * Enable to the sync at the specified hour. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Enable to the sync at the specified hour.") + public WarehouseAdvancedSyncV1 enabled(Boolean enabled) { - public Boolean getEnabled() { - return enabled; - } + this.enabled = enabled; + return this; + } + /** + * Enable to the sync at the specified hour. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WarehouseAdvancedSyncV1 warehouseAdvancedSyncV1 = (WarehouseAdvancedSyncV1) o; + return Objects.equals(this.hourOfDay, warehouseAdvancedSyncV1.hourOfDay) + && Objects.equals(this.enabled, warehouseAdvancedSyncV1.enabled); + } + @Override + public int hashCode() { + return Objects.hash(hourOfDay, enabled); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WarehouseAdvancedSyncV1 {\n"); + sb.append(" hourOfDay: ").append(toIndentedString(hourOfDay)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - WarehouseAdvancedSyncV1 warehouseAdvancedSyncV1 = (WarehouseAdvancedSyncV1) o; - return Objects.equals(this.hourOfDay, warehouseAdvancedSyncV1.hourOfDay) && - Objects.equals(this.enabled, warehouseAdvancedSyncV1.enabled); - } - - @Override - public int hashCode() { - return Objects.hash(hourOfDay, enabled); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WarehouseAdvancedSyncV1 {\n"); - sb.append(" hourOfDay: ").append(toIndentedString(hourOfDay)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("hourOfDay"); + openapiFields.add("enabled"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("hourOfDay"); + openapiRequiredFields.add("enabled"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("hourOfDay"); - openapiFields.add("enabled"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("hourOfDay"); - openapiRequiredFields.add("enabled"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to WarehouseAdvancedSyncV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!WarehouseAdvancedSyncV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in WarehouseAdvancedSyncV1 is not found in the empty JSON string", WarehouseAdvancedSyncV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WarehouseAdvancedSyncV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WarehouseAdvancedSyncV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in WarehouseAdvancedSyncV1 is not found" + + " in the empty JSON string", + WarehouseAdvancedSyncV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!WarehouseAdvancedSyncV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WarehouseAdvancedSyncV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WarehouseAdvancedSyncV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `WarehouseAdvancedSyncV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : WarehouseAdvancedSyncV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WarehouseAdvancedSyncV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!WarehouseAdvancedSyncV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WarehouseAdvancedSyncV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(WarehouseAdvancedSyncV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, WarehouseAdvancedSyncV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WarehouseAdvancedSyncV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WarehouseAdvancedSyncV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WarehouseAdvancedSyncV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(WarehouseAdvancedSyncV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, WarehouseAdvancedSyncV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WarehouseAdvancedSyncV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of WarehouseAdvancedSyncV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of WarehouseAdvancedSyncV1 + * @throws IOException if the JSON string is invalid with respect to WarehouseAdvancedSyncV1 + */ + public static WarehouseAdvancedSyncV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WarehouseAdvancedSyncV1.class); } - } - - /** - * Create an instance of WarehouseAdvancedSyncV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of WarehouseAdvancedSyncV1 - * @throws IOException if the JSON string is invalid with respect to WarehouseAdvancedSyncV1 - */ - public static WarehouseAdvancedSyncV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WarehouseAdvancedSyncV1.class); - } - - /** - * Convert an instance of WarehouseAdvancedSyncV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Convert an instance of WarehouseAdvancedSyncV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/WarehouseMetadata.java b/src/main/java/com/segment/publicapi/models/WarehouseMetadata.java deleted file mode 100644 index 51bdf0dc..00000000 --- a/src/main/java/com/segment/publicapi/models/WarehouseMetadata.java +++ /dev/null @@ -1,396 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.IntegrationOptionBeta; -import com.segment.publicapi.models.Logos2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The Warehouse catalog item. - */ -@ApiModel(description = "The Warehouse catalog item.") - -public class WarehouseMetadata { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_LOGOS = "logos"; - @SerializedName(SERIALIZED_NAME_LOGOS) - private Logos2 logos; - - public static final String SERIALIZED_NAME_OPTIONS = "options"; - @SerializedName(SERIALIZED_NAME_OPTIONS) - private List options = new ArrayList<>(); - - public WarehouseMetadata() { - } - - public WarehouseMetadata id(String id) { - - this.id = id; - return this; - } - - /** - * The id of this object. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of this object.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public WarehouseMetadata name(String name) { - - this.name = name; - return this; - } - - /** - * The name of this object. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of this object.") - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - public WarehouseMetadata slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * A human-readable, unique identifier for object. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A human-readable, unique identifier for object.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - public WarehouseMetadata description(String description) { - - this.description = description; - return this; - } - - /** - * A description, in English, of this object. - * @return description - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A description, in English, of this object.") - - public String getDescription() { - return description; - } - - - public void setDescription(String description) { - this.description = description; - } - - - public WarehouseMetadata logos(Logos2 logos) { - - this.logos = logos; - return this; - } - - /** - * Get logos - * @return logos - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Logos2 getLogos() { - return logos; - } - - - public void setLogos(Logos2 logos) { - this.logos = logos; - } - - - public WarehouseMetadata options(List options) { - - this.options = options; - return this; - } - - public WarehouseMetadata addOptionsItem(IntegrationOptionBeta optionsItem) { - this.options.add(optionsItem); - return this; - } - - /** - * The Integration options for this object. - * @return options - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Integration options for this object.") - - public List getOptions() { - return options; - } - - - public void setOptions(List options) { - this.options = options; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WarehouseMetadata warehouseMetadata = (WarehouseMetadata) o; - return Objects.equals(this.id, warehouseMetadata.id) && - Objects.equals(this.name, warehouseMetadata.name) && - Objects.equals(this.slug, warehouseMetadata.slug) && - Objects.equals(this.description, warehouseMetadata.description) && - Objects.equals(this.logos, warehouseMetadata.logos) && - Objects.equals(this.options, warehouseMetadata.options); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, slug, description, logos, options); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WarehouseMetadata {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" logos: ").append(toIndentedString(logos)).append("\n"); - sb.append(" options: ").append(toIndentedString(options)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("slug"); - openapiFields.add("description"); - openapiFields.add("logos"); - openapiFields.add("options"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("description"); - openapiRequiredFields.add("logos"); - openapiRequiredFields.add("options"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to WarehouseMetadata - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!WarehouseMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in WarehouseMetadata is not found in the empty JSON string", WarehouseMetadata.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!WarehouseMetadata.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WarehouseMetadata` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : WarehouseMetadata.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - 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("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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())); - } - // ensure the json data is an array - if (!jsonObj.get("options").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `options` to be an array in the JSON string but got `%s`", jsonObj.get("options").toString())); - } - - JsonArray jsonArrayoptions = jsonObj.getAsJsonArray("options"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!WarehouseMetadata.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WarehouseMetadata' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(WarehouseMetadata.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, WarehouseMetadata value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WarehouseMetadata read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of WarehouseMetadata given an JSON string - * - * @param jsonString JSON string - * @return An instance of WarehouseMetadata - * @throws IOException if the JSON string is invalid with respect to WarehouseMetadata - */ - public static WarehouseMetadata fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WarehouseMetadata.class); - } - - /** - * Convert an instance of WarehouseMetadata to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/WarehouseMetadataV1.java b/src/main/java/com/segment/publicapi/models/WarehouseMetadataV1.java index 176d6cfb..75f533ac 100644 --- a/src/main/java/com/segment/publicapi/models/WarehouseMetadataV1.java +++ b/src/main/java/com/segment/publicapi/models/WarehouseMetadataV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,387 +9,393 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.IntegrationOptionBeta; -import com.segment.publicapi.models.Logos2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** The metadata for an instance of Segment’s data Warehouse product. */ +public class WarehouseMetadataV1 { + public static final String SERIALIZED_NAME_ID = "id"; -/** - * The metadata for an instance of Segment’s data Warehouse product. - */ -@ApiModel(description = "The metadata for an instance of Segment’s data Warehouse product.") + @SerializedName(SERIALIZED_NAME_ID) + private String id; -public class WarehouseMetadataV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + public static final String SERIALIZED_NAME_NAME = "name"; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_LOGOS = "logos"; - @SerializedName(SERIALIZED_NAME_LOGOS) - private Logos2 logos; + public static final String SERIALIZED_NAME_SLUG = "slug"; - public static final String SERIALIZED_NAME_OPTIONS = "options"; - @SerializedName(SERIALIZED_NAME_OPTIONS) - private List options = new ArrayList<>(); + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; - public WarehouseMetadataV1() { - } + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - public WarehouseMetadataV1 id(String id) { - - this.id = id; - return this; - } + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - /** - * The id of this object. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of this object.") + public static final String SERIALIZED_NAME_LOGOS = "logos"; - public String getId() { - return id; - } + @SerializedName(SERIALIZED_NAME_LOGOS) + private LogosBeta logos; + public static final String SERIALIZED_NAME_OPTIONS = "options"; - public void setId(String id) { - this.id = id; - } + @SerializedName(SERIALIZED_NAME_OPTIONS) + private List options = new ArrayList<>(); + public WarehouseMetadataV1() {} - public WarehouseMetadataV1 name(String name) { - - this.name = name; - return this; - } + public WarehouseMetadataV1 id(String id) { - /** - * The name of this object. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The name of this object.") + this.id = id; + return this; + } - public String getName() { - return name; - } + /** + * The id of this object. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } - public void setName(String name) { - this.name = name; - } + public WarehouseMetadataV1 name(String name) { + this.name = name; + return this; + } - public WarehouseMetadataV1 slug(String slug) { - - this.slug = slug; - return this; - } + /** + * The name of this object. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - /** - * A human-readable, unique identifier for object. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A human-readable, unique identifier for object.") + public void setName(String name) { + this.name = name; + } - public String getSlug() { - return slug; - } + public WarehouseMetadataV1 slug(String slug) { + this.slug = slug; + return this; + } - public void setSlug(String slug) { - this.slug = slug; - } + /** + * A human-readable, unique identifier for object. + * + * @return slug + */ + @javax.annotation.Nonnull + public String getSlug() { + return slug; + } + public void setSlug(String slug) { + this.slug = slug; + } - public WarehouseMetadataV1 description(String description) { - - this.description = description; - return this; - } + public WarehouseMetadataV1 description(String description) { - /** - * A description, in English, of this object. - * @return description - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A description, in English, of this object.") + this.description = description; + return this; + } - public String getDescription() { - return description; - } + /** + * A description, in English, of this object. + * + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } - public void setDescription(String description) { - this.description = description; - } + public WarehouseMetadataV1 logos(LogosBeta logos) { + this.logos = logos; + return this; + } - public WarehouseMetadataV1 logos(Logos2 logos) { - - this.logos = logos; - return this; - } + /** + * Get logos + * + * @return logos + */ + @javax.annotation.Nonnull + public LogosBeta getLogos() { + return logos; + } - /** - * Get logos - * @return logos - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public void setLogos(LogosBeta logos) { + this.logos = logos; + } - public Logos2 getLogos() { - return logos; - } + public WarehouseMetadataV1 options(List options) { + this.options = options; + return this; + } - public void setLogos(Logos2 logos) { - this.logos = logos; - } + public WarehouseMetadataV1 addOptionsItem(IntegrationOptionBeta optionsItem) { + if (this.options == null) { + this.options = new ArrayList<>(); + } + this.options.add(optionsItem); + return this; + } + /** + * The Integration options for this object. + * + * @return options + */ + @javax.annotation.Nonnull + public List getOptions() { + return options; + } - public WarehouseMetadataV1 options(List options) { - - this.options = options; - return this; - } + public void setOptions(List options) { + this.options = options; + } - public WarehouseMetadataV1 addOptionsItem(IntegrationOptionBeta optionsItem) { - this.options.add(optionsItem); - return this; - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WarehouseMetadataV1 warehouseMetadataV1 = (WarehouseMetadataV1) o; + return Objects.equals(this.id, warehouseMetadataV1.id) + && Objects.equals(this.name, warehouseMetadataV1.name) + && Objects.equals(this.slug, warehouseMetadataV1.slug) + && Objects.equals(this.description, warehouseMetadataV1.description) + && Objects.equals(this.logos, warehouseMetadataV1.logos) + && Objects.equals(this.options, warehouseMetadataV1.options); + } - /** - * The Integration options for this object. - * @return options - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Integration options for this object.") + @Override + public int hashCode() { + return Objects.hash(id, name, slug, description, logos, options); + } - public List getOptions() { - return options; - } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WarehouseMetadataV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" logos: ").append(toIndentedString(logos)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } - public void setOptions(List options) { - this.options = options; - } + 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("name"); + openapiFields.add("slug"); + openapiFields.add("description"); + openapiFields.add("logos"); + openapiFields.add("options"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("slug"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("logos"); + openapiRequiredFields.add("options"); + } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WarehouseMetadataV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WarehouseMetadataV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in WarehouseMetadataV1 is not found in" + + " the empty JSON string", + WarehouseMetadataV1.openapiRequiredFields.toString())); + } + } + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WarehouseMetadataV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `WarehouseMetadataV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WarehouseMetadataV1 warehouseMetadataV1 = (WarehouseMetadataV1) o; - return Objects.equals(this.id, warehouseMetadataV1.id) && - Objects.equals(this.name, warehouseMetadataV1.name) && - Objects.equals(this.slug, warehouseMetadataV1.slug) && - Objects.equals(this.description, warehouseMetadataV1.description) && - Objects.equals(this.logos, warehouseMetadataV1.logos) && - Objects.equals(this.options, warehouseMetadataV1.options); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, slug, description, logos, options); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WarehouseMetadataV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" logos: ").append(toIndentedString(logos)).append("\n"); - sb.append(" options: ").append(toIndentedString(options)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\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("name"); - openapiFields.add("slug"); - openapiFields.add("description"); - openapiFields.add("logos"); - openapiFields.add("options"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("description"); - openapiRequiredFields.add("logos"); - openapiRequiredFields.add("options"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to WarehouseMetadataV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!WarehouseMetadataV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in WarehouseMetadataV1 is not found in the empty JSON string", WarehouseMetadataV1.openapiRequiredFields.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WarehouseMetadataV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").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 `logos` + LogosBeta.validateJsonElement(jsonObj.get("logos")); + // ensure the json data is an array + if (!jsonObj.get("options").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `options` to be an array in the JSON string but got" + + " `%s`", + jsonObj.get("options").toString())); } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!WarehouseMetadataV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WarehouseMetadataV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + JsonArray jsonArrayoptions = jsonObj.getAsJsonArray("options"); + // validate the required field `options` (array) + for (int i = 0; i < jsonArrayoptions.size(); i++) { + IntegrationOptionBeta.validateJsonElement(jsonArrayoptions.get(i)); } - } + ; + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : WarehouseMetadataV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WarehouseMetadataV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WarehouseMetadataV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(WarehouseMetadataV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, WarehouseMetadataV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WarehouseMetadataV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - 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("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("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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())); - } - // ensure the json data is an array - if (!jsonObj.get("options").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `options` to be an array in the JSON string but got `%s`", jsonObj.get("options").toString())); - } - - JsonArray jsonArrayoptions = jsonObj.getAsJsonArray("options"); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!WarehouseMetadataV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WarehouseMetadataV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(WarehouseMetadataV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, WarehouseMetadataV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WarehouseMetadataV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of WarehouseMetadataV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of WarehouseMetadataV1 - * @throws IOException if the JSON string is invalid with respect to WarehouseMetadataV1 - */ - public static WarehouseMetadataV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WarehouseMetadataV1.class); - } - - /** - * Convert an instance of WarehouseMetadataV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of WarehouseMetadataV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of WarehouseMetadataV1 + * @throws IOException if the JSON string is invalid with respect to WarehouseMetadataV1 + */ + public static WarehouseMetadataV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WarehouseMetadataV1.class); + } + + /** + * Convert an instance of WarehouseMetadataV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/WarehouseSelectiveSyncItemV1.java b/src/main/java/com/segment/publicapi/models/WarehouseSelectiveSyncItemV1.java index dfa22e62..451d01b9 100644 --- a/src/main/java/com/segment/publicapi/models/WarehouseSelectiveSyncItemV1.java +++ b/src/main/java/com/segment/publicapi/models/WarehouseSelectiveSyncItemV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,314 +9,343 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.HashMap; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; +/** Represents an entry in the Warehouse Selective Sync schema for a Warehouse and Source pair. */ +public class WarehouseSelectiveSyncItemV1 { + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; -/** - * Represents an entry in the Warehouse Selective Sync schema for a Warehouse and Source pair. - */ -@ApiModel(description = "Represents an entry in the Warehouse Selective Sync schema for a Warehouse and Source pair.") + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; -public class WarehouseSelectiveSyncItemV1 { - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_COLLECTION = "collection"; - @SerializedName(SERIALIZED_NAME_COLLECTION) - private String collection; - - public static final String SERIALIZED_NAME_WAREHOUSE_ID = "warehouseId"; - @SerializedName(SERIALIZED_NAME_WAREHOUSE_ID) - private String warehouseId; + public static final String SERIALIZED_NAME_COLLECTION = "collection"; - public static final String SERIALIZED_NAME_PROPERTIES = "properties"; - @SerializedName(SERIALIZED_NAME_PROPERTIES) - private Map properties = new HashMap<>(); + @SerializedName(SERIALIZED_NAME_COLLECTION) + private String collection; - public WarehouseSelectiveSyncItemV1() { - } + public static final String SERIALIZED_NAME_WAREHOUSE_ID = "warehouseId"; - public WarehouseSelectiveSyncItemV1 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + @SerializedName(SERIALIZED_NAME_WAREHOUSE_ID) + private String warehouseId; - /** - * The Source id attached to this Warehouse. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The Source id attached to this Warehouse.") + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public String getSourceId() { - return sourceId; - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private Map properties = new HashMap<>(); + public WarehouseSelectiveSyncItemV1() {} - public WarehouseSelectiveSyncItemV1 collection(String collection) { - - this.collection = collection; - return this; - } + public WarehouseSelectiveSyncItemV1 sourceId(String sourceId) { - /** - * The collection within the Source. - * @return collection - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The collection within the Source.") + this.sourceId = sourceId; + return this; + } - public String getCollection() { - return collection; - } + /** + * The Source id attached to this Warehouse. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } - public void setCollection(String collection) { - this.collection = collection; - } + public WarehouseSelectiveSyncItemV1 collection(String collection) { + this.collection = collection; + return this; + } - public WarehouseSelectiveSyncItemV1 warehouseId(String warehouseId) { - - this.warehouseId = warehouseId; - return this; - } + /** + * The collection within the Source. + * + * @return collection + */ + @javax.annotation.Nonnull + public String getCollection() { + return collection; + } - /** - * The id of the Warehouse this sync belongs to. - * @return warehouseId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Warehouse this sync belongs to.") + public void setCollection(String collection) { + this.collection = collection; + } - public String getWarehouseId() { - return warehouseId; - } + public WarehouseSelectiveSyncItemV1 warehouseId(String warehouseId) { + this.warehouseId = warehouseId; + return this; + } - public void setWarehouseId(String warehouseId) { - this.warehouseId = warehouseId; - } + /** + * The id of the Warehouse this sync belongs to. + * + * @return warehouseId + */ + @javax.annotation.Nonnull + public String getWarehouseId() { + return warehouseId; + } + public void setWarehouseId(String warehouseId) { + this.warehouseId = warehouseId; + } - public WarehouseSelectiveSyncItemV1 properties(Map properties) { - - this.properties = properties; - return this; - } + public WarehouseSelectiveSyncItemV1 enabled(Boolean enabled) { - public WarehouseSelectiveSyncItemV1 putPropertiesItem(String key, Object propertiesItem) { - this.properties.put(key, propertiesItem); - return this; - } + this.enabled = enabled; + return this; + } - /** - * A map that contains the properties within the collection to which the Warehouse should sync. - * @return properties - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A map that contains the properties within the collection to which the Warehouse should sync.") + /** + * Whether this Selective Sync item is enabled. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } - public Map getProperties() { - return properties; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public WarehouseSelectiveSyncItemV1 properties(Map properties) { + + this.properties = properties; + return this; + } + public WarehouseSelectiveSyncItemV1 putPropertiesItem(String key, Object propertiesItem) { + if (this.properties == null) { + this.properties = new HashMap<>(); + } + this.properties.put(key, propertiesItem); + return this; + } + + /** + * A map that contains the properties within the collection to which the Warehouse should sync. + * + * @return properties + */ + @javax.annotation.Nonnull + public Map getProperties() { + return properties; + } - public void setProperties(Map properties) { - this.properties = properties; - } + public void setProperties(Map properties) { + this.properties = properties; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WarehouseSelectiveSyncItemV1 warehouseSelectiveSyncItemV1 = + (WarehouseSelectiveSyncItemV1) o; + return Objects.equals(this.sourceId, warehouseSelectiveSyncItemV1.sourceId) + && Objects.equals(this.collection, warehouseSelectiveSyncItemV1.collection) + && Objects.equals(this.warehouseId, warehouseSelectiveSyncItemV1.warehouseId) + && Objects.equals(this.enabled, warehouseSelectiveSyncItemV1.enabled) + && Objects.equals(this.properties, warehouseSelectiveSyncItemV1.properties); + } + @Override + public int hashCode() { + return Objects.hash(sourceId, collection, warehouseId, enabled, properties); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WarehouseSelectiveSyncItemV1 {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" collection: ").append(toIndentedString(collection)).append("\n"); + sb.append(" warehouseId: ").append(toIndentedString(warehouseId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - WarehouseSelectiveSyncItemV1 warehouseSelectiveSyncItemV1 = (WarehouseSelectiveSyncItemV1) o; - return Objects.equals(this.sourceId, warehouseSelectiveSyncItemV1.sourceId) && - Objects.equals(this.collection, warehouseSelectiveSyncItemV1.collection) && - Objects.equals(this.warehouseId, warehouseSelectiveSyncItemV1.warehouseId) && - Objects.equals(this.properties, warehouseSelectiveSyncItemV1.properties); - } - - @Override - public int hashCode() { - return Objects.hash(sourceId, collection, warehouseId, properties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WarehouseSelectiveSyncItemV1 {\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" collection: ").append(toIndentedString(collection)).append("\n"); - sb.append(" warehouseId: ").append(toIndentedString(warehouseId)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + openapiFields.add("collection"); + openapiFields.add("warehouseId"); + openapiFields.add("enabled"); + openapiFields.add("properties"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("collection"); + openapiRequiredFields.add("warehouseId"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("properties"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourceId"); - openapiFields.add("collection"); - openapiFields.add("warehouseId"); - openapiFields.add("properties"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("collection"); - openapiRequiredFields.add("warehouseId"); - openapiRequiredFields.add("properties"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to WarehouseSelectiveSyncItemV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!WarehouseSelectiveSyncItemV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in WarehouseSelectiveSyncItemV1 is not found in the empty JSON string", WarehouseSelectiveSyncItemV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * WarehouseSelectiveSyncItemV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WarehouseSelectiveSyncItemV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in WarehouseSelectiveSyncItemV1 is not" + + " found in the empty JSON string", + WarehouseSelectiveSyncItemV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!WarehouseSelectiveSyncItemV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WarehouseSelectiveSyncItemV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WarehouseSelectiveSyncItemV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `WarehouseSelectiveSyncItemV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : WarehouseSelectiveSyncItemV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WarehouseSelectiveSyncItemV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if (!jsonObj.get("collection").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collection` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("collection").toString())); + } + if (!jsonObj.get("warehouseId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `warehouseId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("warehouseId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WarehouseSelectiveSyncItemV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WarehouseSelectiveSyncItemV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(WarehouseSelectiveSyncItemV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, WarehouseSelectiveSyncItemV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WarehouseSelectiveSyncItemV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); } - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if (!jsonObj.get("collection").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `collection` to be a primitive type in the JSON string but got `%s`", jsonObj.get("collection").toString())); - } - if (!jsonObj.get("warehouseId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `warehouseId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("warehouseId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!WarehouseSelectiveSyncItemV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WarehouseSelectiveSyncItemV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(WarehouseSelectiveSyncItemV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, WarehouseSelectiveSyncItemV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WarehouseSelectiveSyncItemV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of WarehouseSelectiveSyncItemV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of WarehouseSelectiveSyncItemV1 - * @throws IOException if the JSON string is invalid with respect to WarehouseSelectiveSyncItemV1 - */ - public static WarehouseSelectiveSyncItemV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WarehouseSelectiveSyncItemV1.class); - } - - /** - * Convert an instance of WarehouseSelectiveSyncItemV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + /** + * Create an instance of WarehouseSelectiveSyncItemV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of WarehouseSelectiveSyncItemV1 + * @throws IOException if the JSON string is invalid with respect to + * WarehouseSelectiveSyncItemV1 + */ + public static WarehouseSelectiveSyncItemV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WarehouseSelectiveSyncItemV1.class); + } + + /** + * Convert an instance of WarehouseSelectiveSyncItemV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/WarehouseSyncOverrideV1.java b/src/main/java/com/segment/publicapi/models/WarehouseSyncOverrideV1.java index 3f46986c..189d2253 100644 --- a/src/main/java/com/segment/publicapi/models/WarehouseSyncOverrideV1.java +++ b/src/main/java/com/segment/publicapi/models/WarehouseSyncOverrideV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,305 +9,301 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Represents the override for a Source/collection/property? path to apply to a Warehouse. - */ -@ApiModel(description = "Represents the override for a Source/collection/property? path to apply to a Warehouse.") - +/** Represents the override for a Source/collection/property? path to apply to a Warehouse. */ public class WarehouseSyncOverrideV1 { - public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - @SerializedName(SERIALIZED_NAME_SOURCE_ID) - private String sourceId; - - public static final String SERIALIZED_NAME_COLLECTION = "collection"; - @SerializedName(SERIALIZED_NAME_COLLECTION) - private String collection; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; - - public static final String SERIALIZED_NAME_PROPERTY = "property"; - @SerializedName(SERIALIZED_NAME_PROPERTY) - private String property; + public static final String SERIALIZED_NAME_SOURCE_ID = "sourceId"; - public WarehouseSyncOverrideV1() { - } + @SerializedName(SERIALIZED_NAME_SOURCE_ID) + private String sourceId; - public WarehouseSyncOverrideV1 sourceId(String sourceId) { - - this.sourceId = sourceId; - return this; - } + public static final String SERIALIZED_NAME_COLLECTION = "collection"; - /** - * The id of the Source this schema item applies to. - * @return sourceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Source this schema item applies to.") + @SerializedName(SERIALIZED_NAME_COLLECTION) + private String collection; - public String getSourceId() { - return sourceId; - } + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } + public static final String SERIALIZED_NAME_PROPERTY = "property"; + @SerializedName(SERIALIZED_NAME_PROPERTY) + private String property; - public WarehouseSyncOverrideV1 collection(String collection) { - - this.collection = collection; - return this; - } + public WarehouseSyncOverrideV1() {} - /** - * The collection the schema item override applies to. - * @return collection - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "The collection the schema item override applies to.") + public WarehouseSyncOverrideV1 sourceId(String sourceId) { - public String getCollection() { - return collection; - } + this.sourceId = sourceId; + return this; + } + /** + * The id of the Source this schema item applies to. + * + * @return sourceId + */ + @javax.annotation.Nonnull + public String getSourceId() { + return sourceId; + } - public void setCollection(String collection) { - this.collection = collection; - } + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + public WarehouseSyncOverrideV1 collection(String collection) { - public WarehouseSyncOverrideV1 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + this.collection = collection; + return this; + } - /** - * Enable to apply the override. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Enable to apply the override.") + /** + * The collection the schema item override applies to. + * + * @return collection + */ + @javax.annotation.Nullable + public String getCollection() { + return collection; + } - public Boolean getEnabled() { - return enabled; - } + public void setCollection(String collection) { + this.collection = collection; + } + public WarehouseSyncOverrideV1 enabled(Boolean enabled) { - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + this.enabled = enabled; + return this; + } + /** + * Enable to apply the override. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } - public WarehouseSyncOverrideV1 property(String property) { - - this.property = property; - return this; - } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - /** - * A property within the collection to which the override applies. - * @return property - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "A property within the collection to which the override applies.") + public WarehouseSyncOverrideV1 property(String property) { - public String getProperty() { - return property; - } + this.property = property; + return this; + } + /** + * A property within the collection to which the override applies. + * + * @return property + */ + @javax.annotation.Nullable + public String getProperty() { + return property; + } - public void setProperty(String property) { - this.property = property; - } + public void setProperty(String property) { + this.property = property; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WarehouseSyncOverrideV1 warehouseSyncOverrideV1 = (WarehouseSyncOverrideV1) o; + return Objects.equals(this.sourceId, warehouseSyncOverrideV1.sourceId) + && Objects.equals(this.collection, warehouseSyncOverrideV1.collection) + && Objects.equals(this.enabled, warehouseSyncOverrideV1.enabled) + && Objects.equals(this.property, warehouseSyncOverrideV1.property); + } + @Override + public int hashCode() { + return Objects.hash(sourceId, collection, enabled, property); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WarehouseSyncOverrideV1 {\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" collection: ").append(toIndentedString(collection)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - WarehouseSyncOverrideV1 warehouseSyncOverrideV1 = (WarehouseSyncOverrideV1) o; - return Objects.equals(this.sourceId, warehouseSyncOverrideV1.sourceId) && - Objects.equals(this.collection, warehouseSyncOverrideV1.collection) && - Objects.equals(this.enabled, warehouseSyncOverrideV1.enabled) && - Objects.equals(this.property, warehouseSyncOverrideV1.property); - } - - @Override - public int hashCode() { - return Objects.hash(sourceId, collection, enabled, property); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WarehouseSyncOverrideV1 {\n"); - sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); - sb.append(" collection: ").append(toIndentedString(collection)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" property: ").append(toIndentedString(property)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sourceId"); + openapiFields.add("collection"); + openapiFields.add("enabled"); + openapiFields.add("property"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sourceId"); + openapiRequiredFields.add("enabled"); } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("sourceId"); - openapiFields.add("collection"); - openapiFields.add("enabled"); - openapiFields.add("property"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("sourceId"); - openapiRequiredFields.add("enabled"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to WarehouseSyncOverrideV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!WarehouseSyncOverrideV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in WarehouseSyncOverrideV1 is not found in the empty JSON string", WarehouseSyncOverrideV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WarehouseSyncOverrideV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WarehouseSyncOverrideV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in WarehouseSyncOverrideV1 is not found" + + " in the empty JSON string", + WarehouseSyncOverrideV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!WarehouseSyncOverrideV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WarehouseSyncOverrideV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WarehouseSyncOverrideV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `WarehouseSyncOverrideV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : WarehouseSyncOverrideV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WarehouseSyncOverrideV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("sourceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `sourceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("sourceId").toString())); + } + if ((jsonObj.get("collection") != null && !jsonObj.get("collection").isJsonNull()) + && !jsonObj.get("collection").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `collection` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("collection").toString())); + } + if ((jsonObj.get("property") != null && !jsonObj.get("property").isJsonNull()) + && !jsonObj.get("property").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `property` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("property").toString())); } - } - if (!jsonObj.get("sourceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `sourceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceId").toString())); - } - if ((jsonObj.get("collection") != null && !jsonObj.get("collection").isJsonNull()) && !jsonObj.get("collection").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `collection` to be a primitive type in the JSON string but got `%s`", jsonObj.get("collection").toString())); - } - if ((jsonObj.get("property") != null && !jsonObj.get("property").isJsonNull()) && !jsonObj.get("property").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `property` to be a primitive type in the JSON string but got `%s`", jsonObj.get("property").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!WarehouseSyncOverrideV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WarehouseSyncOverrideV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(WarehouseSyncOverrideV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, WarehouseSyncOverrideV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WarehouseSyncOverrideV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of WarehouseSyncOverrideV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of WarehouseSyncOverrideV1 - * @throws IOException if the JSON string is invalid with respect to WarehouseSyncOverrideV1 - */ - public static WarehouseSyncOverrideV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WarehouseSyncOverrideV1.class); - } - - /** - * Convert an instance of WarehouseSyncOverrideV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WarehouseSyncOverrideV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WarehouseSyncOverrideV1' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(WarehouseSyncOverrideV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, WarehouseSyncOverrideV1 value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WarehouseSyncOverrideV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of WarehouseSyncOverrideV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of WarehouseSyncOverrideV1 + * @throws IOException if the JSON string is invalid with respect to WarehouseSyncOverrideV1 + */ + public static WarehouseSyncOverrideV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WarehouseSyncOverrideV1.class); + } + + /** + * Convert an instance of WarehouseSyncOverrideV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/WarehouseV1.java b/src/main/java/com/segment/publicapi/models/WarehouseV1.java index 19b3fb4d..bd864c47 100644 --- a/src/main/java/com/segment/publicapi/models/WarehouseV1.java +++ b/src/main/java/com/segment/publicapi/models/WarehouseV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,337 +9,332 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import 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.segment.publicapi.models.Metadata2; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * Defines a data Warehouse used as a Destination for Segment data. - */ -@ApiModel(description = "Defines a data Warehouse used as a Destination for Segment data.") - +/** Defines a data Warehouse used as a Destination for Segment data. */ public class WarehouseV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_METADATA = "metadata"; - @SerializedName(SERIALIZED_NAME_METADATA) - private Metadata2 metadata; - - public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) - private String workspaceId; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - @SerializedName(SERIALIZED_NAME_ENABLED) - private Boolean enabled; + public static final String SERIALIZED_NAME_ID = "id"; - public static final String SERIALIZED_NAME_SETTINGS = "settings"; - @SerializedName(SERIALIZED_NAME_SETTINGS) - private Map settings; + @SerializedName(SERIALIZED_NAME_ID) + private String id; - public WarehouseV1() { - } + public static final String SERIALIZED_NAME_METADATA = "metadata"; - public WarehouseV1 id(String id) { - - this.id = id; - return this; - } + @SerializedName(SERIALIZED_NAME_METADATA) + private WarehouseMetadataV1 metadata; - /** - * The id of the Warehouse. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Warehouse.") + public static final String SERIALIZED_NAME_WORKSPACE_ID = "workspaceId"; - public String getId() { - return id; - } + @SerializedName(SERIALIZED_NAME_WORKSPACE_ID) + private String workspaceId; + public static final String SERIALIZED_NAME_ENABLED = "enabled"; - public void setId(String id) { - this.id = id; - } + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + public static final String SERIALIZED_NAME_SETTINGS = "settings"; - public WarehouseV1 metadata(Metadata2 metadata) { - - this.metadata = metadata; - return this; - } + @SerializedName(SERIALIZED_NAME_SETTINGS) + private Map settings; - /** - * Get metadata - * @return metadata - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") + public WarehouseV1() {} - public Metadata2 getMetadata() { - return metadata; - } + public WarehouseV1 id(String id) { + this.id = id; + return this; + } - public void setMetadata(Metadata2 metadata) { - this.metadata = metadata; - } + /** + * The id of the Warehouse. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } - public WarehouseV1 workspaceId(String workspaceId) { - - this.workspaceId = workspaceId; - return this; - } + public WarehouseV1 metadata(WarehouseMetadataV1 metadata) { - /** - * The id of the Workspace that owns this Warehouse. - * @return workspaceId - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The id of the Workspace that owns this Warehouse.") + this.metadata = metadata; + return this; + } - public String getWorkspaceId() { - return workspaceId; - } + /** + * Get metadata + * + * @return metadata + */ + @javax.annotation.Nonnull + public WarehouseMetadataV1 getMetadata() { + return metadata; + } + public void setMetadata(WarehouseMetadataV1 metadata) { + this.metadata = metadata; + } - public void setWorkspaceId(String workspaceId) { - this.workspaceId = workspaceId; - } + public WarehouseV1 workspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } - public WarehouseV1 enabled(Boolean enabled) { - - this.enabled = enabled; - return this; - } + /** + * The id of the Workspace that owns this Warehouse. + * + * @return workspaceId + */ + @javax.annotation.Nonnull + public String getWorkspaceId() { + return workspaceId; + } - /** - * When set to true, this Warehouse receives data. - * @return enabled - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "When set to true, this Warehouse receives data.") + public void setWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + } - public Boolean getEnabled() { - return enabled; - } + public WarehouseV1 enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + /** + * When set to true, this Warehouse receives data. + * + * @return enabled + */ + @javax.annotation.Nonnull + public Boolean getEnabled() { + return enabled; + } + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public WarehouseV1 settings(Map settings) { - - this.settings = settings; - return this; - } + public WarehouseV1 settings(Map settings) { - /** - * The settings associated with this Warehouse. Common settings are connection-related configuration used to connect to it, for example host, username, and port. - * @return settings - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The settings associated with this Warehouse. Common settings are connection-related configuration used to connect to it, for example host, username, and port.") + this.settings = settings; + return this; + } - public Map getSettings() { - return settings; - } + public WarehouseV1 putSettingsItem(String key, Object settingsItem) { + if (this.settings == null) { + this.settings = new HashMap<>(); + } + this.settings.put(key, settingsItem); + return this; + } + /** + * A key-value object that contains instance-specific Warehouse settings. + * + * @return settings + */ + @javax.annotation.Nonnull + public Map getSettings() { + return settings; + } - public void setSettings(Map settings) { - this.settings = settings; - } + public void setSettings(Map settings) { + this.settings = settings; + } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WarehouseV1 warehouseV1 = (WarehouseV1) o; + return Objects.equals(this.id, warehouseV1.id) + && Objects.equals(this.metadata, warehouseV1.metadata) + && Objects.equals(this.workspaceId, warehouseV1.workspaceId) + && Objects.equals(this.enabled, warehouseV1.enabled) + && Objects.equals(this.settings, warehouseV1.settings); + } + @Override + public int hashCode() { + return Objects.hash(id, metadata, workspaceId, enabled, settings); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WarehouseV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - WarehouseV1 warehouseV1 = (WarehouseV1) o; - return Objects.equals(this.id, warehouseV1.id) && - Objects.equals(this.metadata, warehouseV1.metadata) && - Objects.equals(this.workspaceId, warehouseV1.workspaceId) && - Objects.equals(this.enabled, warehouseV1.enabled) && - Objects.equals(this.settings, warehouseV1.settings); - } - - @Override - public int hashCode() { - return Objects.hash(id, metadata, workspaceId, enabled, settings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WarehouseV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" workspaceId: ").append(toIndentedString(workspaceId)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + 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("metadata"); + openapiFields.add("workspaceId"); + openapiFields.add("enabled"); + openapiFields.add("settings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("metadata"); + openapiRequiredFields.add("workspaceId"); + openapiRequiredFields.add("enabled"); + openapiRequiredFields.add("settings"); } - return o.toString().replace("\n", "\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("metadata"); - openapiFields.add("workspaceId"); - openapiFields.add("enabled"); - openapiFields.add("settings"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("metadata"); - openapiRequiredFields.add("workspaceId"); - openapiRequiredFields.add("enabled"); - openapiRequiredFields.add("settings"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to WarehouseV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!WarehouseV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in WarehouseV1 is not found in the empty JSON string", WarehouseV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WarehouseV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WarehouseV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in WarehouseV1 is not found in the empty" + + " JSON string", + WarehouseV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!WarehouseV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WarehouseV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WarehouseV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `WarehouseV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : WarehouseV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WarehouseV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + // validate the required field `metadata` + WarehouseMetadataV1.validateJsonElement(jsonObj.get("metadata")); + if (!jsonObj.get("workspaceId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `workspaceId` to be a primitive type in the JSON" + + " string but got `%s`", + jsonObj.get("workspaceId").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())); - } - if (!jsonObj.get("workspaceId").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `workspaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("workspaceId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!WarehouseV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WarehouseV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(WarehouseV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, WarehouseV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WarehouseV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of WarehouseV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of WarehouseV1 - * @throws IOException if the JSON string is invalid with respect to WarehouseV1 - */ - public static WarehouseV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WarehouseV1.class); - } - - /** - * Convert an instance of WarehouseV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WarehouseV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WarehouseV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(WarehouseV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, WarehouseV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WarehouseV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of WarehouseV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of WarehouseV1 + * @throws IOException if the JSON string is invalid with respect to WarehouseV1 + */ + public static WarehouseV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WarehouseV1.class); + } + + /** + * Convert an instance of WarehouseV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/segment/publicapi/models/Workspace.java b/src/main/java/com/segment/publicapi/models/Workspace.java deleted file mode 100644 index b6d793bc..00000000 --- a/src/main/java/com/segment/publicapi/models/Workspace.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. - * - * The version of the OpenAPI document: 32.0.2 - * Contact: friends@segment.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.segment.publicapi.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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 java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import com.segment.publicapi.JSON; - -/** - * The Workspace. - */ -@ApiModel(description = "The Workspace.") - -public class Workspace { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public Workspace() { - } - - public Workspace id(String id) { - - this.id = id; - return this; - } - - /** - * The unique identifier. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier.") - - public String getId() { - return id; - } - - - public void setId(String id) { - this.id = id; - } - - - public Workspace slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * The URL-friendly slug. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The URL-friendly slug.") - - public String getSlug() { - return slug; - } - - - public void setSlug(String slug) { - this.slug = slug; - } - - - public Workspace name(String name) { - - this.name = name; - return this; - } - - /** - * The human-readable name. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The human-readable name.") - - 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; - } - Workspace workspace = (Workspace) o; - return Objects.equals(this.id, workspace.id) && - Objects.equals(this.slug, workspace.slug) && - Objects.equals(this.name, workspace.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, slug, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Workspace {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).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("id"); - openapiFields.add("slug"); - openapiFields.add("name"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("name"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Workspace - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!Workspace.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Workspace is not found in the empty JSON string", Workspace.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!Workspace.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Workspace` properties. JSON: %s", entry.getKey(), jsonObj.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Workspace.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.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())); - } - if (!jsonObj.get("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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 (!Workspace.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Workspace' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Workspace.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Workspace value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public Workspace read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Workspace given an JSON string - * - * @param jsonString JSON string - * @return An instance of Workspace - * @throws IOException if the JSON string is invalid with respect to Workspace - */ - public static Workspace fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Workspace.class); - } - - /** - * Convert an instance of Workspace to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/com/segment/publicapi/models/WorkspaceV1.java b/src/main/java/com/segment/publicapi/models/WorkspaceV1.java index 1412ceba..ca586617 100644 --- a/src/main/java/com/segment/publicapi/models/WorkspaceV1.java +++ b/src/main/java/com/segment/publicapi/models/WorkspaceV1.java @@ -1,8 +1,7 @@ /* * Segment Public API - * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. + * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,276 +9,270 @@ * Do not edit the class manually. */ - package com.segment.publicapi.models; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.segment.publicapi.JSON; +import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Objects; import java.util.Set; -import com.segment.publicapi.JSON; - -/** - * An organized group of Sources and Destinations managed by a team. - */ -@ApiModel(description = "An organized group of Sources and Destinations managed by a team.") - +/** An organized group of Sources and Destinations managed by a team. */ public class WorkspaceV1 { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - - public static final String SERIALIZED_NAME_SLUG = "slug"; - @SerializedName(SERIALIZED_NAME_SLUG) - private String slug; + public static final String SERIALIZED_NAME_ID = "id"; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + @SerializedName(SERIALIZED_NAME_ID) + private String id; - public WorkspaceV1() { - } + public static final String SERIALIZED_NAME_SLUG = "slug"; - public WorkspaceV1 id(String id) { - - this.id = id; - return this; - } + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; - /** - * The unique identifier. - * @return id - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The unique identifier.") + public static final String SERIALIZED_NAME_NAME = "name"; - public String getId() { - return id; - } + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public WorkspaceV1() {} - public void setId(String id) { - this.id = id; - } + public WorkspaceV1 id(String id) { + this.id = id; + return this; + } - public WorkspaceV1 slug(String slug) { - - this.slug = slug; - return this; - } - - /** - * The URL-friendly slug. - * @return slug - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The URL-friendly slug.") + /** + * The unique identifier. + * + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } - public String getSlug() { - return slug; - } + public void setId(String id) { + this.id = id; + } + public WorkspaceV1 slug(String slug) { - public void setSlug(String slug) { - this.slug = slug; - } + this.slug = slug; + return this; + } + /** + * The URL-friendly slug. + * + * @return slug + */ + @javax.annotation.Nonnull + public String getSlug() { + return slug; + } - public WorkspaceV1 name(String name) { - - this.name = name; - return this; - } + public void setSlug(String slug) { + this.slug = slug; + } - /** - * The human-readable name. - * @return name - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "The human-readable name.") + public WorkspaceV1 name(String name) { - public String getName() { - return name; - } + this.name = name; + return this; + } + /** + * The human-readable name. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public void setName(String name) { - this.name = 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; + } + WorkspaceV1 workspaceV1 = (WorkspaceV1) o; + return Objects.equals(this.id, workspaceV1.id) + && Objects.equals(this.slug, workspaceV1.slug) + && Objects.equals(this.name, workspaceV1.name); + } + @Override + public int hashCode() { + return Objects.hash(id, slug, name); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WorkspaceV1 {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - WorkspaceV1 workspaceV1 = (WorkspaceV1) o; - return Objects.equals(this.id, workspaceV1.id) && - Objects.equals(this.slug, workspaceV1.slug) && - Objects.equals(this.name, workspaceV1.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, slug, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WorkspaceV1 {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" slug: ").append(toIndentedString(slug)).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"; + + 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("slug"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("slug"); + openapiRequiredFields.add("name"); } - return o.toString().replace("\n", "\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("slug"); - openapiFields.add("name"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("id"); - openapiRequiredFields.add("slug"); - openapiRequiredFields.add("name"); - } - - /** - * Validates the JSON Object and throws an exception if issues found - * - * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to WorkspaceV1 - */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!WorkspaceV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in WorkspaceV1 is not found in the empty JSON string", WorkspaceV1.openapiRequiredFields.toString())); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WorkspaceV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WorkspaceV1.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + "The required field(s) %s in WorkspaceV1 is not found in the empty" + + " JSON string", + WorkspaceV1.openapiRequiredFields.toString())); + } } - } - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!WorkspaceV1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WorkspaceV1` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WorkspaceV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + "The field `%s` in the JSON string is not defined in the" + + " `WorkspaceV1` properties. JSON: %s", + entry.getKey(), jsonElement.toString())); + } } - } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : WorkspaceV1.openapiRequiredFields) { - if (jsonObj.get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WorkspaceV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("slug").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + "Expected the field `slug` to be a primitive type in the JSON string" + + " but got `%s`", + jsonObj.get("slug").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("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("slug").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").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 (!WorkspaceV1.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WorkspaceV1' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(WorkspaceV1.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, WorkspaceV1 value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WorkspaceV1 read(JsonReader in) throws IOException { - JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); - validateJsonObject(jsonObj); - return thisAdapter.fromJsonTree(jsonObj); - } - - }.nullSafe(); } - } - - /** - * Create an instance of WorkspaceV1 given an JSON string - * - * @param jsonString JSON string - * @return An instance of WorkspaceV1 - * @throws IOException if the JSON string is invalid with respect to WorkspaceV1 - */ - public static WorkspaceV1 fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WorkspaceV1.class); - } - - /** - * Convert an instance of WorkspaceV1 to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WorkspaceV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WorkspaceV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(WorkspaceV1.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, WorkspaceV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WorkspaceV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of WorkspaceV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of WorkspaceV1 + * @throws IOException if the JSON string is invalid with respect to WorkspaceV1 + */ + public static WorkspaceV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WorkspaceV1.class); + } + + /** + * Convert an instance of WorkspaceV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/test/java/com/segment/publicapi/api/EchoApiTest.java b/src/test/java/com/segment/publicapi/api/EchoApiTest.java index 0cbfbca3..dff6d502 100644 --- a/src/test/java/com/segment/publicapi/api/EchoApiTest.java +++ b/src/test/java/com/segment/publicapi/api/EchoApiTest.java @@ -2,7 +2,6 @@ * Segment Public API * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. * - * The version of the OpenAPI document: 32.0.2 * Contact: friends@segment.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -10,28 +9,22 @@ * Do not edit the class manually. */ - package com.segment.publicapi.api; import com.google.gson.Gson; import com.segment.publicapi.ApiException; import com.segment.publicapi.models.Echo200Response; -import com.segment.publicapi.models.EchoAlphaOutput; +import com.segment.publicapi.models.EchoV1Output; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; -import org.junit.jupiter.api.Test; - import java.io.IOException; import java.net.HttpURLConnection; import java.net.InetSocketAddress; import java.util.HashMap; -import java.util.Map; - -/** - * API tests for TestingApi - */ +import org.junit.jupiter.api.Test; +/** API tests for TestingApi */ public class EchoApiTest { private final TestingApi api = new TestingApi(); @@ -39,7 +32,7 @@ public class EchoApiTest { /** * Echo * - * Public Echo endpoint. + *

Public Echo endpoint. * * @throws ApiException if the Api call fails */ @@ -49,18 +42,25 @@ public void echoTest() throws ApiException, IOException { int port = 8000; HttpServer httpServer = HttpServer.create(new InetSocketAddress(port), 0); - httpServer.createContext("/echo", new HttpHandler() { - @Override - public void handle(HttpExchange exchange) throws IOException { - Gson gson = new Gson(); - Echo200Response echo200Response = new Echo200Response().data( - new EchoAlphaOutput().headers(new HashMap<>()).method(EchoAlphaOutput.MethodEnum.GET).message(message)); - byte[] response = gson.toJson(echo200Response).getBytes(); - exchange.sendResponseHeaders(HttpURLConnection.HTTP_OK, response.length); - exchange.getResponseBody().write(response); - exchange.close(); - } - }); + httpServer.createContext( + "/echo", + new HttpHandler() { + @Override + public void handle(HttpExchange exchange) throws IOException { + Gson gson = new Gson(); + Echo200Response echo200Response = + new Echo200Response() + .data( + new EchoV1Output() + .headers(new HashMap<>()) + .method(EchoV1Output.MethodEnum.GET) + .message(message)); + byte[] response = gson.toJson(echo200Response).getBytes(); + exchange.sendResponseHeaders(HttpURLConnection.HTTP_OK, response.length); + exchange.getResponseBody().write(response); + exchange.close(); + } + }); httpServer.start(); try {